/// <summary> /// This is the Page Load method for deleting an item /// </summary> public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { lblMessage.Text = ""; IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject(); List <IItemCategory> itemList = objBLL.GetCategoryList(); ddlCategory.DataSource = itemList; ddlCategory.DataTextField = "CategoryName"; ddlCategory.DataValueField = "CategoryID"; ddlCategory.DataBind(); } }
protected void btnCat_Click(object sender, EventArgs e) { string categoryName = txtnewCat.Text; IAdminBLL objBLL = BLLFactory.AdminBLLFactory.CreateAdminBLLObject(); objBLL.SaveCategory(categoryName); lblNewCat.Visible = false; btnCat.Visible = false; txtnewCat.Visible = false; List <IItemCategory> itemList = objBLL.GetCategoryList(); ddlCategory.DataSource = itemList; ddlCategory.DataTextField = "CategoryName"; ddlCategory.DataValueField = "CategoryID"; ddlCategory.DataBind(); }
/// <summary> /// This is the Page Load method for adding an item /// </summary> protected void Page_Load(object sender, EventArgs e) { IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject(); int itemId = Convert.ToInt32(Request.QueryString["ItemID"]); if (!IsPostBack) { List <IItemCategory> itemList = objBLL.GetCategoryList(); ddlCategory.DataSource = itemList; ddlCategory.DataTextField = "CategoryName"; ddlCategory.DataValueField = "CategoryID"; ddlCategory.DataBind(); if (itemId != 0) { //itemId = Convert.ToInt32(Request.QueryString["ItemID"]); IItem objItem = ViewItemBOFactory.CreateItemobject(); // IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject(); objItem = objBLL.GetItemByItemId(itemId); objItem.ItemID = itemId; txtItemName.Text = Convert.ToString(objItem.ItemName); ddlCategory.SelectedValue = Convert.ToString(objItem.ItemCategory); txtItemPrice.Text = Convert.ToString(objItem.ItemPrice); txtItemQuantity.Text = Convert.ToString(objItem.ItemQuantity); txtItemDiscount.Text = Convert.ToString(objItem.ItemDiscount); //objBLL.UpdateItemDetails(objItem); } lblNewCat.Visible = false; btnCat.Visible = false; txtnewCat.Visible = false; } /*else * { * int itemId = Convert.ToInt32(tx); * }*/ }