private void LoadData(string sup_id) { IBLL.IPriceBLL bll = new BLL.PriceBLL(); tb = bll.GetSupPriceList(sup_id); this.dgv_main.DataSource = tb; }
void IServiceBase.Request(string t, string pars, out string res) { try { ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars); var kv = r.ToDictionary(); IBLL.IPriceBLL bll = new BLL.PriceBLL(); if (t == "get_cust_price_list") { string cust_id = r.Read("cust_id"); var tb = bll.GetCustPriceList(cust_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_sup_price_list") { string sup_id = r.Read("sup_id"); var tb = bll.GetSupPriceList(sup_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_cust_item_price") { string cust_id = r.Read("cust_id"); string item_no = r.Read("item_no"); string type = r.Read("type"); decimal price = bll.GetCusItemPrice(cust_id, item_no, type); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("price", price.ToString()); res = w.ToString(); } else if (t == "get_sup_item_price") { string sup_id = r.Read("sup_id"); string item_no = r.Read("item_no"); string type = r.Read("type"); decimal price = bll.GetSupItemPrice(sup_id, item_no, type); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("price", price.ToString()); res = w.ToString(); } else if (t == "get_last_in_price") { string item_no = r.Read("item_no"); decimal price = bll.GetLastInPrice(item_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("price", price.ToString()); res = w.ToString(); } else { throw new Exception("接口不存在[" + t + "]"); } } catch (Exception ex) { LogHelper.writeLog("price()", ex.ToString(), t, pars); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "-1"); w.Append("errMsg", ex.Message); res = w.ToString(); } }