private void gridMainView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { BLL.Item items = new BLL.Item(); DataRow MainRow = gridMainView.GetFocusedDataRow(); int ItemID = Convert.ToInt32(MainRow["ItemID"]); int ManufacturerID = Convert.ToInt32(MainRow["ManufacturerID"]); int ItemUnitID = Convert.ToInt32(MainRow["ItemUnitID"]); int AccountID = Convert.ToInt32(MainRow["AccountID"]); gridDetail.DataSource = items.GetReceiveDocByItemAndManufactuerAndUnit(ItemID, ManufacturerID, ItemUnitID, AccountID); gridPicklist.DataSource = items.GetPicklistByItemAndManufactuerAndUnit(ItemID, ManufacturerID, ItemUnitID, AccountID); gridMovingAverage.DataSource = items.GetIssueDocByItemAndManufactuerAndUnit(ItemID, ManufacturerID, ItemUnitID, AccountID); } catch { } }
private void btnLoadReceipt_Click(object sender, EventArgs e) { BLL.Item items = new BLL.Item(); gridMain.DataSource = items.GetItemByManufactuerAndUnit(); }
private void btnLoadCostTier_Click(object sender, EventArgs e) { BLL.Item items = new BLL.Item(); gridCostTier.DataSource = items.GetCostTierComparision(); }
void IServiceBase.Request(string t, string pars, out string res) { try { ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars); var kv = r.ToDictionary(); IBLL.IItem bll = new BLL.Item(); if (t == "get_list") { string item_clsno = r.Read("item_clsno"); string keyword = r.Read("keyword"); int show_stop = Helper.Conv.ToInt32(r.Read("show_stop")); int page_index = Helper.Conv.ToInt32(r.Read("page_index")); int page_size = Helper.Conv.ToInt32(r.Read("page_size")); int total_count = 0; var tb = bll.GetList(item_clsno, keyword, show_stop, page_index, page_size, out total_count); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); w.Append("total_count", total_count.ToString()); res = w.ToString(); } else if (t == "get_item") { string item_no = r.Read("item_no"); var tb = bll.GetItem(item_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); 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.bi_t_item_info item = new Model.bi_t_item_info(); item.item_no = r.Read("item_no"); item.item_subno = r.Read("item_subno"); item.item_name = r.Read("item_name"); item.item_subname = r.Read("item_subname"); item.item_clsno = r.Read("item_clsno"); item.unit_no = r.Read("unit_no"); item.item_size = r.Read("item_size"); item.product_area = r.Read("product_area"); item.price = Helper.Conv.ToDecimal(r.Read("price")); item.base_price = Helper.Conv.ToDecimal(r.Read("base_price")); item.sale_price = Helper.Conv.ToDecimal(r.Read("sale_price")); item.combine_sta = r.Read("combine_sta"); item.item_flag = r.Read("item_flag"); item.display_flag = r.Read("display_flag"); item.sup_no = r.Read("sup_no"); item.barcode = r.Read("barcode"); item.base_price2 = Helper.Conv.ToDecimal(r.Read("base_price2")); item.base_price3 = Helper.Conv.ToDecimal(r.Read("base_price3")); item.valid_day = Helper.Conv.ToDecimal(r.Read("valid_day")); 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_item_info item = new Model.bi_t_item_info(); item.item_no = r.Read("item_no"); item.item_subno = r.Read("item_subno"); item.item_name = r.Read("item_name"); item.item_subname = r.Read("item_subname"); item.item_clsno = r.Read("item_clsno"); item.unit_no = r.Read("unit_no"); item.item_size = r.Read("item_size"); item.product_area = r.Read("product_area"); item.price = Helper.Conv.ToDecimal(r.Read("price")); item.base_price = Helper.Conv.ToDecimal(r.Read("base_price")); item.sale_price = Helper.Conv.ToDecimal(r.Read("sale_price")); item.combine_sta = r.Read("combine_sta"); item.item_flag = r.Read("item_flag"); item.display_flag = r.Read("display_flag"); item.sup_no = r.Read("sup_no"); item.barcode = r.Read("barcode"); item.base_price2 = Helper.Conv.ToDecimal(r.Read("base_price2")); item.base_price3 = Helper.Conv.ToDecimal(r.Read("base_price3")); item.valid_day = Helper.Conv.ToDecimal(r.Read("valid_day")); bll.Change(item); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "delete") { string item_no = r.Read("item_no"); bll.Delete(item_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t == "get_list_short") { var tb = bll.GetListShort(); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("datas", tb); res = w.ToString(); } else if (t == "is_use") { string item_no = r.Read("item_no"); var val = bll.IsUse(item_no); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("value", val.ToString()); res = w.ToString(); } else if (t == "get_list_by_sup") { string sup_no = r.Read("sup_no"); string keyword = r.Read("keyword"); int show_stop = Helper.Conv.ToInt32(r.Read("show_stop")); int page_index = Helper.Conv.ToInt32(r.Read("page_index")); int page_size = Helper.Conv.ToInt32(r.Read("page_size")); int total_count = 0; var tb = bll.GetList_BySup(sup_no, keyword, show_stop, page_index, page_size, out total_count); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("data", tb); w.Append("total_count", total_count.ToString()); res = w.ToString(); } else { WebHelper w = new WebHelper(pars); w.ReflectionMethod(bll, t); res = w.NmJson(); } } catch (Exception ex) { ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "-1"); w.Append("errMsg", ex.Message); res = w.ToString(); } }