protected void EditRow(int index) { gvForStationeryCatalogue.EditIndex = index; gvForStationeryCatalogue.DataBind(); GridViewRowCollection a = gvForStationeryCatalogue.Rows; GridViewRow row = a[index]; Label itemLabel = (Label)row.FindControl("LblItemCode"); DropDownList ddl = (DropDownList)row.FindControl("DdlCategory"); DropDownList ddl2 = (DropDownList)row.FindControl("DdlUOM"); ddl.DataTextField = "CategoryName"; ddl.DataValueField = "CategoryID"; List <Category> categories = EFBroker_Category.GetCategoryList(); Item item = EFBroker_Item.GetItembyItemCode(itemLabel.Text); ddl.DataSource = categories; ddl.SelectedValue = item.CategoryID.ToString(); ddl.DataBind(); ddl2.DataSource = EFBroker_Item.GetDistinctUOMList(); ddl2.SelectedValue = item.UnitOfMeasure; ddl2.DataBind(); row.BackColor = Color.Yellow; return; }
public static Item AddItem(string itemCode, string categoryName, string description, string reorderLevel, string reorderQty, string UOM, string bin) { Item item = new Item(); categoryName = Utility.FirstUpperCase(categoryName); item.ItemCode = itemCode; item.Description = description; item.ReorderLevel = Convert.ToInt32(reorderLevel); item.ReorderQty = Convert.ToInt32(reorderQty); item.UnitOfMeasure = UOM; item.Bin = bin; item.ActiveStatus = "C"; item.BalanceQty = 0; Category cat = EFBroker_Category.GetCategorybyName(categoryName); if (cat != null) { item.CategoryID = cat.CategoryID; EFBroker_Item.AddItem(item); } else { EFBroker_Item.AddItemAndCategory(item, categoryName); cat = EFBroker_Category.GetCategorybyName(categoryName); } item.Category = cat; return(item); }
public string GetCatForGivenItemCode(string code) { int? catFGI = EFBroker_Item.GetItembyItemCode(code).CategoryID; string catFGI2 = EFBroker_Category.GetCategoryList().Where(z => z.CategoryID == catFGI).Select(d => d.CategoryName).FirstOrDefault(); return(catFGI2); }
public List <Item> GetAllItemsForGivenCat(string cat) { int catID = EFBroker_Category.GetCategoryList().Where(c => c.CategoryName == cat).Select(x => x.CategoryID).FirstOrDefault(); List <Item> itemFGC = EFBroker_Item.GetItemsbyCategoryID(catID).ToList(); return(itemFGC); }
public static void UpdateItem(string itemCode, string categoryName, string description, int reorderLevel, int reorderQty, string unitOfMeasure, string bin) { Category category = EFBroker_Category.GetCategorybyName(categoryName); Item i = EFBroker_Item.GetItembyItemCode(itemCode); if (i != null) { i.CategoryID = category.CategoryID; i.Description = description; i.ReorderLevel = reorderLevel; i.ReorderQty = reorderQty; i.UnitOfMeasure = unitOfMeasure; i.Bin = bin; } EFBroker_Item.UpdateItem(i); return; }
protected void Page_Load(object sender, EventArgs e) { ItemBusinessLogic ilogic = new ItemBusinessLogic(); List <Category> catList = EFBroker_Category.GetCategoryList(); Category temp = new Category(); temp.CategoryID = 0; temp.CategoryName = "Other"; catList.Add(temp); DdlCategory.DataSource = catList; DdlCategory.DataTextField = "CategoryName"; DdlCategory.DataValueField = "CategoryID"; List <string> UOMList = EFBroker_Item.GetDistinctUOMList(); UOMList.Add("Other"); DdlUOM.DataSource = UOMList; if (Session["itemlist"] == null) { iList = new List <Item>(); LblSubtitle.Visible = false; } else { iList = (List <Item>)Session["itemlist"]; if (iList.Count != 0) { LblSubtitle.Visible = true; } } // data population gvItemAdded.DataSource = iList; gvItemAdded.DataBind(); if (!IsPostBack) { DdlUOM.DataBind(); DdlCategory.DataBind(); } ControlToUpdate(TxtCategory, DdlCategory); ControlToUpdate(TxtUOM, DdlUOM); }
public List <string> GetAllCategoryNames() { List <string> allCats = EFBroker_Category.GetAllCategoryNames(); return(allCats); }
public static Category GetCategorybyID(int categoryID) { return(EFBroker_Category.GetCategorybyID(categoryID)); }
public static List <Category> GetCategoryList() { return(EFBroker_Category.GetCategoryList()); }
public List <string> GetAllCategoryNames() { List <string> categories = EFBroker_Category.GetAllCategoryNames(); return(categories); }