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(); } }
private void btnOk_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; if (string.IsNullOrEmpty(txt_pay_way.Text)) { txt_pay_way.Focus(); MsgForm.ShowFrom("请输入编号"); return; } if (string.IsNullOrEmpty(txt_pay_name.Text)) { txt_pay_name.Focus(); MsgForm.ShowFrom("请输入名称"); return; } if (rd_is_pay2.Checked == true || rd_is_pay3.Checked == true) { if (rd_pay_kind1.Checked == false && rd_pay_kind2.Checked == false) { throw new Exception("应收应付增减必未选择!"); } } if (item == null) { item = new bi_t_sz_type(); item.other1 = "0"; item.other2 = "1"; item.km_code = ""; item.if_acc = "0"; } item.pay_way = this.txt_pay_way.Text; item.pay_name = this.txt_pay_name.Text; item.pay_memo = this.txt_pay_memo.Text; item.pay_flag = this.cb_pay_flag.SelectedValue.ToString(); item.path = (this.chk_path.Checked == true ? "1" : "0"); item.auto_cashsheet = (this.chk_auto_cashsheet.Checked == true ? "1" : "0"); item.is_account = (this.chk_is_account.Checked == true ? "1" : "0"); item.if_CtFix = (this.chk_if_CtFix.Checked == true ? "1" : "0"); item.is_profit = (this.chk_is_profit.Checked == true ? "1" : "0"); item.account_flag = (this.rd_account_flag2.Checked == true ? "1" : "0"); item.pay_kind = (this.rd_pay_kind2.Checked == true ? "1" : "0"); item.profit_type = (this.rd_profit_type2.Checked == true ? "1" : "0"); item.is_pay = "0"; if (this.rd_is_pay2.Checked) { item.is_pay = "1"; } else if (this.rd_is_pay3.Checked) { item.is_pay = "2"; } DialogResult = System.Windows.Forms.DialogResult.Yes; IBLL.IFinanceBLL bll = new BLL.FinanceBLL(); if (string.IsNullOrEmpty(this.pay_way)) { bll.InsertSZType(item); if (YesNoForm.ShowFrom("新建成功,是否继续新建?") == System.Windows.Forms.DialogResult.Yes) { item = new bi_t_sz_type(); pay_way = ""; txt_pay_way.Text = ""; txt_pay_name.Text = ""; txt_pay_memo.Text = ""; } else { this.Close(); } } else { bll.UpdateSZType(item); MsgForm.ShowFrom("保存成功"); this.Close(); } } catch (Exception ex) { LogHelper.writeLog("frmIncomeEdit=>OK", ex.ToString()); MsgForm.ShowFrom(ex); } finally { Cursor.Current = Cursors.Default; } }