Exemple #1
0
        private void btnCreateCustomerOrders_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            btnCreateCustomerOrders.Enabled = false;

            var customerQuery = new CustomerQuery(VgConnections.DestinationConnection);
            var salesOrderManager = new SalesOrderManager(VgConnections.DestinationConnection, customerQuery, _postageCalculationParameters);
            var invoiceManager = new InvoiceManager(VgConnections.SourceConnection);

            var failedCustomerOrders = 0;

            foreach (var item in _transferItems)
            {
                if (customerQuery.CustomerExists(item.CustomerNo))
                {
                    item.OrderNoInDestinationClient = salesOrderManager.CreateSalesOrderFromInvoice(item);

                    if (string.IsNullOrEmpty(item.OrderNoInDestinationClient))
                        failedCustomerOrders++;
                    else
                        invoiceManager.MarkInvoiceAsTransferred(item.InvoiceNo);
                }
                else
                {
                    failedCustomerOrders++;
                    lstLog.Items.Add(string.Format("Kunne ikke opprette ordre før fakura {0}. Kunden ({1}) ikke funnet'", item.InvoiceNo, item.CustomerNo));
                }
            }

            lstLog.Items.Add(string.Format("{0} av {1} ordre opprettet", (_transferItems.Count - failedCustomerOrders), _transferItems.Count));

            DisplayTransferItems(_transferItems);
            Cursor = Cursors.Default;
        }
 public SalesOrderManager(GlobalServerComponent vgConnection, CustomerQuery customerQuery, PostageCalculationParameters postageCalculationParameters)
 {
     _vgConnection  = vgConnection;
     _customerQuery = customerQuery;
     _postageCalculationParameters = postageCalculationParameters;
 }
Exemple #3
0
 public SalesOrderManager(GlobalServerComponent vgConnection, CustomerQuery customerQuery, PostageCalculationParameters postageCalculationParameters)
 {
     _vgConnection = vgConnection;
     _customerQuery = customerQuery;
     _postageCalculationParameters = postageCalculationParameters;
 }