### Uniconta API Login Example Source: https://www.uniconta.com/developers-unipedia/-global/api-global/api Provides a complete example of establishing a connection, creating a session, and logging into the Uniconta API. This includes handling login results and checking for successful authentication. ```csharp private static UnicontaConnection _conn { get; set; } private static Session _sess { get; set; } private static Guid _key { get; set; } public static async Task Login(string username, string password) { var loginResult = await _sess.LoginAsync(username, password, LoginType.API, _key); if (loginResult != ErrorCodes.Succes) return false; return true; } public static void main(string[] args) { _conn = new UnicontaConnection(APITarget.Live); _sess = new Session(_conn); if (Login("JohnDoe", "123")) // Your business logic here { // User is logged in } } ``` -------------------------------- ### Uniconta QueryAPI Simple Select Example Source: https://www.uniconta.com/developers-unipedia/-global/api-global/api Provides a basic example of using the QueryAPI to retrieve all GLAccount entries. It initializes a QueryAPI instance and then calls the `Query` method without specific parameters, indicating a fetch of all records of the default type. ```csharp var qapi = new QueryAPI(session, company); var AccountList = await qapi.Query(); ``` -------------------------------- ### Uniconta OData API Filtering Example Source: https://www.uniconta.com/developers-unipedia/-global/odata-rest-api-testing-with-postman Demonstrates how to filter or query specific entries from the Uniconta OData API. This example shows filtering by 'Name' and 'Value' to retrieve creditor client information. ```HTTP https://odata.uniconta.com/api/Entities/CreditorClient?Name=Account&Value=2001 ``` -------------------------------- ### Uniconta OData API POST Request Body Example Source: https://www.uniconta.com/developers-unipedia/-global/odata-rest-api-testing-with-postman A sample JSON payload for creating a new entity using a POST request to the Uniconta OData API. This example shows the required properties for creating a 'CreditorClient'. ```JSON { "Account": 2001, "Name": "My Test Account" } ``` -------------------------------- ### Uniconta OData API - Sending a PUT Request Source: https://www.uniconta.com/developers-unipedia/-global/odata-rest-api-testing-with-postman Provides a step-by-step guide and example for sending a PUT request to update an entity in the Uniconta OData API. ```APIDOC ## Uniconta OData API - Sending a PUT Request ### Description Instructions for updating an existing entity using a PUT request, including retrieving the entity and formatting the request body. ### Steps 1. Retrieve the entity you wish to update using a GET request (e.g., by account). 2. Copy the JSON response of the entity. 3. Modify the necessary fields in the JSON payload. * Note: Properties with `null` values will be omitted unless explicitly included. 4. Send the modified JSON as the request body in a PUT request to the appropriate endpoint (e.g., `https://odata.uniconta.com/api/Entities/Update/CreditorClient`). ### Request Example (Body for PUT) ```json { "_UpdatedAt": "2020-01-29T08:15:50Z", "_Account": "2001", "_Name": "MyRestCreditor", "Address2": "My Extra Address" } ``` ### Response * A successful update typically returns a `200 OK` status code. ``` -------------------------------- ### Example User Defined Table Class Source: https://www.uniconta.com/developers-unipedia/-global/api-global/user-defined-tables This is an example C# class representing a user-defined table named 'MyTable' in Uniconta. It inherits from TableData and defines properties for 'Date', 'EmployeeID', and 'PathToFile'. Each property is mapped to a user field using methods like GetUserFieldDateTime and SetUserFieldDateTime, and includes a Display attribute for naming. This structure allows Uniconta to correctly handle and display data for this custom table. ```csharp public class MyTable : TableData { public override int UserDefinedId { get { return 1234; } } [Display(Name = "Date")] public DateTime Date { get { return this.GetUserFieldDateTime(-1); } set { this.SetUserFieldDateTime(-1, value); NotifyPropertyChanged("Date"); } } [Display(Name = "EmployeeID")] public long EmployeeID { get { return this.GetUserFieldInt64(-1); } set { this.SetUserFieldInt64(-1, value); NotifyPropertyChanged("EmployeeID"); } } [Display(Name = "PathToFile")] public string PathToFile { get { return this.GetUserFieldString(-1); } set { this.SetUserFieldString(-1, value); NotifyPropertyChanged("PathToFile"); } } } ``` -------------------------------- ### Uniconta Custom Page Creation from GitHub Code Source: https://www.uniconta.com/developers-unipedia/-global Instructions on creating custom Uniconta pages by downloading XAML and XAML.cs files from the Uniconta GitHub repository. It guides users on how to download files and the solution project, and notes the requirement for licensed devexpress dlls. ```text 1. Navigate to Uniconta GitHub: https://github.com/Uniconta/Uniconta-Pages 2. For a custom DebtorAccount page, download Debtor/DebtorAccount.xaml and Debtor/DebtorAccount..xaml.cs. 3. Download the solution project: https://github.com/Uniconta/Uniconta-Pages/blob/master/CreateCustomPageProject.zip 4. Add licensed devexpress dlls to the project. ``` -------------------------------- ### XAML Editors for Form Page Fields Source: https://www.uniconta.com/developers-unipedia/-global/create-plugin-devexpress-library Shows examples of using different Uniconta editors within a XAML form page. It demonstrates a `TextEditor` for simple text input and a `LookupEditor` for selecting values from a lookup list, both bound to data fields. ```xml ``` -------------------------------- ### Post Invoice and Get PDF using InvoiceAPI (C#) Source: https://www.uniconta.com/developers-unipedia/-global/api-global/post-invoice-and-get-pdf This C# code snippet demonstrates how to use the InvoiceAPI.PostInvoicePDF method to post an invoice and retrieve its PDF content. It requires instantiating the InvoiceAPI, fetching order details, and then saving the generated PDF to a specified file path. The method returns the invoice PDF as a byte array. ```csharp // Instantiate InvoiceAPI var iapi = new InvoiceAPI(crud); // Get a specific order and acquire its lines var order = new DebtorOrderClient { OrderNumber = 559 }; await crud.Read(order); var lines = await crud.Query(order); // Post the Invoice and get the PDF var invoiceResult = await iapi.PostInvoicePDF(order, lines, DateTime.Now, 0, false, CompanyLayoutType.Invoice); var data = invoiceResult.pdf; System.IO.File.WriteAllBytes(@"C:\\Uniconta\\MyTestPDF.pdf", data); ``` -------------------------------- ### Lookup Debtor or Creditor from Inventory Transactions using Cache in Uniconta Source: https://www.uniconta.com/developers-unipedia/-global/api-global/minimize-network-traffic-and-optimize-speed Provides an example of iterating through inventory transactions and using the cache to efficiently look up associated debtor or creditor records. This pattern minimizes API calls by first loading all necessary debtor and creditor data into the cache. ```csharp var Debtors = await api.LoadCache < Debtor > (); var Creditors = await api.LoadCache < Creditor > (); var trans = await api.Query < InvTrans > (); foreach(var tran in trans) { if (tran._DCAccount != null) { if (tran._MovementType == (byte) InvMovementType.Debtor) { var rec = Debtors.Get(tran._DCAccount); } else if (tran._MovementType == (byte) InvMovementType.Creditor) { var rec = Creditors.Get(tran._DCAccount); } } } ``` -------------------------------- ### Uniconta Web Frame Integration for External URLs Source: https://www.uniconta.com/developers-unipedia/-global This example shows how to open external URLs in a new tab within Uniconta using the 'ViewURLPage' control. It details how to pass item properties as URL parameters and enable synchronous mode. ```text Control: ViewURLPage Arguments: url=https://odata.uniconta.com/api/Entities/InvItemClient?Name=Item&Value={Item} Sync=true ``` -------------------------------- ### Add Custom Labels with Localization Class - C# Source: https://www.uniconta.com/developers-unipedia/-global/api-global/localization Shows how to add new, custom labels to the Localization system for a specific language (Danish in this example). This allows developers to define their own translations for application or plugin elements. The AddLabel method is used for this purpose. ```csharp var loc = Localization.GetLocalization(Language.da); loc.AddLabel("BestProgrammingLanguage", "C# Er det bedste programmeringssprog"); ``` -------------------------------- ### SetContent Method for IContentPluginBase Plugin (C#) Source: https://www.uniconta.com/developers-unipedia/-global/open-new-icontentpluginbase-content Implements the SetContent method within an IContentPluginBase plugin to dynamically set the content of a plugin's tab. This example demonstrates creating a simple button and assigning it to the control's Content property. Dependencies include the System.Windows.Controls namespace for ContentControl and Button. ```csharp //summary // The SetContent method to set the content //summary public void SetContent(ContentControl control) { Button buttonControl = new Button() { Content="PluginButton", Height=25, Width=100 }; control.Content = buttonControl; } ``` -------------------------------- ### CrudAPI Initialization Source: https://www.uniconta.com/developers-unipedia/-global/uniconta-api Demonstrates how to initialize the CrudAPI with a session and company. ```APIDOC ## CrudAPI Initialization ### Description Initializes the CrudAPI client with a provided session and company. ### Method Constructor ### Code Example ```csharp var capi = new CrudAPI(session, company); ``` ``` -------------------------------- ### Initialize NHRAPI Class for OIOUBL Operations Source: https://www.uniconta.com/developers-unipedia/-global/oioubl-document-mapping-send-nemhandel Demonstrates how to instantiate the NHRAPI class, which is used for OIOUBL document processing and NemHandel integration. Initialization can be done using an existing BaseAPI object or by providing a Session and Company object. This class is crucial for interacting with Uniconta's API for invoice management. ```csharp public NHRAPI(BaseAPI api) // use an existing API object public NHRAPI(Session session, Company company) // use a session + a company ``` -------------------------------- ### CrudAPI Initialization Source: https://www.uniconta.com/developers-unipedia/-global/api-global/api Demonstrates how to initialize the CrudAPI with a session and company. ```APIDOC ## CrudAPI Initialization ### Description Initializes the CrudAPI instance using a provided session and company. ### Method Constructor ### Endpoint N/A (Class Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript var capi = new CrudAPI(session, company); ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### Access Uniconta Company Data Source: https://www.uniconta.com/developers-unipedia/-global/api-global/api Demonstrates how to retrieve company information using the Uniconta API. It includes methods to get all companies, get a company by ID or name, and set a default company. ```csharp public Task GetCompanies() public Task GetCompany(int CompanyId) public Task GetCompany(string Name) public Company DefaultCompany get; set; ``` -------------------------------- ### Load Data using Uniconta Cache Source: https://www.uniconta.com/developers-unipedia/-global/api-global/minimize-network-traffic-and-optimize-speed Illustrates how to load master data from the Uniconta cache using `LoadCache`. This approach leverages pre-loaded data, significantly reducing network traffic and improving response times compared to direct API queries. ```csharp var Debtors = await api.LoadCache(); ``` -------------------------------- ### Get Specific Record from Cache by Reference in Uniconta Source: https://www.uniconta.com/developers-unipedia/-global/api-global/minimize-network-traffic-and-optimize-speed Explains how to retrieve a specific record from a cached collection using the `Get()` method in Uniconta. This method allows for quick lookups based on account numbers or row IDs. ```csharp var Debtor = Debtors.Get(“1000”) // value passed is account number var Debtor = Debtors.Get(1234) // value passed is rowed. ``` -------------------------------- ### Post Invoice using InvoiceAPI Source: https://www.uniconta.com/developers-unipedia/-global/api-global/posting-an-invoice This code snippet demonstrates how to post an invoice for a given order. It retrieves order details and order lines, then uses the InvoiceAPI to create the invoice. The method handles auto-generating invoice numbers and allows for simulation before actual invoicing. Dependencies include access to the 'crud' object and the necessary client classes like DebtorOrderClient and DebtorOrderLineClient. ```csharp // Goal: Invoice an order with order number: 55 // Smart way to get a specific order var order = new DebtorOrderClient { OrderNumber = 55 }; await crud.Read(order); // Get all orderlines on the order using a master query var orderLines = await crud.Query(order); // Initialize invoice api var iapi = new InvoiceAPI(crud); // Post Invoice var result = await iapi.PostInvoice( order, // The order orderLines, // The order lines of the order DateTime.Now, // The DateTime of the invoice 0, // The invoice number. 0 means auto generate invoice number false); // Simulation false. Actually invoice the order ``` -------------------------------- ### Uniconta OData API PUT Request Body Example Source: https://www.uniconta.com/developers-unipedia/-global/odata-rest-api-testing-with-postman An example JSON payload for sending a PUT request to update an entity in the Uniconta OData API. It includes properties like '_UpdatedAt', '_Account', '_Name', and demonstrates how to handle null properties by explicitly including them. ```JSON { "_UpdatedAt": "2020-01-29T08:15:50Z", "_Account": "2001", "_Name": "MyRestCreditor", "Address2": "My Extra Address" } ``` -------------------------------- ### Efficient Data Loading and Processing in C# Source: https://www.uniconta.com/developers-unipedia/-global/api-global/minimize-network-traffic-and-optimize-speed Demonstrates efficient loading of data using `api.LoadCache` and `api.Query`, followed by processing in C#. This approach avoids breaking down complex queries into multiple smaller calls, improving performance by retrieving all necessary data in one go and then manipulating it in C#. ```csharp var Creditors = await api.LoadCache < Creditor > (); var trans = await api.Query < InvTrans > (); foreach(var tran in trans) { if (tran._DCAccount != null) { if (tran._MovementType == (byte) InvMovementType.Debtor) { var rec = Debtors.Get(tran._DCAccount); } else if (tran._MovementType == (byte) InvMovementType.Creditor) { var rec = Creditors.Get(tran._DCAccount); } } } ``` -------------------------------- ### C# Initialize Method Source: https://www.uniconta.com/developers-unipedia/-global/develop-a-pageeventbase-plugin Initializes local variables within a Uniconta component using provided page, API, and master entity objects. This method is crucial for setting up the component's context. ```csharp public void Initialize(object page, CrudAPI api, UnicontaBaseEntity master) { this.page = page; this.api = api; this.master = master; } ``` -------------------------------- ### Get Uniconta Entity by ID Source: https://www.uniconta.com/developers-unipedia/-global/crud-operations-in-odata Retrieves a specific Uniconta entity by its unique identifier. ```APIDOC ## GET /api/Entities/{entityName}/{id} ### Description Retrieves a specific Uniconta entity using its name and ID. ### Method GET ### Endpoint /api/Entities/{entityName}/{id} ### Parameters #### Path Parameters - **entityName** (string) - Required - The name of the entity to retrieve. - **id** (int) - Required - The unique identifier of the entity. ### Request Example (No specific request body for GET by ID) ### Response #### Success Response (200) - **entity** (object) - The requested Uniconta entity. #### Response Example ```json { "entity": { ... } } ``` ``` -------------------------------- ### Get Uniconta Entity by Property Source: https://www.uniconta.com/developers-unipedia/-global/crud-operations-in-odata Retrieves Uniconta entities based on specified property values. ```APIDOC ## GET /api/Entities/{entityName} ### Description Retrieves Uniconta entities based on specified property criteria. ### Method GET ### Endpoint /api/Entities/{entityName} ### Parameters #### Path Parameters - **entityName** (string) - Required - The name of the entity to retrieve. #### Query Parameters - **property** (UnicontaProperty) - Required - An object specifying the property and its value for filtering. ### Request Example (Query parameters are used for filtering) ### Response #### Success Response (200) - **entities** (array) - A list of Uniconta entities matching the criteria. #### Response Example ```json { "entities": [ { ... }, { ... } ] } ``` ``` -------------------------------- ### Initialize QueryAPI for Uniconta Data Retrieval Source: https://www.uniconta.com/developers-unipedia/-global/uniconta-api Initializes the QueryAPI, which is used for retrieving data from the Uniconta server. It requires an active session and a company entity to operate. ```csharp public QueryAPI(Session session, Company CompanyEntity) ``` -------------------------------- ### Create Custom Uniconta Pages From Github Code Source: https://www.uniconta.com/developers-unipedia/-global Instructions on how to create custom Uniconta pages using XAML and C# code from GitHub. ```APIDOC ## Create Custom Uniconta Pages ### Description Create and modify custom Uniconta pages by downloading and adapting XAML and C# files from the Uniconta GitHub repository. ### Steps 1. Navigate to the Uniconta Pages GitHub repository: `https://github.com/Uniconta/Uniconta-Pages`. 2. For specific pages (e.g., DebtorAccount), download the `.xaml` and `.xaml.cs` files from their respective directories (e.g., `Debtor/DebtorAccount.xaml`). 3. Download the solution project template for creating custom pages: `https://github.com/Uniconta/Uniconta-Pages/blob/master/CreateCustomPageProject.zip`. 4. Add and modify the downloaded page files within the solution project. ### Note Ensure you have licensed DevExpress DLLs added to your project. ``` -------------------------------- ### Load Data with Uniconta API Source: https://www.uniconta.com/developers-unipedia/-global/api-global/minimize-network-traffic-and-optimize-speed Demonstrates the standard method for querying data directly from the Uniconta API. This method establishes a connection, sends a request, and retrieves data, incurring network overhead. ```csharp var Debtors = await api.Query(); ``` -------------------------------- ### C# GetLastError Property Source: https://www.uniconta.com/developers-unipedia/-global/develop-a-pageeventbase-plugin A C# property to retrieve the last error message and clear it. It is designed to be accessed once to get the error and then reset. ```csharp public string GetLastError { get { var s = _LastError; _LastError = null; return s; } } ``` -------------------------------- ### ODATA REST API - Testing with Postman Source: https://www.uniconta.com/developers-unipedia/-global Guide on how to use Postman to test the Uniconta ODATA API. ```APIDOC ## ODATA REST API Testing with Postman ### Description This guide explains how to use Postman to interact with the Uniconta ODATA API. ### Authentication No API key is required. Uniconta login credentials are sufficient to authenticate API calls. ### Endpoints API endpoints can be found within the Uniconta documentation. ``` -------------------------------- ### Instantiate Uniconta API Connection Source: https://www.uniconta.com/developers-unipedia/-global/api-global/api Establishes a connection to the Uniconta ERP server. This is the first step to interacting with the API and identifies the target server. Currently, only the Live server is supported. ```csharp var connection = new UnicontaConnection(APITarget.Live); ``` -------------------------------- ### Add Data Grid Template Column in XAML Source: https://www.uniconta.com/developers-unipedia/-global/create-plugin-devexpress-library This code shows how to add a template column to a Uniconta data grid. This specific example creates a column named 'Account' intended to display account-related data. ```xaml ``` -------------------------------- ### Add and Set Up Ribbon Control in C# Source: https://www.uniconta.com/developers-unipedia/-global/create-plugin-devexpress-library This C# code snippet demonstrates how to populate the UnicontaRibbonControl with items generated by CreateRibbonItems(), set the ribbon control for the grid, and attach an event handler for item clicks. ```csharp localMenu.AddRibbonItems(CreateRibbonItems()); SetRibbonControl(localMenu, debtorGrid); localMenu.OnItemClicked += LocalMenu_OnItemClicked; // to add on-click function ``` -------------------------------- ### Get Uniconta Entity by Property using OData Source: https://www.uniconta.com/developers-unipedia/-global/crud-operations-in-odata Fetches a Uniconta entity based on specified property criteria. It accepts the entity name and a UnicontaProperty object, returning an HttpResponseMessage. This allows for more flexible entity retrieval than just by ID. ```csharp public async Task Get(string entityName, [FromUri]UnicontaProperty property) { // Implementation to fetch entity by property } ``` -------------------------------- ### Generate and Send OIOUBL XML with Uniconta API (C#) Source: https://www.uniconta.com/developers-unipedia/-global/oioubl-document-mapping-send-nemhandel This C# code snippet shows how to generate OIOUBL XML from a DebtorInvoiceClient and send it using the Uniconta NHRAPI. It requires a valid session and company, defines XML mappings, retrieves an invoice, generates the XML, and sends it via NemHandel, with error checking at each step. Dependencies include Uniconta API libraries. ```csharp using System; using System.Collections.Generic; using System.Threading.Tasks; using Uniconta.API.DebtorCreditor; // NHRAPI using Uniconta.API.Service; // Session using Uniconta.API.System; // CrudAPI using Uniconta.ClientTools.DataModel; // DebtorInvoiceClient using Uniconta.Common; // ErrorCodes using Uniconta.DataModel; // Company class Program { static async Task Main(string[] args) { // 1) Create session, and get company (not included in example) Session session = null; // TODO: implement Company company = null; // TODO: implement // 2) Create API object var api = new NHRAPI(session, company); // 3) Define your XML path/value pairs var xmlPathAndValue = new Dictionary { ["Note"] = "Thank you for your business", ["InvoiceLine/Note"] = "Handle with care", ["AccountingSupplierParty/Party/PostalAddress/Country/IdentificationCode"] = "DK", ["PaymentTerms/Note"] = "Net 14 days", ["OrderReference/ID"] = "PO-2025-0916" }; // 4) Get a invoice ({filter} to be defined by you) var invoice = (await new CrudAPI(api).Query(/*filter}*/)).FirstOrDefault(); if (invoice == null) { Console.Error.WriteLine("Invoice not found."); return; } // 5) Generate the OIOUBL XML with your mappings string xml = await api.GetValidatedeDeliveryMappingDoc(invoice, xmlPathAndValue); // 6) Check if generation failed if (xml == null) { Console.Error.WriteLine($"GetValidatedeDeliveryMappingDoc failed: {api.LastError}"); return; } // 7) Send via NemHandel ErrorCodes result = await api.SendOIOUBL(xml); // 8) Check the result if (result == ErrorCodes.Succes) Console.WriteLine("OIOUBL document sent successfully via NemHandel."); else Console.Error.WriteLine($"SendOIOUBL failed with: {result}"); } } ``` -------------------------------- ### Uniconta OData API Endpoints Source: https://www.uniconta.com/developers-unipedia/-global/odata-rest-api-testing-with-postman Common endpoints for interacting with Uniconta OData API entities. These include operations for reading, inserting, deleting, and updating data. Different HTTP methods (GET, POST, DELETE, PUT) are used for these operations. ```HTTP GET : https://odata.uniconta.com/api/Entities/GLDailyJournalClient https://odata.uniconta.com/api/Entities/Read/GLDailyJournalClient POST : https://odata.uniconta.com/api/Entities/Insert/GLDailyJournalClient DELETE : https://odata.uniconta.com/api/Entities/Delete/GLDailyJournalClient PUT : https://odata.uniconta.com/api/Entities/Update/GLDailyJournalClient ``` -------------------------------- ### Get Uniconta Entity by ID using OData Source: https://www.uniconta.com/developers-unipedia/-global/crud-operations-in-odata Retrieves a Uniconta entity by its unique identifier. This function takes the entity name and the entity's ID as input and returns an HttpResponseMessage. It's a common pattern for fetching specific records. ```csharp public async Task Get(string entityName, int id) { // Implementation to fetch entity by ID } ``` -------------------------------- ### Execute Plugin Event in C# Source: https://www.uniconta.com/developers-unipedia/-global/event-handling This C# code demonstrates how to instantiate and trigger a plugin event. It involves creating an instance of PluginEventArgs, setting the desired EventType, and then calling the OnExecute method. This is useful for programmatically controlling plugin behavior. ```csharp PluginEventArgs arg = new PluginEventArgs(); arg.EventType = PluginEvent.RefreshGrid; OnExecute(null, arg); ``` -------------------------------- ### Create and Log in to a Uniconta API Session Source: https://www.uniconta.com/developers-unipedia/-global/api-global/api Creates a user session for interacting with the ERP server. A session represents a logged-in user. The code demonstrates logging in with username, password, login type, and a specific GUID. ```csharp var session = new Session(connection); bool loggedIn = await session.LoginAsync("John", "Abc123", LoginType.API, new Guid("Guid that we provide")); ``` -------------------------------- ### Uniconta Local Exception Logging Setup Source: https://www.uniconta.com/developers-unipedia/-global This configuration enables Uniconta to log exceptions on the local machine instead of the server. It requires setting up an environment variable named 'UnicontaLogs' with the desired log path. ```bash export UnicontaLogs="/path/to/your/log/directory" ``` -------------------------------- ### Create and Log in to Uniconta Session Source: https://www.uniconta.com/developers-unipedia/-global/uniconta-api Creates a user session for interacting with the Uniconta ERP server. A session represents a logged-in user, and only one user can be active per session. The LoginAsync method requires user credentials, login type, and a unique identifier. ```csharp var session = new Session(connection); bool loggedIn = await session.LoginAsync("John", "Abc123", LoginType.API, new Guid("Cuid that we provide")); ``` -------------------------------- ### Implement Uniconta Plugin Interface (C#) Source: https://www.uniconta.com/developers-unipedia/-global/develop-user-plugin The IPluginBase interface is the core component for developing Uniconta plugins. Implementing this interface allows your DLL to be recognized and utilized by Uniconta's Windows API. It defines essential methods for plugin identification, error handling, execution logic, data manipulation, and event handling. ```csharp public interface IPluginBase { string Name { get; } string GetErrorDescription(); ErrorCodes Execute(UnicontaBaseEntity master, UnicontaBaseEntity currentRow, IEnumerable source, string command, string args); void SetMaster(List masters); void SetAPI(BaseAPI api); event EventHandler OnExecute; void Intialize(); string[] GetDependentAssembliesName(); } ``` -------------------------------- ### Uniconta OData CRUD Operations Source: https://www.uniconta.com/developers-unipedia/-global This snippet outlines the available functions for performing CRUD (Create, Read, Update, Delete) operations using the Uniconta OData API. It provides example function signatures and URLs for accessing entities. ```csharp // Get Uniconta Entity by Id public async Task Get(string entityName, int id) // Get Uniconta Entity Name and Property public async Task Get(string entityName, [FromUri]UnicontaProperty property) Url: https://odata.uniconta.com/api/Entities/GLDailyJournalClient // Insert Uniconta Entity public async Task Insert([FromUri]string entityName, [FromBody]object value) ``` -------------------------------- ### Initialize GridPage Constructor and Data Grid in C# Source: https://www.uniconta.com/developers-unipedia/-global/create-plugin-devexpress-library This C# code defines the constructor for the GridPage class, inheriting from GridBasePage. It initializes the component and assigns the API to the debtorGrid instance, preparing it for data operations. ```csharp public GridPage(BaseAPI api): base(api, string.Empty) { InitializeComponent(); debtorGrid.api = api; } ``` -------------------------------- ### Access Uniconta Company Information Source: https://www.uniconta.com/developers-unipedia/-global/uniconta-api Retrieves information about companies associated with a Uniconta session. Methods are available to get all companies, a specific company by ID or name, or to set a default company. A Company object holds all data for a specific business entity within the ERP. ```csharp public Task GetCompanies() public Task GetCompany(int CompanyId) public Task GetCompany(string Name) public Company DefaultCompany { get; set; } ``` -------------------------------- ### C# Form Page Constructors (Edit and Add) Source: https://www.uniconta.com/developers-unipedia/-global/create-plugin-devexpress-library Demonstrates the two required constructors for a form page: one for editing existing data, accepting `UnicontaBaseEntity`, and another for adding new data, accepting `CrudAPI` and a dummy string. Both initialize the component and page. ```csharp /* for edit*/ public FormPage(UnicontaBaseEntity sourcedata) : base(sourcedata, true) { InitializeComponent(); InitPage(api); } /* for add */ public FormPage(CrudAPI crudApi, string dummy) : base(crudApi, dummy) { InitializeComponent(); InitPage(crudApi); } ```