public static string eConnectGetNextSOPReturnNumbe(string DOCID, string con)
        {
            string res = "";

            GetNextDocNumbers NextDocNumberObject = new GetNextDocNumbers();

            try
            {
                res = NextDocNumberObject.GetNextSOPNumber(GetNextDocNumbers.IncrementDecrement.Increment, DOCID, GetNextDocNumbers.SopType.SOPReturn, con);
            }
            catch (Exception ex)
            {
                IEvent e = new ErrorEvent("", "", ex.Message);
                e.Publish();
                res = ex.Message;
            }
            return(res);
        }
示例#2
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;
            }
        }