示例#1
0
 public DataImportor(ICustomerRepo iCustomerRepo, IGSTRepo iGSTRepo,
     IInvoiceRepo iInvoiceRepo, IOrderDetailRepo iOrderDetailRepo, 
     ISalesmanRepo iSalesmanRepo,IPaymentRepo iPaymentRepo,IPaymentDetailRepo iPaymentDetailRepo)
 {
     custSvr = new CustomerSvc(iCustomerRepo);
     gstSvr = new GSTSvc(iGSTRepo);
     invSvr = new InvoiceSvc(iInvoiceRepo);
     orderDetailSvr = new OrderDetailSvc(iOrderDetailRepo);
     salesmanSvc = new SalesmanSvc(iSalesmanRepo);
     paymentSvc = new PaymentSvc(iPaymentRepo);
     paymentDetailSvc = new PaymentDetailSvc(iPaymentDetailRepo);
 }
        public void GetCustomers()
        {
            // set up the parms
            List <ctDynamicsSL.queue.nameValuePairs> customerParms = new List <ctDynamicsSL.queue.nameValuePairs>();

            // we are going to be retrieving CUSTOMER records
            customerParms.Add(new ctDynamicsSL.queue.nameValuePairs
            {
                name  = "ITEMTYPE",
                value = "CUSTOMER"
            });

            // we are going to be retrieving status of UPDATE.  We coould also be dealing with DELETE, ADD, etc.
            customerParms.Add(new ctDynamicsSL.queue.nameValuePairs
            {
                name  = "STATUS",
                value = "UPDATE"
            });

            // all queue item records will be set to RETRIEVED so that they wont be returned again (until the source record is updated again)
            customerParms.Add(new ctDynamicsSL.queue.nameValuePairs
            {
                name  = "CHANGESTATUS",
                value = "RETRIEVED"
            });

            try
            {
                // retrieve all the queue records for the parameters
                var customerQueueItems = QueueSvc.getDSLXMLs(0, 0, customerParms.ToArray());

                // parse through each record returned
                foreach (var queueItem in customerQueueItems)
                {
                    try
                    {
                        // retrieve the customer in the queue
                        var customer = CustomerSvc.getCustomerByExactID(queueItem.itemID);
                    }
                    catch (Exception ex)
                    {
                        // handle record exceptions
                    }
                }
            }
            catch (Exception ex)
            {
                // handle overall processing exceptions
            }
        }
示例#3
0
        public CustResponse CreateNewCustomer()
        {
            var cust = CustomerSvc.CreateCustomer(new CreateCustReq()
            {
                contacts      = _contacts,
                customerNotes = _cutomerNotes,
                customerTags  = new List <object>()
                {
                },
                billToAddresses = _billtoaddress,
                accountManager  = new EDI_soapAPI.Entities.AccountManager()
                {
                },
                customerLocations = _customerLocations,
                ediRules          = new List <EdiRule>(),
                companyName       = compName
            });

            return(cust);
        }
 public CustomerController()
 {
     _svc = new CustomerSvc();
 }
 public QuotationController(ICustomerRepo iCustomerRepo)
 {
     cHelper = new ControllerHelper(this, iCustomerRepo);
     customerSvc = new CustomerSvc(iCustomerRepo); 
 }
示例#6
0
        public void UpdateCustomer()
        {
            _billtoaddress[0].id     = _cust.body.billToAddresses[0].id;
            _customerLocations[0].id = _cust.body.customerLocations[0].id;
            _contacts[0].id          = _cust.body.contacts[0].id;
            var cust = CustomerSvc.UpdateCustomer(_cust.body.id, new UpdCustomer()
            {
                id            = _cust.body.id,
                contacts      = _contacts,
                customerNotes = _cutomerNotes,
                customerTags  = new List <object>()
                {
                },
                billToAddresses = _billtoaddress,
                //accountManager = new EDI_soapAPI.Entities.AccountManager() { },
                customerLocations = _customerLocations,
                companyName       = compName,
                //ediRules = new List<EdiRule>()
                ediRules = new List <EdiRule>()
                {
                    new EdiRule()
                    {
                        @override = false,
                        enabled   = true,
                        active    = true,
                        location  = new Location()
                        {
                            id   = "2124049",
                            name = "WareHouse"
                        },
                        equipment = new EDI_soapAPI.Entities.Equipment()
                        {
                            id   = "146",
                            name = "Flatbed Stretch"
                        },
                        maxPerDay = "2",
                        commit    = "1",

                        originCityStateZip      = "SCHENECTADY, NY, 12345",
                        originCity              = "SCHENECTADY",
                        originState             = "NY",
                        originZipCode           = "12345",
                        destCityStateZip        = "FORT STORY, VA, 23459",
                        destinationCity         = "FORT STORY",
                        destinationState        = "VA",
                        destinationZipCode      = "23459",
                        destinationCityStateZip = "FORT STORY, VA, 23459",
                        originCountry           = "United States of America",
                        destinationCountry      = "United States of America",
                        ediRuleCommitTypes      = new List <EdiRuleCommitType>()
                        {
                            new EdiRuleCommitType()
                            {
                                commitType = new CommitType()
                                {
                                    id   = "1",
                                    name = "Daily"
                                }
                            }
                        }
                    }
                },
                outboundMessages = true,
                shipsFrequently  = false,
                ediCustomer      = false,
                firstAddress     = new FirstAddress()
                {
                    id                  = 1,
                    companyName         = compName,
                    address1            = "134 main st",
                    zipCode             = "07047",
                    countryName         = "United States of America",
                    stateCode           = "NJ",
                    city                = "WOODCLIFF",
                    contactFirstName    = fn,
                    contactLastName     = ln,
                    contactPhone        = cphno,
                    contactEmail        = email,
                    isIndividualEmail   = false,
                    invoiceStyle        = "Transactional",
                    invoiceFormat       = "PDF",
                    invoiceAfter        = "Delivery",
                    invoiceCurrency     = "USD",
                    invoiceBatchBilling = false,
                    frequencyType       = null,
                    dateOfInvoice       = null,
                    deliveryMethod      = new DeliveryMethod()
                    {
                        id   = "1",
                        name = "Do Not Send Invoice"
                    },
                    dnb                    = null,
                    yearEstablished        = null,
                    creditAmount           = 9000000,
                    availableCredit        = 9000000,
                    unbilledCredit         = 0,
                    creditOverride         = false,
                    previousCreditOverride = false,
                    creditOverrideDate     = 1580954400077,
                    active                 = true,
                    paymentTerms           = new PaymentTerms()
                    {
                        id   = "1",
                        name = "Pre-Paid"
                    },
                    countryCode             = "USA",
                    portal                  = null,
                    auditMarginBelowPct     = 0,
                    auditMarginAbovePct     = 70,
                    auditMarginAboveAmt     = 1500,
                    verifyCostBeforeInvoice = false,
                    invoiceRequiredFields   = new List <object>(),
                    invoiceDocuments        = new List <object>(),
                    bolSignature            = null,
                    podSignature            = null,
                    legacyAxAccountNumber   = "",
                    axAccountNumber         = null,
                    legacyBillToId          = null,
                    increasedCreditAmount   = 0,
                    cityStateZipSearch      = "WOODCLIFF,NJ,07047",
                    isPrevious              = false,
                    invoiceSettings         = null,
                    availableCreditOld      = 9000000
                },
                customerTagsData = new List <object>()
            });
        }
 public CustomerController(ICustomerRepo iCustomerRepo)
 {
     svc = new CustomerSvc(iCustomerRepo);
 }
        public void GetAddresses()
        {
            // set up the parms
            List <ctDynamicsSL.queue.nameValuePairs> addressParms = new List <ctDynamicsSL.queue.nameValuePairs>();

            // we are going to be retrieving SOADDRESS (Customer Shipto Address) records
            addressParms.Add(new ctDynamicsSL.queue.nameValuePairs
            {
                name  = "ITEMTYPE",
                value = "SOADDRESS"
            });
            // we are going to be retrieving status of UPDATE.  We coould also be dealing with DELETE, ADD, etc.
            addressParms.Add(new ctDynamicsSL.queue.nameValuePairs
            {
                name  = "STATUS",
                value = "UPDATE"
            });
            // all queue item records will be set to RETRIEVED so that they wont be returned again (until the source record is updated again)
            addressParms.Add(new ctDynamicsSL.queue.nameValuePairs
            {
                name  = "CHANGESTATUS",
                value = "RETRIEVED"
            });

            try
            {
                // retrieve all the queue records for the parameters
                var addressQueueItems = QueueSvc.getDSLXMLs(0, 0, addressParms.ToArray());

                // parse through each record returned
                foreach (var queueItem in addressQueueItems)
                {
                    try
                    {
                        // in this case, there are 2 fields for the key: CustID + AddressID (pipe | delimited)
                        var addrKeyArray = queueItem.itemID.Split('|');

                        // if there arent 2 fields in the itemID, then something is wrong and throw an exception
                        if (addrKeyArray.Length != 2)
                        {
                            throw new Exception("Error, not a valid key for address (" + queueItem.itemID + ")");
                        }

                        // retrieve the address by the keys stored in the queueItem.itemID
                        var address = CustomerSvc.getSOAddressByExactID(addrKeyArray[0], addrKeyArray[1]);

                        // NOTE:  before you do anything with your address (say saving it to another system) it is a good idea to make sure it
                        // exists in that other system.  so, it is always a good idea to retrieve the customer from SL first before acting
                        // on the address.
                    }
                    catch (Exception ex)
                    {
                        // handle record exception
                    }
                }
            }
            catch (Exception ex)
            {
                // handle overall processing exceptions
            }
        }
 public InvoiceController(ICustomerRepo iCustomerRepo, ISalesmanRepo iSalesmanRepo)
 {
     cHelper = new ControllerHelper(this, iCustomerRepo);
     customerSvc = new CustomerSvc(iCustomerRepo);
     salesmanSvc = new SalesmanSvc(iSalesmanRepo);
 }
 public CustomerController(ICustomerRepo iCustomerRepo)
 {
     svc = new CustomerSvc(iCustomerRepo);
     cHelper = new ControllerHelper(this, iCustomerRepo);
 }