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

            crudAPI.RunInTransaction = false;

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

            // Creating Insert List
            var newDebtorClients = new List <DebtorClient>();

            foreach (var customer in customers)
            {
                // Parsing Account Number
                var accountNumber = (int.Parse(customer.AccountNumber) + 20000).ToString();

                // TODO: Add the customer to the newDebtorClients List
            }
            ;

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

            crudAPI.RunInTransaction = false;

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

            // Creating Insert List
            var newDebtorClients = new List <DebtorClient>();

            foreach (var customer in customers)
            {
                // Parsing Account Number
                var accountNumber = (int.Parse(customer.AccountNumber) + 20000).ToString();

                newDebtorClients.Add(new DebtorClient
                {
                    _Account  = accountNumber.ToString(),
                    _Name     = customer.AccountName,
                    _Address1 = customer.Address1,
                    _Address2 = customer.Address2,
                    _ZipCode  = customer.ZIP,
                    _Phone    = customer.Telephone
                });
            }
            ;

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

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