예제 #1
0
        private async void B_Items_Click(object sender, RoutedEventArgs e)
        {
            // Getting CrudAPI
            var crudAPI = UnicontaAPIManager.GetCrudAPI();

            crudAPI.RunInTransaction = false;

            // Parsing CSV
            var items = CSVUtils.ParseItems(@"C:\src\Uniconta\Technical-Training-Cases-master\TrainingData\CompanyData\Finace-Items.csv");

            // Creating Insert List
            var newInvItemClients = new List <InvItemClient>();

            foreach (var item in items)
            {
                // TODO: Add the item to the newInvItemClients List
            }
            ;

            // Calling insert API
            // TODO: Call the insert API to insert newInvItemClients
        }
예제 #2
0
        private async void B_Items_Click(object sender, RoutedEventArgs e)
        {
            // Getting CrudAPI
            var crudAPI = UnicontaAPIManager.GetCrudAPI();

            crudAPI.RunInTransaction = false;

            // Parsing CSV
            var items = CSVUtils.ParseItems(@"C:\src\Uniconta\Technical-Training-Cases-master\TrainingData\CompanyData\Finace-Items.csv");

            // Creating Insert List
            var newInvItemClients = new List <InvItemClient>();

            foreach (var item in items)
            {
                newInvItemClients.Add(new InvItemClient
                {
                    _Item        = item.Item,
                    _Name        = item.ItemName,
                    _SalesPrice1 = item.SalesPrice,
                    _Group       = "Grp1"
                });
            }
            ;

            // Calling insert API
            var errorCode = await crudAPI.Insert(newInvItemClients);

            if (errorCode != ErrorCodes.Succes)
            {
                MessageBox.Show($"ERROR: Failed to import items {errorCode.ToString()}");
            }
            else
            {
                MessageBox.Show("Import Completed");
            }
        }