//[SwaggerResponse(HttpStatusCode.OK, Type = typeof(LeaveVoucher))]
        public HttpResponseMessage AddPZForJson(string token, string jsonStr)
        {
            ReturnMessage msg = new ReturnMessage();

            vouMag = (VoucherManager)HttpContext.Current.Application.Get(token);
            if (vouMag == null)
            {
                msg.Success = false;
                msg.Msg     = "参数token无效或已过期";
                msg.Code    = 500;
            }
            else
            {
                GLAccVouchManager glMag = new GLAccVouchManager(vouMag.UFDataConnstringForNet);
                GL_accvouch       glAcc = (GL_accvouch)JsonConvert.DeserializeObject(jsonStr, typeof(GL_accvouch));
                string            xml   = glMag.getVoucherXml(vouMag.AccId, glAcc);
                msg = glMag.AddForGL(vouMag, xml);
            }

            HttpContext.Current.Application.Remove(vouMag.GetGUID);
            string str = msg.ToJson();

            return(new HttpResponseMessage {
                Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
            });
        }
Exemple #2
0
        public HttpResponseMessage GetToken(string accid = "", string username = "", string password = "")
        {
            VoucherManager vouMag     = new VoucherManager();
            String         sSubId     = "AS";
            String         sYear      = DateTime.Today.Year.ToString();
            String         sServer    = "localhost";
            String         sUserID    = username;
            String         sPassword  = password;
            String         sDate      = DateTime.Today.ToString("yyyy-MM-dd");
            String         sSerial    = "";
            string         DBSource   = "(default)";
            ReturnMessage  rtnMessage = vouMag.LoginU8(sSubId, DBSource + "@" + accid, sYear, sUserID, sPassword, sDate, sServer, sSerial);

            if (rtnMessage.Success)
            {
                //string sercert =ConfigurationManager.AppSettings["Secret"].ToString();
                //JWTHelper.secret = sercert;
                // var payload = new Dictionary<string, object>
                //{
                //    {"ufconn",vouMag.UFDataConnstringForNet}
                //};
                // vouMag.GetGUID = JWTHelper.SetJwtEncode(payload);
                vouMag.AccId   = accid;
                vouMag.GetGUID = Guid.NewGuid().ToString();
                HttpContext.Current.Application.Add(vouMag.GetGUID, vouMag);
                rtnMessage.Data = vouMag.GetGUID.ToString();
                rtnMessage.Code = 200;
            }
            string msg = rtnMessage.ToJson();

            return(new HttpResponseMessage {
                Content = new StringContent(msg, Encoding.GetEncoding("UTF-8"), "application/json")
            });
        }
Exemple #3
0
 private static void RedeemVoucher(Session Session, ClientMessage Message)
 {
     using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
     {
         Session.SendData(VoucherManager.TryRedeemVoucher(MySqlClient, Session, Message.PopString()) ?
                          CatalogRedeemOkComposer.Compose() : CatalogRedeemErrorComposer.Compose(0));
     }
 }
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        VoucherManager VM = new VoucherManager();

        UM   = new UserManager();
        list = VM.GetList();
        list.Reverse();
        list       = list.ToList();
        Page.Title = "Voucher";
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserManager    UM    = new UserManager();
        string         phone = Request["phone"];
        VoucherManager r     = new VoucherManager();

        user   = UM.GetUserByUserPhone(phone);
        userid = user.UserId;
        result = r.GetListVoucherByUserId(userid);
    }
Exemple #6
0
        private void btnMinInvioceNo_Click(object sender, EventArgs e)
        {
            VoucherManager VM = new VoucherManager();

            txtCashPaymentCode.Text = VM.GetMinVoucherNo("CP", MainForm.FYear);
            if (!string.IsNullOrEmpty(txtCashPaymentCode.Text))
            {
                LoadVoucher(VoucherMasterId);
                btnNextInvioceNo.Enabled = true;
                btnPrevInvioceNo.Enabled = false;
            }
        }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        VoucherManager um   = new VoucherManager();
        VouchersTBx    user = um.GetvoucherByVoucherId(Convert.ToInt32(Request["id"]));

        ok = JsonConvert.SerializeObject(user, Formatting.Indented,
                                         new JsonSerializerSettings
        {
            PreserveReferencesHandling = PreserveReferencesHandling.Objects
        });
        return;
    }
Exemple #8
0
        public static IVoucherManager GetVoucherManager()
        {
            if (RecordRepository != null && ProjectRepository != null)
            {
                VoucherManager voucherManager = new VoucherManager(RecordRepository);
                voucherManager.ManagerEvent += MessageService.Instance.ManagerEventHandler;
                //ledgerManager.LedgerEvent += LogService.Instance.ManagerEventHandler;
                return(voucherManager);
            }

            throw new ArgumentNullException("message");
        }
Exemple #9
0
        public CatalogManager()
        {
            this._marketplace     = new MarketplaceManager();
            this._petRaceManager  = new PetRaceManager();
            this._voucherManager  = new VoucherManager();
            this._clothingManager = new ClothingManager();

            this._itemOffers = new Dictionary <int, int>();
            this._pages      = new Dictionary <int, CatalogPage>();
            this._botPresets = new Dictionary <int, CatalogBot>();
            this._items      = new Dictionary <int, Dictionary <int, CatalogItem> >();
            this._deals      = new Dictionary <int, Dictionary <int, CatalogDeal> >();
        }
Exemple #10
0
        public CatalogManager()
        {
            this._marketplace    = new MarketplaceManager();
            this._petRaceManager = new PetRaceManager();

            this._voucherManager = new VoucherManager();
            this._voucherManager.Init();

            this._pages      = new Dictionary <int, CatalogPage>();
            this._botPresets = new Dictionary <int, CatalogBot>();
            this._items      = new Dictionary <int, Dictionary <int, CatalogItem> >();
            this._promotions = new Dictionary <int, CatalogPromotion>();
            this._itemsPage  = new Dictionary <int, int>();
        }
Exemple #11
0
 public CatalogManager()
 {
     _marketplace    = new MarketplaceManager();
     _petRaceManager = new PetRaceManager();
     _voucherManager = new VoucherManager();
     _voucherManager.Init();
     _clothingManager = new ClothingManager();
     _clothingManager.Init();
     _itemOffers = new Dictionary <int, int>();
     _pages      = new Dictionary <int, CatalogPage>();
     _botPresets = new Dictionary <int, CatalogBot>();
     _items      = new Dictionary <int, Dictionary <int, CatalogItem> >();
     _deals      = new Dictionary <int, CatalogDeal>();
     _promotions = new Dictionary <int, CatalogPromotion>();
 }
        public CatalogManager()
        {
            _marketplace        = new MarketplaceManager();
            _petRaceManager     = new PetRaceManager();
            _voucherManager     = new VoucherManager();
            _clothingManager    = new ClothingManager();
            _predesignedManager = new PredesignedRoomsManager();
            _predesignedManager.Initialize();

            _itemOffers       = new Dictionary <int, int>();
            _pages            = new Dictionary <int, CatalogPage>();
            _botPresets       = new Dictionary <int, CatalogBot>();
            _items            = new Dictionary <int, Dictionary <int, CatalogItem> >();
            _deals            = new Dictionary <int, Dictionary <int, CatalogDeal> >();
            _predesignedItems = new Dictionary <int, PredesignedContent>();
            _recyclerLevels   = new List <int>();
        }
        public CatalogManager()
        {
            this._marketplace        = new MarketplaceManager();
            this._petRaceManager     = new PetRaceManager();
            this._voucherManager     = new VoucherManager();
            this._clothingManager    = new ClothingManager();
            this._predesignedManager = new PredesignedRoomsManager();
            this._predesignedManager.Initialize();

            this._itemOffers       = new Dictionary <int, int>();
            this._pages            = new Dictionary <int, CatalogPage>();
            this._botPresets       = new Dictionary <int, CatalogBot>();
            this._items            = new Dictionary <int, Dictionary <int, CatalogItem> >();
            this._deals            = new Dictionary <int, Dictionary <int, CatalogDeal> >();
            this._predesignedItems = new Dictionary <int, PredesignedContent>();
            this._televisions      = new Dictionary <int, TelevisionItem>();
        }
Exemple #14
0
        private void loadButton_Click(object sender, EventArgs e)
        {
            if (chequeStartNoTextBox.Text == "")
            {
                MessageBox.Show("Please Enter Cheque Start Number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                chequeStartNoTextBox.Focus();
                return;
            }
            if (chequeEndNoTextBox.Text == "")
            {
                MessageBox.Show("You Must Enter Cheque Ending Number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                chequeEndNoTextBox.Focus();
                return;
            }
            UInt64 L = Convert.ToUInt64(chequeEndNoTextBox.Text);
            UInt64 F = Convert.ToUInt64(chequeStartNoTextBox.Text);

            if ((L - (F - 1)) == 25 || (L - (F - 1)) == 50 || (L - (F - 1)) >= 100)
            {
                int i = 0;

                for (UInt64 k = Convert.ToUInt64(chequeStartNoTextBox.Text); k <= Convert.ToUInt64(chequeEndNoTextBox.Text); k++)
                {
                    VoucherManager aEmpManager = new VoucherManager();

                    Voucher aCheque = new Voucher
                    {
                        //BankName = txtLBankNameCombo.Text,
                        //AccountNo = cmbCAccountNo.Text,
                        //CheequeNumber = k
                    };

                    i = aEmpManager.SaveCheque(aCheque);
                }
                MessageBox.Show("Voucher Number Successfully Loaded");
                // Reset();
                loadButton.Enabled = false;
            }
            else
            {
                MessageBox.Show("Checque Book is Not Conventional in Range,Please Select a Conventional Range such as 25,50 or 100");
            }
        }
Exemple #15
0
 private void btnViewRepot_Click(object sender, EventArgs e)
 {
     try
     {
         VoucherManager v        = new VoucherManager();
         ReportDocument document = new ReportDocument();
         string         path     = Application.StartupPath + "/rpt/Accounts/rptVoucher.rpt";
         document.Load(path);
         DataTable dtReport = new DataTable();
         dtReport = v.GetReportCashRecipt("CR", Convert.ToDateTime(dtpFromDate.Text), Convert.ToDateTime(dtpToDate.Text), txtVoucherFromCode.Text, txtVoucherToCode.Text);
         document.SetDataSource(dtReport);
         crystalRptCashRecipt.ReportSource = document;
         crystalRptCashRecipt.Refresh();
         //document.PrintToPrinter(1, true, 0, 0);
     }
     catch (Exception ex)
     {
     }
 }
Exemple #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.AppendHeader("Access-Control-Allow-Origin", "*");
        string vouchercode = Request["vouchercode"];

        string userid = Request["userid"]; // kiem tra voucher code phai di kem voi userid do, vi moi voucher thuoc ve 1 user duy nhat.


        VoucherManager vm = new VoucherManager();
        VouchersTBx    v  = vm.CheckVoucherCode(vouchercode, userid);

        if (v != null)
        {
            Response.Write(v.VoucherDefaultCost); // voucher chua xai!
        }
        else
        {
            Response.Write("1"); // voucher vi pham error
        }
    }
Exemple #17
0
        public HttpResponseMessage AuditErrand(string token, string ccode)
        {
            string        errMsg = "";
            ReturnMessage msg    = new ReturnMessage();

            vouMag = (VoucherManager)HttpContext.Current.Application.Get(token);
            if (vouMag == null)
            {
                msg.Success = false;
                msg.Msg     = "参数token无效或已过期";
                msg.Code    = 500;
            }
            else
            {
                ErrandManager errandMag = new ErrandManager(vouMag.UFDataConnstringForNet);
                int           i         = errandMag.auditErrand(ccode, vouMag.cUserName, vouMag.cUserID, ref errMsg);
                if (i >= 2)
                {
                    msg.Success = true;
                    msg.Code    = 200;
                    dynamic c = new { code = ccode };
                    msg.Data = JsonConvert.SerializeObject(c);
                    msg.Msg  = "审核成功";
                }
                else
                {
                    msg.Success = false;
                    msg.Code    = 500;
                    msg.Msg     = "审核失败:" + errMsg;
                }
            }

            HttpContext.Current.Application.Remove(vouMag.GetGUID);
            string str = msg.ToJson();

            return(new HttpResponseMessage {
                Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
            });
        }
Exemple #18
0
 private void btnPrevInvioceNo_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtCashPaymentCode.Text))
     {
         VoucherManager VM            = new VoucherManager();
         string         LastInvioceNo = VM.GetMinVoucherNo("CP", MainForm.FYear);
         txtCashPaymentCode.Text = VM.GetPrevVoucherNo(txtCashPaymentCode.Text);
         VoucherMasterId         = VM.GetVoucherMasterIdByCode(txtCashPaymentCode.Text, MainForm.FYear);
         if (VoucherMasterId > 0)
         {
             LoadVoucher(VoucherMasterId);
             if (LastInvioceNo == txtCashPaymentCode.Text)
             {
                 btnPrevInvioceNo.Enabled = false;
             }
             else
             {
                 btnNextInvioceNo.Enabled = true;
             }
         }
     }
 }
        //[SwaggerResponse(HttpStatusCode.OK, Type = typeof(LeaveVoucher))]
        public HttpResponseMessage AddPO(string token, string jsonStr)
        {
            ReturnMessage msg = new ReturnMessage();

            vouMag = (VoucherManager)HttpContext.Current.Application.Get(token);
            if (vouMag == null)
            {
                msg.Success = false;
                msg.Msg     = "参数token无效或已过期";
                msg.Code    = 500;
            }
            else
            {
                PurchaseOrderManager poMag = new PurchaseOrderManager(vouMag);
                PurchaseOrder        po    = new PurchaseOrder();
                string mes   = "";
                bool   reult = poMag.AddPO(po, ref mes);
                if (reult)
                {
                    msg.Success = true;
                    msg.Msg     = "成功";
                    msg.Code    = 200;
                }
                else
                {
                    msg.Success = false;
                    msg.Msg     = mes;
                    msg.Code    = 500;
                }
            }

            HttpContext.Current.Application.Remove(vouMag.GetGUID);
            string str = msg.ToJson();

            return(new HttpResponseMessage {
                Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
            });
        }
Exemple #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int            id = Convert.ToInt32(Request["id"]);
         VoucherManager cm = new VoucherManager();
         delete = cm.GetByID(id);
         delete.VoucherStatus = -1;
         cm.Save();
         Response.Write(JsonConvert.SerializeObject(new
         {
             success = 1
         }));
     }
     catch (Exception ex)
     {
         Response.Write(JsonConvert.SerializeObject(new
         {
             success = -1,
             error   = ex
         }));
     }
 }
        //[SwaggerResponse(HttpStatusCode.OK, Type = typeof(LeaveVoucher))]
        public HttpResponseMessage AddPZForXML(string token, string xmlDoc)
        {
            ReturnMessage msg = new ReturnMessage();

            vouMag = (VoucherManager)HttpContext.Current.Application.Get(token);
            if (vouMag == null)
            {
                msg.Success = false;
                msg.Msg     = "参数token无效或已过期";
                msg.Code    = 500;
            }
            else
            {
                GLAccVouchManager glMag = new GLAccVouchManager(vouMag.UFDataConnstringForNet);
                msg = glMag.AddForGL(vouMag, xmlDoc);
            }

            HttpContext.Current.Application.Remove(vouMag.GetGUID);
            string str = msg.ToJson();

            return(new HttpResponseMessage {
                Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
            });
        }
Exemple #22
0
        public ReturnMessage AddForGL(VoucherManager voucher, string DataStr)
        {
            XmlDocument   dataDoc = new XmlDocument();
            ReturnMessage msg     = new ReturnMessage();

            try
            {
                dataDoc.LoadXml(DataStr);
                XmlElement dataXml = dataDoc.DocumentElement;
                string     year    = dataXml.SelectSingleNode("voucher/voucher_head/fiscal_year").InnerXml;
                string     csign   = dataXml.SelectSingleNode("voucher/voucher_head/voucher_type").InnerXml;
                string     peroid  = dataXml.SelectSingleNode("voucher/voucher_head/accounting_period").InnerXml;
                PZDate = dataXml.SelectSingleNode("voucher/voucher_head/date").InnerXml;
                int q = dataXml.SelectSingleNode("voucher/voucher_body").ChildNodes.Count;
                for (int i = 0; i < q; i++)
                {
                    XmlNode bodyXml  = dataXml.SelectSingleNode("voucher/voucher_body").ChildNodes.Item(i);
                    string  ccode    = bodyXml.SelectSingleNode("account_code").Value;
                    string  md_f     = bodyXml.SelectSingleNode("secondary_debit_amount").Value;
                    string  mc_f     = bodyXml.SelectSingleNode("secondary_credit_amount").Value;
                    string  nd_s     = bodyXml.SelectSingleNode("debit_quantity").Value;
                    string  nc_s     = bodyXml.SelectSingleNode("credit_quantity").Value;
                    string  exchName = bodyXml.SelectSingleNode("currency").Value;
                    //辅助项信息
                    XmlNode         accountingXml = bodyXml.SelectSingleNode("auxiliary_accounting");
                    GL_accvouchting body          = new GL_accvouchting();
                    PropertyInfo[]  propertys     = body.GetType().GetProperties();


                    foreach (XmlNode item in accountingXml.ChildNodes)
                    {
                        string filename = item.Attributes["name"].Value;
                        foreach (PropertyInfo prop in propertys)
                        {
                            if (prop.Name.ToLower().Equals(filename.ToLower()))
                            {
                                prop.SetValue(body, item.InnerText, null);
                            }
                        }
                    }

                    //现金流信息
                    int k = bodyXml.SelectSingleNode("detail/cash_flow_statement").ChildNodes.Count;
                    for (int j = 0; j < k; j++)
                    {
                        XmlNode cashXml  = bodyXml.SelectSingleNode("detail/cash_flow_statement").ChildNodes.Item(j);
                        string  cashItem = cashXml.Attributes["cash_item"].Value;
                        if (!String.IsNullOrEmpty(cashItem))
                        {
                            string md = cashXml.Attributes["natural_debit_currency"].Value;
                            string mc = cashXml.Attributes["natural_credit_currency"].Value;

                            CreateAttribute(cashXml, "cCashItem", cashItem);
                            CreateAttribute(cashXml, "ccode", ccode);
                            CreateAttribute(cashXml, "md", md);
                            CreateAttribute(cashXml, "mc", mc);
                            CreateAttribute(cashXml, "md_f", md_f);
                            CreateAttribute(cashXml, "mc_f", mc_f);
                            CreateAttribute(cashXml, "nd_s", nd_s);
                            CreateAttribute(cashXml, "nc_s", nc_s);
                            CreateAttribute(cashXml, "cdept_id", body.dept_id);
                            CreateAttribute(cashXml, "cperson_id", body.personnel_id);
                            CreateAttribute(cashXml, "ccus_id", body.cust_id);
                            CreateAttribute(cashXml, "csup_id", body.supplier_id);
                            CreateAttribute(cashXml, "citem_class", body.item_class);
                            CreateAttribute(cashXml, "citem_id", body.item_id);
                            CreateAttribute(cashXml, "cDefine1", body.self_define1);
                            CreateAttribute(cashXml, "cDefine2", body.self_define2);
                            CreateAttribute(cashXml, "cDefine3", body.self_define3);
                            CreateAttribute(cashXml, "cDefine4", body.self_define4);
                            CreateAttribute(cashXml, "cDefine5", body.self_define5);
                            CreateAttribute(cashXml, "cDefine6", body.self_define6);
                            CreateAttribute(cashXml, "cDefine7", body.self_define7);
                            CreateAttribute(cashXml, "cDefine8", body.self_define8);
                            CreateAttribute(cashXml, "cDefine9", body.self_define9);
                            CreateAttribute(cashXml, "cDefine10", body.self_define10);
                            CreateAttribute(cashXml, "cDefine11", body.self_define11);
                            CreateAttribute(cashXml, "cDefine12", body.self_define12);
                            CreateAttribute(cashXml, "cDefine13", body.self_define13);
                            CreateAttribute(cashXml, "cDefine14", body.self_define14);
                            CreateAttribute(cashXml, "cDefine15", body.self_define15);
                            CreateAttribute(cashXml, "cDefine16", body.self_define16);
                            CreateAttribute(cashXml, "csign", csign);
                            CreateAttribute(cashXml, "iyear", year);
                            CreateAttribute(cashXml, "iYPeriod", year + peroid.ToString().PadLeft(2, '0'));
                            CreateAttribute(cashXml, "cexch_name", exchName);
                        }
                    }
                }
                string result = voucher.getEAIPercess(dataXml.ParentNode.OuterXml);

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(result);
                XmlElement xml     = doc.DocumentElement;
                string     succeed = xml.FirstChild.Attributes["succeed"].InnerText;
                string     dsc     = xml.FirstChild.Attributes["dsc"].InnerText;



                if (succeed == "0" && !dsc.Equals("数据重复上传"))
                {
                    string period  = xml.FirstChild.Attributes["u8accounting_period"].InnerText;
                    string id      = xml.FirstChild.Attributes["u8voucher_id"].InnerText;
                    int    iperiod = Convert.ToInt32(period);
                    int    _id     = Convert.ToInt32(id);
                    string vouid   = year + iperiod.ToString("00") + _id.ToString("0000");

                    msg.Success = true;
                    msg.Msg     = dsc;
                    msg.Code    = 200;
                    dynamic c = new { pzCode = vouid };
                    msg.Data = JsonConvert.SerializeObject(c);
                }
                else
                {
                    msg.Success = false;
                    msg.Msg     = dsc;
                    msg.Code    = 500;
                }
            }
            catch (Exception e)
            {
                msg.Success = false;
                msg.Msg     = e.Message;
                msg.Code    = 500;
            }
            return(msg);
        }
Exemple #23
0
        public ReturnMessage Add(VoucherManager voucher, string DataStr)
        {
            XmlDocument   dataDoc = new XmlDocument();
            ReturnMessage msg     = new ReturnMessage();

            try
            {
                dataDoc.LoadXml(DataStr);
                XmlElement dataXml = dataDoc.DocumentElement;
                string     year    = dataXml.SelectSingleNode("voucher/voucher_head/fiscal_year").InnerXml;
                string     csign   = dataXml.SelectSingleNode("voucher/voucher_head/voucher_type").InnerXml;
                string     peroid  = dataXml.SelectSingleNode("voucher/voucher_head/accounting_period").InnerXml;
                PZDate = dataXml.SelectSingleNode("voucher/voucher_head/date").InnerXml;
                //int q = dataXml.SelectSingleNode("voucher/voucher_body").ChildNodes.Count;
                //for (int i = 0; i < q; i++)
                //{
                //    XmlNode bodyXml = dataXml.SelectSingleNode("voucher/voucher_body").ChildNodes.Item(i);
                //    string ccode = bodyXml.SelectSingleNode("account_code").Value;
                //    string md_f=bodyXml.SelectSingleNode("secondary_debit_amount").Value;
                //    string mc_f=bodyXml.SelectSingleNode("secondary_credit_amount").Value;
                //    string nd_s=bodyXml.SelectSingleNode("debit_quantity").Value;
                //    string nc_s=bodyXml.SelectSingleNode("credit_quantity").Value;
                //    string exchName=bodyXml.SelectSingleNode("currency").Value;
                //    //辅助项信息
                //    XmlNode accountingXml = bodyXml.SelectSingleNode("auxiliary_accounting");
                //    string dept_id = accountingXml.Attributes["dept_id"].Value;
                //    string personnel_id = accountingXml.Attributes["personnel_id"].Value;
                //    string cust_id = accountingXml.Attributes["cust_id"].Value;
                //    string supplier_id = accountingXml.Attributes["supplier_id"].Value;
                //    string item_id = accountingXml.Attributes["item_id"].Value;
                //    string item_class = accountingXml.Attributes["item_class"].Value;
                //    //string _operator = accountingXml.Attributes["operator"].Value;
                //    string self_define1 = accountingXml.Attributes["self_define1"].Value;
                //    string self_define2 = accountingXml.Attributes["self_define2"].Value;
                //    string self_define3 = accountingXml.Attributes["self_define3"].Value;
                //    string self_define4 = accountingXml.Attributes["self_define4"].Value;
                //    string self_define5 = accountingXml.Attributes["self_define5"].Value;
                //    string self_define6 = accountingXml.Attributes["self_define6"].Value;
                //    string self_define7 = accountingXml.Attributes["self_define7"].Value;
                //    string self_define8 = accountingXml.Attributes["self_define8"].Value;
                //    string self_define9 = accountingXml.Attributes["self_define9"].Value;
                //    string self_define10 = accountingXml.Attributes["self_define10"].Value;
                //    string self_define11 = accountingXml.Attributes["self_define11"].Value;
                //    string self_define12 = accountingXml.Attributes["self_define12"].Value;
                //    string self_define13 = accountingXml.Attributes["self_define13"].Value;
                //    string self_define14 = accountingXml.Attributes["self_define14"].Value;
                //    string self_define15 = accountingXml.Attributes["self_define15"].Value;
                //    string self_define16 = accountingXml.Attributes["self_define16"].Value;
                //    //现金流信息
                //    int k = bodyXml.SelectSingleNode("detail/cash_flow_statement").ChildNodes.Count;
                //    for (int j = 0; j < k; j++)
                //    {
                //        XmlNode cashXml = bodyXml.SelectSingleNode("detail/cash_flow_statement").ChildNodes.Item(j);
                //       string cashItem= cashXml.Attributes["cash_item"].Value;
                //       if (!String.IsNullOrEmpty(cashItem))
                //       {
                //           string md = cashXml.Attributes["natural_debit_currency"].Value;
                //           string mc = cashXml.Attributes["natural_credit_currency"].Value;
                //           CreateAttribute(cashXml, "cCashItem", cashItem);
                //           CreateAttribute(cashXml, "ccode", ccode);
                //           CreateAttribute(cashXml, "md", md);
                //           CreateAttribute(cashXml, "mc", mc);
                //           CreateAttribute(cashXml, "md_f",md_f );
                //           CreateAttribute(cashXml, "mc_f", mc_f);
                //           CreateAttribute(cashXml, "nd_s", nd_s);
                //           CreateAttribute(cashXml, "nc_s", nc_s);
                //           CreateAttribute(cashXml, "cdept_id", dept_id);
                //           CreateAttribute(cashXml, "cperson_id", personnel_id);
                //           CreateAttribute(cashXml, "ccus_id", cust_id);
                //           CreateAttribute(cashXml, "csup_id", supplier_id);
                //           CreateAttribute(cashXml, "citem_class", item_class);
                //           CreateAttribute(cashXml, "citem_id", item_id);
                //           CreateAttribute(cashXml, "cDefine1", self_define1);
                //           CreateAttribute(cashXml, "cDefine2", self_define2);
                //           CreateAttribute(cashXml, "cDefine3", self_define3);
                //           CreateAttribute(cashXml, "cDefine4", self_define4);
                //           CreateAttribute(cashXml, "cDefine5", self_define5);
                //           CreateAttribute(cashXml, "cDefine6", self_define6);
                //           CreateAttribute(cashXml, "cDefine7", self_define7);
                //           CreateAttribute(cashXml, "cDefine8", self_define8);
                //           CreateAttribute(cashXml, "cDefine9", self_define9);
                //           CreateAttribute(cashXml, "cDefine10", self_define10);
                //           CreateAttribute(cashXml, "cDefine11", self_define11);
                //           CreateAttribute(cashXml, "cDefine12", self_define12);
                //           CreateAttribute(cashXml, "cDefine13", self_define13);
                //           CreateAttribute(cashXml, "cDefine14", self_define14);
                //           CreateAttribute(cashXml, "cDefine15", self_define15);
                //           CreateAttribute(cashXml, "cDefine16", self_define16);
                //           CreateAttribute(cashXml, "csign", csign);
                //           CreateAttribute(cashXml, "iyear", year);
                //           CreateAttribute(cashXml, "iYPeriod", year+peroid.ToString().PadLeft(2, '0'));
                //           CreateAttribute(cashXml, "cexch_name", exchName);
                //       }

                //    }

                //}

                string result = voucher.getEAIPercess(DataStr);

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(result);
                XmlElement xml     = doc.DocumentElement;
                string     succeed = xml.FirstChild.Attributes["succeed"].InnerText;
                string     dsc     = xml.FirstChild.Attributes["dsc"].InnerText;



                if (succeed == "0" && !dsc.Equals("数据重复上传"))
                {
                    string period  = xml.FirstChild.Attributes["u8accounting_period"].InnerText;
                    string id      = xml.FirstChild.Attributes["u8voucher_id"].InnerText;
                    int    iperiod = Convert.ToInt32(period);
                    int    _id     = Convert.ToInt32(id);
                    string vouid   = year + iperiod.ToString("00") + _id.ToString("0000");

                    msg.Success = true;
                    msg.Msg     = dsc;
                    msg.Code    = 200;
                }
                else
                {
                    msg.Success = false;
                    msg.Msg     = dsc;
                    msg.Code    = 500;
                }
            }
            catch (Exception e)
            {
                msg.Success = false;
                msg.Msg     = e.Message;
                msg.Code    = 500;
            }
            return(msg);
        }
Exemple #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.AppendHeader("Access-Control-Allow-Origin", "*");
        int    UserId       = Convert.ToInt32(Request["UserId"]);
        string VoucherLevel = Request["voucherlevel"];

        string       des                = "";
        int          vouchernum         = 9;
        string       vouchercode        = CreateRandomVoucher(vouchernum);
        string       voucherName        = "";
        decimal      voucherMinCost     = 0;
        decimal      voucherDefaultCost = 0;
        bool         flag               = false;
        DateTime     current            = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Unspecified);
        TimeZoneInfo src                = TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.Local.Id);
        TimeZoneInfo dess               = TimeZoneInfo.FindSystemTimeZoneById("SA Western Standard Time");
        DateTime     datenow            = TimeZoneInfo.ConvertTime(current, src, dess);

        //----------- UPDATE USER TOTAL REWARD ------------//


        //----------- UPDATE USERCARD CURRENT CREDIT ------//
        //UserCardManager uc = new UserCardManager();
        //UserCardTBx usercard = uc.GetUserCardByUserID(UserId);
        //decimal credit = (Decimal)usercard.CurrentCredit;
        //----------- ADD VOUCHER -----------------//



        UserManager um   = new UserManager();
        UsersTbx    user = um.GetUserByID(UserId);
        //int totalReward = Convert.ToInt32(user.TotalReward);
        VoucherManager vc      = new VoucherManager();
        VouchersTBx    voucher = new VouchersTBx();

        try
        {
            if (user.TotalReward >= 100)
            {
                if (VoucherLevel == "VoucherLevel1")
                {
                    voucherName        = "VoucherLevel1";
                    des                = "1st level voucher, price for $5";
                    voucherMinCost     = 5;
                    voucherDefaultCost = 5;
                    //credit -= 200;
                    user.TotalReward -= 200;
                    flag              = true;
                }
                if (VoucherLevel == "VoucherLevle2")
                {
                    voucherName        = "VoucherLevel2";
                    des                = "2st level voucher, price for $10";
                    voucherMinCost     = 10;
                    voucherDefaultCost = 10;
                    if (user.TotalReward >= 300)
                    {
                        //credit -= 300;
                        user.TotalReward -= 300;
                        flag              = true;
                    }
                    else
                    {
                        flag = false;
                    }
                }
                if (VoucherLevel == "VoucherLevel3")
                {
                    voucherName        = "VoucherLevel3";
                    des                = "3st level voucher, price for $15";
                    voucherMinCost     = 15;
                    voucherDefaultCost = 15;
                    if (user.TotalReward >= 400)
                    {
                        user.TotalReward -= 400;
                        user.TotalReward -= 400;
                        flag              = true;
                    }
                    else
                    {
                        flag = false;
                    }
                }
                if (flag == true)
                {
                    voucher.VoucherName        = voucherName;
                    voucher.VoucherDescription = des;
                    //voucher.VoucherAvatar = null;
                    voucher.VoucherMinCost     = voucherMinCost;
                    voucher.VoucherDefaultCost = voucherDefaultCost;
                    voucher.VoucherAddedDate   = datenow;
                    voucher.VoucherEndDate     = datenow.AddHours(720); // Valid for 1 month
                    voucher.VoucherStatus      = 1;

                    voucher.VoucherCode = vouchercode;//UTIL.Encrypt(vouchercode, true);
                    voucher.UserId      = UserId;
                    voucher.RedeemDate  = null;
                    // UserCard update
                    //usercard.CurrentCredit = credit;
                    // User update
                    user.TotalReward = user.TotalReward;

                    //----------------------------------------------//
                    vc.AddVoucher(voucher);

                    vc.Save();
                    //uc.Save();
                    um.Save();

                    ok = "1";
                    return;
                }
                else
                {
                    ok = "2";// not enought curren credit
                }
            }

            else
            {
                ok = "2";
            }
        }
        catch (Exception ex)
        {
            ok = ex.ToString();
        }
    }
        public void Initialize()
        {
            IVoucherManager voucherManager = new VoucherManager();

            shoppingBasket = new ShoppingBasket(voucherManager);
        }
Exemple #26
0
        public HttpResponseMessage AddErrand(string token, string json)
        {
            string        errMsg = "";
            ReturnMessage msg    = new ReturnMessage();

            try
            {
                ReceiveLog receive = new ReceiveLog();
                receive.uuid          = Guid.NewGuid();
                receive.receiveData   = json;
                receive.interfaceCode = "Errand";
                receive.interfaceDesc = "出差单新增";
                receive.op            = "add";

                vouMag = (VoucherManager)HttpContext.Current.Application.Get(token);
                if (vouMag == null)
                {
                    msg.Success = false;
                    msg.Msg     = "参数token无效或已过期";
                    msg.Code    = 500;
                }
                else
                {
                    ReceiveLogManager logManager = new ReceiveLogManager(vouMag.UFDataConnstringForNet);
                    logManager.AddReceiveLog(receive, ref errMsg);
                    ErrandManager errandMag = new ErrandManager(vouMag.UFDataConnstringForNet);
                    ErrandVoucher errand    = (ErrandVoucher)JsonConvert.DeserializeObject(json, typeof(ErrandVoucher));
                    int           i         = errandMag.AddErrand(errand, ref errMsg);
                    if (i >= 2)
                    {
                        //msg.Success = true;
                        //dynamic c = new { code = errandMag.ccode };
                        //msg.Data = JsonConvert.SerializeObject(c);
                        //msg.Code = 200;
                        //msg.Msg = "新增成功";
                        int q = errandMag.auditErrand(errandMag.ccode, errand.head, ref errMsg);
                        if (q >= 2)
                        {
                            msg.Success = true;
                            msg.Code    = 200;
                            dynamic c = new { code = errandMag.ccode };
                            msg.Data = JsonConvert.SerializeObject(c);
                            msg.Msg  = "审核成功";
                        }
                        else
                        {
                            msg.Success = false;
                            msg.Code    = 500;
                            msg.Msg     = "审核失败:" + errMsg;
                        }
                    }
                    else
                    {
                        msg.Success = false;
                        msg.Code    = 500;
                        msg.Msg     = "新增失败" + errMsg;
                    }
                    receive = logManager.getReturnDesc(receive, msg);
                    logManager.UpdateReceiveLog(receive, ref errMsg);
                }



                HttpContext.Current.Application.Remove(vouMag.GetGUID);
                string str = msg.ToJson();
                return(new HttpResponseMessage {
                    Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
                });
            }
            catch (Exception ex)
            {
                msg.Success = false;
                msg.Code    = 500;
                msg.Msg     = ex.Message.ToString();
                string str = msg.ToJson();
                return(new HttpResponseMessage {
                    Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json")
                });
            }
        }
 public PurchaseOrderManager(VoucherManager vou)
 {
     poService = new PurchaseOrderService(vou.UFDataConnstringForNet);
     g_oLogin  = vou.u8Login;
 }