protected void uiGridViewCats_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCat") { ItemCategories objData = new ItemCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxName.Text = objData.Name; uiTextBoxDesc.Text = objData.Description; uiPanelAllCats.Visible = false; uiPanelEditCat.Visible = true; CurrentCat = objData; BindCats(); } else if (e.CommandName == "DeleteCat") { try { ItemCategories objData = new ItemCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentCat = null; BindCats(); } catch (Exception ex) { uipanelError.Visible = true; } } }
protected void uiGridViewGroups_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditGroup") { IStock.BLL.ItemGroups objData = new IStock.BLL.ItemGroups(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxName.Text = objData.Name; uiTextBoxDesc.Text = objData.Description; uiDropDownListCats.SelectedValue = objData.ItemCategoryID.ToString(); IStock.BLL.ItemCategories cat = new ItemCategories(); cat.LoadByPrimaryKey(objData.ItemCategoryID); uiLabelCat.Text = cat.Name; uiPanelAllGroups.Visible = false; uiPanelEditGroup.Visible = true; CurrentGroup = objData; BindGroups(); } else if (e.CommandName == "DeleteGroup") { try { IStock.BLL.ItemGroups objData = new IStock.BLL.ItemGroups(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentGroup = null; BindGroups(); } catch (Exception ex) { uipanelError.Visible = true; } } }
protected void uiLinkButtonBack_Click(object sender, EventArgs e) { ClearFields(); CurrentCat = null; uiPanelEditCat.Visible = false; uiPanelAllCats.Visible = true; BindCats(); }
private void BindCats() { ItemCategories cats = new ItemCategories(); cats.LoadAll(); cats.Sort = "Name"; uiGridViewCats.DataSource = cats.DefaultView; uiGridViewCats.DataBind(); }
protected void uiLinkButtonOK_Click(object sender, EventArgs e) { ItemCategories cat = new ItemCategories (); if (CurrentCat == null) cat.AddNew(); else cat = CurrentCat; cat.Name = uiTextBoxName.Text; cat.Description = uiTextBoxDesc.Text; cat.Save(); ClearFields(); CurrentCat = null; uiPanelEditCat.Visible = false; uiPanelAllCats.Visible = true; BindCats(); }
protected void uiGridViewGroups_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label CatName = (Label)e.Row.FindControl("uiLabelCat"); IStock.BLL.ItemCategories Cat = new IStock.BLL.ItemCategories(); DataRowView row = (DataRowView)e.Row.DataItem; Cat.LoadByPrimaryKey(Convert.ToInt32(row["ItemCategoryID"].ToString())); CatName.Text = Cat.Name; } }
private void loadDDLs() { IStock.BLL.ItemCategories Cats = new IStock.BLL.ItemCategories(); Cats.LoadAll(); Cats.Sort = "Name"; uiDropDownListCats.DataSource = Cats.DefaultView; uiDropDownListCats.DataTextField = "Name"; uiDropDownListCats.DataValueField = "ItemCategoryID"; uiDropDownListCats.DataBind(); uiDropDownListCats.Items.Insert(0, new ListItem("إختر التصنيف", "")); uiLinkButtonAdd.Enabled = (!string.IsNullOrEmpty(uiDropDownListCats.SelectedValue)); }
protected void uiLinkButtonAdd_Click(object sender, EventArgs e) { ClearFields(); CurrentGroup = null; IStock.BLL.ItemCategories cat = new ItemCategories(); cat.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListCats.SelectedValue)); uiLabelCat.Text = cat.Name; uiPanelEditGroup.Visible = true; uiPanelAllGroups.Visible = false; }
protected void uiGridViewItems_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditItem") { IStock.BLL.Items objData = new IStock.BLL.Items(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxName.Text = objData.Name; uiTextBoxCode.Text = objData.ItemCode; uiTextBoxDesc.Text = objData.Description; if (!objData.IsColumnNull("Quantity")) uiTextBoxQty.Text = objData.Quantity.ToString(); if(!objData.IsColumnNull("ReOrderLevel")) uiTextBoxReOrderLevel.Text = objData.ReOrderLevel.ToString(); IStock.BLL.ItemGroups group = new IStock.BLL.ItemGroups(); group.LoadByPrimaryKey(Convert.ToInt32(objData.GroupID)); uiLabelGroup.Text = group.Name; IStock.BLL.ItemCategories cat = new ItemCategories(); if (!string.IsNullOrEmpty(uiDropDownListCats.SelectedValue)) { cat.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListCats.SelectedValue)); } else cat.LoadByPrimaryKey(group.ItemCategoryID); uiLabelCat.Text = cat.Name; uiPanelAllItems.Visible = false; uiPanelEditItems.Visible = true; CurrentItem = objData; BindPrices(); uiPanelActions.Visible = true; } else if (e.CommandName == "DeleteItem") { try { IStock.BLL.Items objData = new IStock.BLL.Items(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentItem = null; BindData(); } catch (Exception ex) { uipanelError.Visible = true; } } else if (e.CommandName == "GetItemBalance") { Session["Report_ItemIDForBalance"] = e.CommandArgument.ToString(); Session["CurrentReport"] = "Report_GetItemsBalances"; Response.Redirect("Reports.aspx"); } }
private void LoadCategories() { ItemCategories cats = new ItemCategories(); cats.LoadAll(); uiDropDownListCats.DataSource = cats.DefaultView; uiDropDownListCats.DataTextField = "Name"; uiDropDownListCats.DataValueField = "ItemCategoryID"; uiDropDownListCats.DataBind(); uiDropDownListCats.Items.Insert(0, new ListItem("إختر تصنيف", "")); }
protected void uiLinkButtonAdd_Click(object sender, EventArgs e) { ClearFields(); CurrentItem = null; uiGridViewPrices.DataSource = null; uiGridViewPrices.DataBind(); IStock.BLL.Items item = new IStock.BLL.Items(); uiTextBoxCode.Text = item.GenerateItemCode(Convert.ToInt32(uiDropDownListGroup.SelectedValue)).ToString(); uiPanelEditItems.Visible = true; uiPanelAllItems.Visible = false; uiPanelActions.Visible = false; IStock.BLL.ItemCategories cat = new ItemCategories(); cat.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListCats.SelectedValue)); uiLabelCat.Text = cat.Name; IStock.BLL.ItemGroups group = new IStock.BLL.ItemGroups(); group.LoadByPrimaryKey(Convert.ToInt32(uiDropDownListGroup.SelectedValue)); uiLabelGroup.Text = group.Name; }