private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (txtsheet_no.Text.Trim() != "") { string sheet_no = txtsheet_no.Text.Trim(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.ICashOrder bll = new BLL.CashOrder(); bll.Delete(sheet_no); IOrder ins = this; ins.Add(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (this.dataGrid1.CurrentRow() != null) { string sheet_no = this.dataGrid1.CurrentRow()["sheet_no"].ToString(); if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes) { IBLL.ICashOrder bll = new BLL.CashOrder(); bll.Delete(sheet_no); var tb = this.dataGrid1.DataSource; tb.Rows.Remove(this.dataGrid1.CurrentRow()); this.dataGrid1.Refresh(); } } } catch (Exception ex) { MsgForm.ShowFrom(ex); } }
void IServiceBase.Request(string t, string pars, out string res) { try { ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars); var kv = r.ToDictionary(); IBLL.ICashOrder bll = new BLL.CashOrder(); if (t == "get_list") { DateTime date1 = Helper.Conv.ToDateTime(r.Read("date1")); DateTime date2 = Helper.Conv.ToDateTime(r.Read("date2")); string visa_id = r.Read("visa_id"); var tb = bll.GetList(date1, date2, visa_id); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); res = w.ToString(); } else if (t == "get_order") { string sheet_no = r.Read("sheet_no"); System.Data.DataTable tb1; bll.GetOrder(sheet_no, out tb1); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("tb1", tb1); res = w.ToString(); } else if (t == "max_code") { string code = bll.MaxCode(); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("code", code); res = w.ToString(); } else if (t == "add") { Model.bank_t_cash_master ord = new Model.bank_t_cash_master(); ord.sheet_no = r.Read("sheet_no"); ord.branch_no = r.Read("branch_no"); ord.voucher_no = r.Read("voucher_no"); ord.visa_id = r.Read("visa_id"); ord.visa_in = r.Read("visa_in"); ord.pay_way = r.Read("pay_way"); ord.coin_no = "RMB"; ord.coin_rate = 1; ord.deal_man = r.Read("deal_man"); ord.oper_id = r.Read("oper_id"); ord.oper_date = Helper.Conv.ToDateTime(r.Read("oper_date")); ord.bill_flag = r.Read("bill_flag"); ord.bill_total = Helper.Conv.ToDecimal(r.Read("bill_total")); ord.cm_branch = "00"; ord.approve_flag = "0"; ord.approve_man = ""; ord.approve_date = System.DateTime.MinValue; ord.other1 = r.Read("other1"); ord.other2 = r.Read("other2"); ord.other3 = r.Read("other3"); ord.num1 = Helper.Conv.ToDecimal(r.Read("num1")); ord.num2 = Helper.Conv.ToDecimal(r.Read("num2")); ord.num3 = Helper.Conv.ToDecimal(r.Read("num3")); string sheet_no; bll.Add(ord, out sheet_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("sheet_no", sheet_no); res = w.ToString(); } else if (t == "change") { Model.bank_t_cash_master ord = new Model.bank_t_cash_master(); ord.sheet_no = r.Read("sheet_no"); ord.branch_no = r.Read("branch_no"); ord.voucher_no = r.Read("voucher_no"); ord.visa_id = r.Read("visa_id"); ord.visa_in = r.Read("visa_in"); ord.pay_way = r.Read("pay_way"); ord.coin_no = "RMB"; ord.coin_rate = 1; ord.deal_man = r.Read("deal_man"); ord.oper_id = r.Read("oper_id"); ord.oper_date = Helper.Conv.ToDateTime(r.Read("oper_date")); ord.bill_total = Helper.Conv.ToDecimal(r.Read("bill_total")); ord.cm_branch = "00"; ord.approve_flag = "0"; ord.approve_man = ""; ord.approve_date = System.DateTime.MinValue; ord.other1 = r.Read("other1"); ord.other2 = r.Read("other2"); ord.other3 = r.Read("other3"); ord.num1 = Helper.Conv.ToDecimal(r.Read("num1")); ord.num2 = Helper.Conv.ToDecimal(r.Read("num2")); ord.num3 = Helper.Conv.ToDecimal(r.Read("num3")); bll.Change(ord); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "delete") { string sheet_no = r.Read("sheet_no"); bll.Delete(sheet_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "check") { string sheet_no = r.Read("sheet_no"); string approve_man = r.Read("approve_man"); bll.Check(sheet_no, approve_man); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else { throw new Exception("未找到方法" + t); } } catch (Exception ex) { ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "-1"); w.Append("errMsg", ex.Message); LogHelper.writeLog("", ex.ToString()); res = w.ToString(); } }