/// <summary> /// Reads one or several records of a file ina asynchronous way with XML input and output format. /// </summary> /// <param name="filename">File name to read.</param> /// <param name="records">A list of item IDs to read.</param> /// <param name="dictionaries">List of dictionaries to read, separated by space. If this list is not set, all fields are returned. You may use the format LKFLDx where x is the attribute number.</param> /// <param name="readOptions">Object that defines the different reading options of the Function: Calculated, dictClause, conversion, formatSpec, originalRecords.</param> /// <param name="xmlFormat">Different XML output formats.</param> /// <param name="customVars">Free text sent to the database allows management of additional behaviours in SUB.LK.MAIN.CONTROL.CUSTOM, which is called when this parameter is set.</param> /// <param name="receiveTimeout">Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.</param> /// <returns>The results of the operation.</returns> public Task <string> ReadAsync(string filename, string records, string dictionaries = "", ReadOptions readOptions = null, XML_FORMAT xmlFormat = XML_FORMAT.XML, string customVars = "", int receiveTimeout = 0) { var task = new Task <string>(() => { return(this.Read(filename, records, dictionaries, readOptions, xmlFormat, customVars, receiveTimeout)); }); task.Start(); return(task); }
/// <summary> /// Update one or several records of a file, ina asynchronous way with XML input and output format. /// </summary> /// <param name="filename">Name of the file being updated.</param> /// <param name="records">Buffer of record data to update. Inside this string are the recordIds, the modified records, and the originalRecords.</param> /// <param name="updateOptions">Object with write options, including optimisticLockControl, readAfter, calculated, dictionaries, conversion, formatSpec, originalRecords.</param> /// <param name="xmlFormat">Different XML output formats.</param> /// <param name="customVars">Free text sent to the database allows management of additional behaviours in SUB.LK.MAIN.CONTROL.CUSTOM, which is called when this parameter is set.</param> /// <param name="receiveTimeout">Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.</param> /// <returns>The results of the operation.</returns> /// <remarks> /// Inside the records argument, the recordIds and the modified records always must be specified. But the originalRecords not always. /// When <see cref="UpdateOptions">updateOptions</see> argument is specified and the <see cref="UpdateOptions.OptimisticLockControl"/> property is set to true, a copy of the record must be provided before the modification (originalRecords argument) /// to use the Optimistic Lock technique. This copy can be obtained from a previous <see cref="ReadAsync"/> operation. The database, before executing the modification, /// reads the record and compares it with the copy in originalRecords, if they are equal the modified record is executed. /// But if they are not equal, it means that the record has been modified by other user and its modification will not be saved. /// The record will have to be read, modified and saved again. /// </remarks> public Task <string> UpdateAsync(string filename, string records, UpdateOptions updateOptions = null, XML_FORMAT xmlFormat = XML_FORMAT.XML, string customVars = "", int receiveTimeout = 0) { var task = new Task <string>(() => { return(this.Update(filename, records, updateOptions, xmlFormat, customVars, receiveTimeout)); }); task.Start(); return(task); }
/// <summary> /// Executes a Query in the Database, ina asynchronous way with XML output format. /// </summary> /// <param name="filename">Name of file on which the operation is performed. For example LK.ORDERS</param> /// <param name="selectClause">Statement fragment specifies the selection condition. For example WITH CUSTOMER = '1'</param> /// <param name="sortClause">Statement fragment specifies the selection order. If there is a selection rule, Linkar will execute a SSELECT, otherwise Linkar will execute a SELECT. For example BY CUSTOMER</param> /// <param name="dictClause">Space-delimited list of dictionaries to read. If this list is not set, all fields are returned. For example CUSTOMER DATE ITEM. You may use the format LKFLDx where x is the attribute number.</param> /// <param name="preSelectClause">An optional command that executes before the main Select</param> /// <param name="selectOptions">Object with options to manage how records are selected, including calculated, dictionaries, conversion, formatSpec, originalRecords, onlyItemId, pagination, regPage, numPage.</param> /// <param name="xmlFormat">Different XML output formats.</param> /// <param name="customVars">Free text sent to the database allows management of additional behaviours in SUB.LK.MAIN.CONTROL.CUSTOM, which is called when this parameter is set.</param> /// <param name="receiveTimeout">Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.</param> /// <returns>The results of the operation.</returns> /// <remarks> /// In the preSelectClause argument these operations can be carried out before executing the Select statement: /// <list type="bullet"> /// <item>Previously call to a saved list with the GET.LIST command to use it in the Main Select input</item> /// <item>Make a previous Select to use the result as the Main Select input, with the SELECT or SSELECT commands.In this case the entire sentence must be indicated in the PreselectClause. For example:SSELECT LK.ORDERS WITH CUSTOMER = '1'</item> /// <item>Exploit a Main File index to use the result as a Main Select input, with the SELECTINDEX command. The syntax for all the databases is SELECTINDEX index.name.value. For example SELECTINDEX ITEM,"101691"</item> /// </list> /// </remarks> public Task <string> SelectAsync(string filename, string selectClause = "", string sortClause = "", string dictClause = "", string preSelectClause = "", SelectOptions selectOptions = null, XML_FORMAT xmlFormat = XML_FORMAT.XML, string customVars = "", int receiveTimeout = 0) { var task = new Task <string>(() => { return(this.Select(filename, selectClause, sortClause, dictClause, preSelectClause, selectOptions, xmlFormat, customVars, receiveTimeout)); }); task.Start(); return(task); }