public Response VoidTransaction(RMVoidTransaction rmvoidtran, string company)
        {
            Response response;
            string   server         = ConfigKey.ReadSetting("SERVER");
            string   transactionXML = string.Empty;
            string   CNX            = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=False;packet size=4096";
            var      eConnect       = new eConnectRequest();
            RMVoidTransactionType rmvoidtransaction = new RMVoidTransactionType();

            try
            {
                rmvoidtransaction.taRMVoidTransaction = SetVoidValues(rmvoidtran);
                transactionXML = SerializeRMVoid(rmvoidtransaction);
                response       = eConnect.CreateGPTransaction(CNX, transactionXML);
                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                return(response);
                //throw;
            }
        }
        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);
            }
        }
示例#3
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);
            }
        }
示例#4
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);
            }
        }
        /// <summary>
        /// Create RM transaction
        /// <param name="transaction">Header of RM transaction</param>
        /// <param name="Distribution">Distribution Account of RM Transaction</param>
        /// <param name="Taxes">Taxes of RM transaction</param>
        /// <param name="company">COMPANY SHORT NAME</param>
        /// <returns>Response Class</returns>
        /// </summary>
        // Log4NetMR.classClsRegistrarLog logW = new Log4NetMR.classClsRegistrarLog();
        public Response TransactionCreate(RMTransactionHeader transaction, RMTransactionDist[] Distribution, RMDocumentTaxes[] Taxes, string company)
        {
            Response          response;
            string            server         = ConfigKey.ReadSetting("SERVER");
            string            transactionXML = string.Empty;
            string            CNX            = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=False;packet size=4096";
            var               eConnect       = new eConnectRequest();
            RMTransactionType rmTranType     = new RMTransactionType();

            var getnext = new GetNextDocNumbers();

            getnext.RequireServiceProxy = false;

            try
            {
                string DOCNUMBR = string.Empty;

                if (string.IsNullOrEmpty(transaction.DOCNUMBR))
                {
                    DOCNUMBR = getnext.GetNextRMNumber(IncrementDecrement.Increment, RMPaymentType.RMCreditMemo, CNX);
                }
                else
                {
                    DOCNUMBR = transaction.DOCNUMBR;
                }

                rmTranType.taRMTransaction = SetTransactionValues(transaction, DOCNUMBR);

                if (transaction.CREATEDIST == 0)
                {
                    rmTranType.taRMDistribution_Items = SetDistributionValues(Distribution, DOCNUMBR);
                }
                if (transaction.CreateTaxes == 1)
                {
                    rmTranType.taRMTransactionTaxInsert_Items = SetTaxValues(Taxes, DOCNUMBR);
                }

                transactionXML = SerializeRMTransaction(rmTranType);

                response = eConnect.CreateGPTransaction(CNX, transactionXML);
                return(response);
            }
            catch (Exception ex)
            {
                //logW.LogExeption("Econnect", 2, ex);
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                return(response);
            }
            finally
            {
                getnext.Dispose();
            }
        }
示例#6
0
        public Response TransactionCreate(GLTrasactionHeader Header, GLTransactionDetail[] Detail, string company)
        {
            Response response;
            string   transactionXML = string.Empty;
            //var server = Properties.Settings.Default.SERVER.ToString();
            string server = ConfigKey.ReadSetting("SERVER");
            string CNX    = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=True;packet size=4096";

            //string CNX = "data source=stsv-qa15;initial catalog=ELSIN;integrated security=SSPI;persist security info=True;packet size=4096";
            var eConnect = new eConnectRequest();
            GLTransactionType GLTranType = new GLTransactionType();
            var getnext = new GetNextDocNumbers();

            //getnext.RequireServiceProxy = false;
            try
            {
                int jrnEntry = Convert.ToInt32(getnext.GetNextGLJournalEntryNumber(IncrementDecrement.Increment, CNX));

                GLTranType.taGLTransactionHeaderInsert     = SetTransactionValues(Header, jrnEntry);
                GLTranType.taGLTransactionLineInsert_Items = SetDetailValues(Detail, jrnEntry);
                transactionXML = SerializeGLTransacion(GLTranType);

                response = eConnect.CreateGPTransaction(CNX, transactionXML);

                return(response);
            }
            catch (eConnectException ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                if (ex.InnerException != null)
                {
                    response.STACK += ex.InnerException.Message;
                }
                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                if (ex.InnerException != null)
                {
                    response.STACK += ex.InnerException.Message;
                }
                return(response);
            }
            finally
            {
                //getnext.Dispose();
            }
        }
        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);
            }
        }
示例#8
0
        /// <summary>
        /// Create PM transaction
        /// </summary>
        /// <param name="transaction">Header of PM transaction</param>
        /// <param name="Distribution">Distribution Account of PM Transaction</param>
        /// <param name="Taxes">Taxes of PM transaction</param>
        /// <param name="company">COMPANY SHORT NAME</param>
        /// <returns>Response Class</returns>
        public Response TransactionCreate(PMTransactionHeader transaction, PMTransactionDist[] Distribution, PMTransactionTax[] Taxes, string company)
        {
            Response response;
            string   server         = ConfigKey.ReadSetting("SERVER");
            string   transactionXML = string.Empty;
            //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();
            PMTransactionType pmTranType = new PMTransactionType();

            var getnext = new GetNextDocNumbers();

            getnext.RequireServiceProxy = false;

            try
            {
                string VCHRNUMBER = getnext.GetPMNextVoucherNumber(IncrementDecrement.Increment, CNX);
                pmTranType.taPMTransactionInsert = SetTransactionValues(transaction, VCHRNUMBER);

                if (transaction.CREATEDIST == 0)
                {
                    pmTranType.taPMDistribution_Items = SetDistributionValues(Distribution, VCHRNUMBER);
                }
                if (transaction.CreateTaxes == 1)
                {
                    pmTranType.taPMTransactionTaxInsert_Items = SetTaxValues(Taxes, VCHRNUMBER);
                }

                transactionXML = SerializePMTransaction(pmTranType);

                response = eConnect.CreateGPTransaction(CNX, transactionXML);
                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace; //+ " Inner Exception: " + ex.InnerException.Message;
                return(response);
            }
            finally
            {
                getnext.Dispose();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="Cashreceipt"></param>
        /// <param name="Distribution"></param>
        /// <param name="company"></param>
        /// <returns></returns>
        public Response CashReceiptCreate(RMCashReceipt Cashreceipt, RMTransactionDist[] Distribution, string company)
        {
            Response           response;
            string             server            = ConfigKey.ReadSetting("SERVER");
            string             transactionXML    = string.Empty;
            string             CNX               = "data source=" + server + ";initial catalog=" + company + ";integrated security=SSPI;persist security info=False;packet size=4096";
            var                eConnect          = new eConnectRequest();
            RMCashReceiptsType rmcashreceipttype = new RMCashReceiptsType();

            var getnext = new GetNextDocNumbers();

            getnext.RequireServiceProxy = false;

            try
            {
                string DOCNUMBR = string.Empty;
                DOCNUMBR = getnext.GetNextRMNumber(IncrementDecrement.Increment, RMPaymentType.RMPayments, CNX);

                rmcashreceipttype.taRMCashReceiptInsert = SetReceiptValues(Cashreceipt, DOCNUMBR);

                if (Cashreceipt.CREATEDIST == 0)
                {
                    rmcashreceipttype.taRMDistribution_Items = SetPaymentDistributionValues(Distribution, DOCNUMBR);
                }

                transactionXML    = SerializeRMCashReceipts(rmcashreceipttype);
                response          = eConnect.CreateGPTransaction(CNX, transactionXML);
                response.DOCUMENT = DOCNUMBR.Trim();
                return(response);
            }
            catch (Exception ex)
            {
                response         = new Response();
                response.SUCCESS = false;
                response.MESSAGE = ex.Message;
                response.STACK   = ex.StackTrace;
                return(response);
            }
            finally
            {
                getnext.Dispose();
            }
        }
示例#10
0
        public Response TransactionCreate(SOPHeader header, List <SOPDetail> detail, List <SOPDistribution> distribution, List <SOPTax> taxes, List <SOPCommissions> commissions, SopType soptype, string company)
        {
            Response response;
            string   server         = ConfigKey.ReadSetting("SERVER");
            string   transactionXML = string.Empty;
            //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();

            SOPTransactionType sopTranType = new SOPTransactionType();
            var getnext = new GetNextDocNumbers();

            getnext.RequireServiceProxy = false;
            string INVOICENUMBER;

            try
            {
                if (header.SOPNUMBE == string.Empty)
                {
                    INVOICENUMBER = getnext.GetNextSOPNumber(IncrementDecrement.Increment, header.DOCID, soptype, CNX);
                }
                else
                {
                    INVOICENUMBER = header.SOPNUMBE;
                }


                sopTranType.taSopHdrIvcInsert           = SetHeaderValues(header, INVOICENUMBER);
                sopTranType.taSopLineIvcInsert_Items    = SetDetailValues(detail, INVOICENUMBER);
                sopTranType.taSopDistribution_Items     = SetDistributionValues(distribution, INVOICENUMBER);
                sopTranType.taSopLineIvcTaxInsert_Items = SetTaxValues(taxes, INVOICENUMBER);
                sopTranType.taSopCommissions_Items      = SetCommissionValues(commissions, INVOICENUMBER);

                transactionXML = SerializeSOPTransaction(sopTranType);
                response       = eConnect.CreateGPTransaction(CNX, transactionXML);

                return(response);
            }
            catch (Exception)
            {
                throw;
            }
        }