コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="TransactionType"></param>
        /// <returns></returns>
        private string SerializeGLTransacion(GLTransactionType TransactionType)
        {
            try
            {
                eConnectType eConnect = new eConnectType();

                GLTransactionType[] tranType = { TransactionType };
                eConnect.GLTransactionType = tranType;
                MemoryStream ms = new MemoryStream();

                XmlSerializer serializer = new XmlSerializer(eConnect.GetType());
                serializer.Serialize(ms, eConnect);
                ms.Position = 0;
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(ms);

                string TransactionXML = xmldoc.OuterXml;

                return(TransactionXML);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
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();
            }
        }