/// <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();
            }
        }
示例#2
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();
            }
        }
示例#4
0
        public static string NextSopDocumentNumber(string salesDocID)
        {
            GetNextDocNumbers sopTransNumber        = new GetNextDocNumbers();
            string            nextTransactionNumber = string.Empty;
            string            sConnectionString     = "";

            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<eConnect xmlns:dt=\"urn: schemas - microsoft - com:datatypes\">");
                sb.Append("<RMCustomerMasterType>");
                sb.Append("<eConnectProcessInfo>");
                sb.Append("</eConnectProcessInfo>");
                sb.Append("<taUpdateCreateCustomerRcd>");
                sb.Append("<CUSTNMBR>JEFF0002</CUSTNMBR>");
                sb.Append("<CUSTNAME>JL Lawn Care Service</CUSTNAME>");
                sb.Append("<STMTNAME>JL Lawn Care Service </STMTNAME>");
                sb.Append("<SHRTNAME>JL Lawn Care</SHRTNAME>");
                sb.Append("<ADRSCODE>PRIMARY </ADRSCODE>");
                sb.Append("<ADDRESS1>123 Main Street</ADDRESS1>");
                sb.Append("<CITY>Valley City </CITY>");
                sb.Append("<STATE>ND </STATE>");
                sb.Append("<ZIPCODE>58072 </ZIPCODE>");
                sb.Append("<COUNTRY>USA </COUNTRY>");
                sb.Append("<PHNUMBR1>55532336790000 </PHNUMBR1>");
                sb.Append("<PHNUMBR2>55551161817181 </PHNUMBR2>");
                sb.Append("<FAX>55584881000000 </FAX>");
                sb.Append("<UPSZONE>red </UPSZONE>");
                sb.Append("<SHIPMTHD>PICKUP </SHIPMTHD>");
                sb.Append("<TAXSCHID>ILLINOIS</TAXSCHID>");
                sb.Append("<PRBTADCD>PRIMARY </PRBTADCD>");
                sb.Append("<PRSTADCD>PRIMARY </PRSTADCD>");
                sb.Append("<STADDRCD>PRIMARY </STADDRCD>");
                sb.Append("<SLPRSNID>GREG E.</SLPRSNID>");
                sb.Append("<SALSTERR>TERRITORY 6</SALSTERR>");
                sb.Append("<COMMENT1>comment1</COMMENT1>");
                sb.Append("<COMMENT2>comment2</COMMENT2>");
                sb.Append("<PYMTRMID>Net 30 </PYMTRMID>");
                sb.Append("<CHEKBKID>PAYROLL </CHEKBKID>");
                sb.Append("<KPCALHST>0 </KPCALHST>");
                //sb.Append("<RMCSHACTNUMST>000-1200-00 </RMCSHACTNUMST>");
                sb.Append("<UseCustomerClass>0</UseCustomerClass>");
                sb.Append("<UpdateIfExists>1</UpdateIfExists>");
                sb.Append("</taUpdateCreateCustomerRcd>");
                sb.Append("</RMCustomerMasterType>");
                sb.Append("</eConnect>");

                sb = new StringBuilder();
                sb.Append("<eConnect xmlns:dt=\"urn: schemas - microsoft - com:datatypes\">");
                sb.Append("<RMCustomerMasterType>");
                sb.Append("<eConnectProcessInfo>");
                sb.Append("</eConnectProcessInfo>");
                sb.Append("<taPMTransactionInsert>");
                sb.Append("<BACHNUMB>1</BACHNUMB>");
                sb.Append("<VCHNUMWK>99999</VCHNUMWK>");
                sb.Append("<VENDORID>ACETRAVE0001</VENDORID>");
                sb.Append("<DOCNUMBR>99999</DOCNUMBR>");
                sb.Append("<DOCTYPE>1</DOCTYPE>");
                sb.Append("<DOCAMNT>99.99</DOCAMNT>");
                sb.Append("<DOCDATE>2020-01-01</DOCDATE>");
                sb.Append("<MSCCHAMT>0.00</MSCCHAMT>");
                sb.Append("<PRCHAMNT>99.99</PRCHAMNT>");
                sb.Append("<TAXAMNT>0.00</TAXAMNT>");
                sb.Append("<FRTAMNT>0.00</FRTAMNT>");
                sb.Append("<TRDISAMT>0.00</TRDISAMT>");
                sb.Append("<CHRGAMNT>99.99</CHRGAMNT>");
                sb.Append("<CASHAMNT>0.00</CASHAMNT>");
                sb.Append("<CHEKAMNT>0.00</CHEKAMNT>");
                sb.Append("<CRCRDAMT>0.00</CRCRDAMT>");
                sb.Append("<DISTKNAM>0.00</DISTKNAM>");

                sb.Append("</taPMTransactionInsert>");
                sb.Append("</RMCustomerMasterType>");
                sb.Append("</eConnect>");

                sConnectionString = "server=LAPTOP-G581GE4V\\SQL2016_GP2018R2;database=TWO;Integrated Security=SSPI;persist security info=False";
                eConnectMethods eConnectObject = new eConnectMethods();
                XmlDocument     xmlDoc         = new XmlDocument();
                xmlDoc.LoadXml(sb.ToString());
                bool eConnectResult;
                eConnectResult = eConnectObject.CreateEntity(sConnectionString, xmlDoc.OuterXml);
                return(nextTransactionNumber);
            }
            catch (Exception ex)
            {// If an error occurs, diplay the error information to the user
                MessageBox.Show(ex.Message);
                throw ex;
            }
            finally
            {
                sopTransNumber.Dispose();
            }
        }