Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vendor"></param>
        /// <param name="company"></param>
        /// <returns></returns>
        public Response VendorCreateUpdate(PMVendor vendor, string company)
        {
            var    response = new Response();
            string VendorXML;
            string server = ConfigKey.ReadSetting("SERVER");
            //var server = Properties.Settings.Default.SERVER.ToString();
            string CNX      = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=False;packet size=4096";
            var    eConnect = new eConnectRequest();
            taUpdateCreateVendorRcd pmVendorCreateUpdate;

            try
            {
                pmVendorCreateUpdate = SetVendorValues(vendor);
                VendorXML            = SerializeVendor(pmVendorCreateUpdate);
                response             = eConnect.CreateGPMaster(CNX, VendorXML);
                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                return(response);
            }
        }
        public Response SalesPresonCreate(RMSalesPerson salesperson, string company)
        {
            var    response = new Response();
            string SalesPersonXML;
            string server   = ConfigKey.ReadSetting("SERVER");
            string CNX      = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=False;packet size=4096";
            var    eConnect = new eConnectRequest();

            taCreateSalesperson rmSalesPerson;

            try
            {
                rmSalesPerson  = SetSalesPersonValues(salesperson);
                SalesPersonXML = SerializeSalesPerson(rmSalesPerson);
                response       = eConnect.CreateGPMaster(CNX, SalesPersonXML);

                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                return(response);
            }
        }
Esempio n. 3
0
        public Response CustomerClassCreate(RMCustomerClass customerClass, string company)
        {
            var    response = new Response();
            string CustomerCLassXML;
            string server   = ConfigKey.ReadSetting("SERVER");
            string CNX      = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=False;packet size=4096";
            var    eConnect = new eConnectRequest();
            taCreateCustomerClass rmCustomerClass;

            try
            {
                rmCustomerClass  = SetCustomerClassValues(customerClass);
                CustomerCLassXML = SerializeCustomerClass(rmCustomerClass);
                response         = eConnect.CreateGPMaster(CNX, CustomerCLassXML);

                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                return(response);
            }
        }
        public Response CustomerCreateUpdate(RMCustomer customer, RMParentID parent, List <RMParentIDChild> children, string company)
        {
            var response = new Response();

            string CustomerXML;
            string server = ConfigKey.ReadSetting("SERVER");
            //var server = Properties.Settings.Default.SERVER.ToString();
            string CNX      = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=False;packet size=4096";
            var    eConnect = new eConnectRequest();

            taUpdateCreateCustomerRcd rmCustomerCreateUpdate;
            taCreateParentID          rmparent;

            taParentIDChild_ItemsTaParentIDChild[] rmchildren;

            try
            {
                rmCustomerCreateUpdate = SetCustomerValues(customer);

                if (children.Count > 0)
                {
                    rmchildren  = SetParentChildValues(children);
                    CustomerXML = SerializeCustomerChild(rmCustomerCreateUpdate, rmchildren);
                }
                else if (children.Count == 0 && !string.IsNullOrEmpty(parent.CPRCSTNM))
                {
                    rmparent    = SetParentValues(parent);
                    CustomerXML = SerializeCustomerParent(rmCustomerCreateUpdate, rmparent);
                }
                else
                {
                    CustomerXML = SerializeCustomer(rmCustomerCreateUpdate);
                }

                //CustomerXML = SerializeCustomer(rmCustomerCreateUpdate, rmparent, rmchildren);
                response = eConnect.CreateGPMaster(CNX, CustomerXML);

                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                return(response);
            }
        }