void IBLL.IBank.Add(Model.bi_t_bank_info item) { string sql = "select * from bi_t_bank_info where visa_id='" + item.visa_id + "'"; DB.IDB db = new DB.DBByAutoClose(Appsetting.conn); var tb = db.ExecuteToTable(sql, null); if (tb.Rows.Count != 0) { throw new Exception("已存在银行编号" + item.visa_id); } db.Insert(item); }
void IBLL.IBank.Change(Model.bi_t_bank_info item) { DB.IDB db = new DB.DBByAutoClose(Appsetting.conn); db.Update(item, "visa_id"); }
void IServiceBase.Request(string t, string pars, out string res) { try { ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars); var kv = r.ToDictionary(); IBLL.IBank bll = new BLL.Bank(); if (t == "get_list") { var tb = bll.GetList(); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); res = w.ToString(); } else if (t == "get_item") { string visa_id = r.Read("visa_id"); var tb = bll.GetItem(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 == "add") { Model.bi_t_bank_info item = new Model.bi_t_bank_info(); item.visa_id = r.Read("visa_id"); item.visa_nm = r.Read("visa_nm"); item.display_flag = r.Read("display_flag"); bll.Add(item); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "change") { Model.bi_t_bank_info item = new Model.bi_t_bank_info(); item.visa_id = r.Read("visa_id"); item.visa_nm = r.Read("visa_nm"); item.display_flag = r.Read("display_flag"); bll.Change(item); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "delete") { string visa_id = r.Read("visa_id"); bll.Delete(visa_id); 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); res = w.ToString(); } }
public void change(WebHelper w, Dictionary <string, object> kv) { Model.bi_t_bank_info item = w.GetObject <Model.bi_t_bank_info>(); bll.Change(item); }