public Response CreateInvoice(SOPHeader header, SOPDetail[] detail, SOPDistribution[] distribution, SOPCommissions[] commissions, SOPTax[] tax, SopType soptype, string company) { var gpservices = new SOPTransactionClient(); Response response; response = gpservices.CreateSOPTransaction(header, detail, distribution, commissions, tax, soptype, company); gpservices.Close(); return(response); }
//public void DoWork() //{ //} /// <summary> /// Create Invoince /// </summary> /// <param name="header"></param> /// <param name="detail"></param> /// <param name="distribution"></param> /// <param name="commissions"></param> /// <param name="taxes"></param> /// <param name="company"></param> /// <returns></returns> public Response CreateSOPTransaction(SOPHeader header, List <SOPDetail> detail, List <SOPDistribution> distribution, List <SOPCommissions> commissions, List <SOPTax> taxes, SopType soptype, string company) { SOPTransactionCreate soptran = new SOPTransactionCreate(); return(soptran.TransactionCreate(header, detail, distribution, taxes, commissions, soptype, company)); }
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; } }