Esempio n. 1
0
        private void init_data()
        {
            Thread th = new Thread(() =>
            {
                Helper.GlobalData.windows.ShowLoad(this);
                try
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        Cursor.Current       = Cursors.WaitCursor;
                        IBLL.IFinanceBLL bll = new BLL.FinanceBLL();
                        tb = bll.GetSZTypeList();

                        this.dgvPay.DataSource = tb;
                        Cursor.Current         = Cursors.Default;
                    });
                }
                catch (Exception ex)
                {
                    LogHelper.writeLog("frmDept=>LoadItemCls", "获取商品分类出错!");
                    MsgForm.ShowFrom(ex);
                }
                Helper.GlobalData.windows.CloseLoad(this);
            });

            th.Start();
        }
Esempio n. 2
0
        void IServiceBase.Request(string t, string pars, out string res)
        {
            try
            {
                ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                var kv = r.ToDictionary();
                IBLL.IFinanceBLL bll = new BLL.FinanceBLL();
                if (t == "get_sz_list")
                {
                    string is_show_stop = r.Read("is_show_stop");
                    var    tb           = bll.GetSZTypeList(is_show_stop);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);
                    res = w.ToString();
                }
                else if (t == "get_sz_item")
                {
                    string pay_way = r.Read("pay_way");
                    var    tb      = bll.GetSZTypeItem(pay_way);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);
                    res = w.ToString();
                }
                else if (t == "add_sz")
                {
                    Model.bi_t_sz_type item = new Model.bi_t_sz_type();
                    item.pay_way        = r.Read("pay_way");
                    item.pay_name       = r.Read("pay_name");
                    item.pay_flag       = r.Read("pay_flag");
                    item.km_code        = r.Read("km_code");
                    item.pay_kind       = r.Read("pay_kind");
                    item.other1         = r.Read("other1");
                    item.other2         = r.Read("other2");
                    item.num1           = Helper.Conv.ToDecimal(r.Read("num1"));
                    item.num2           = Helper.Conv.ToInt(r.Read("num2"));
                    item.pay_memo       = r.Read("pay_memo");
                    item.if_acc         = r.Read("if_acc");
                    item.path           = r.Read("path");
                    item.is_account     = r.Read("is_account");
                    item.account_flag   = r.Read("account_flag");
                    item.is_pay         = r.Read("is_pay");
                    item.is_profit      = r.Read("is_profit");
                    item.profit_type    = r.Read("profit_type");
                    item.auto_cashsheet = r.Read("auto_cashsheet");
                    item.if_CtFix       = r.Read("if_CtFix");

                    bll.InsertSZType(item);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "change_sz")
                {
                    Model.bi_t_sz_type item = new Model.bi_t_sz_type();
                    item.pay_way        = r.Read("pay_way");
                    item.pay_name       = r.Read("pay_name");
                    item.pay_flag       = r.Read("pay_flag");
                    item.km_code        = r.Read("km_code");
                    item.pay_kind       = r.Read("pay_kind");
                    item.other1         = r.Read("other1");
                    item.other2         = r.Read("other2");
                    item.num1           = Helper.Conv.ToDecimal(r.Read("num1"));
                    item.num2           = Helper.Conv.ToInt(r.Read("num2"));
                    item.pay_memo       = r.Read("pay_memo");
                    item.if_acc         = r.Read("if_acc");
                    item.path           = r.Read("path");
                    item.is_account     = r.Read("is_account");
                    item.account_flag   = r.Read("account_flag");
                    item.is_pay         = r.Read("is_pay");
                    item.is_profit      = r.Read("is_profit");
                    item.profit_type    = r.Read("profit_type");
                    item.auto_cashsheet = r.Read("auto_cashsheet");
                    item.if_CtFix       = r.Read("if_CtFix");
                    bll.UpdateSZType(item);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete_sz")
                {
                    string pay_way = r.Read("pay_way");
                    bll.DeleteSZType(pay_way);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else
                {
                    throw new Exception("接口不存在[" + t + "]");
                }
            }
            catch (Exception ex)
            {
                LogHelper.writeLog("finance()", ex.ToString(), t, pars);
                ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                w.Append("errId", "-1");
                w.Append("errMsg", ex.Message);
                res = w.ToString();
            }
        }