Beispiel #1
0
        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");
            }
        }
        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;
                }
            }
        }
 private void BindGroups()
 {
     IStock.BLL.ItemGroups groups = new IStock.BLL.ItemGroups();
     if(!string.IsNullOrEmpty(uiDropDownListCats.SelectedValue))
         groups.GetItemGroupsByCategoryID(Convert.ToInt32(uiDropDownListCats.SelectedValue));
     groups.Sort = "Name";
     uiGridViewGroups.DataSource = groups.DefaultView;
     uiGridViewGroups.DataBind();
 }
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            IStock.BLL.ItemGroups groups = new IStock.BLL.ItemGroups();
            if (CurrentGroup == null)
                groups.AddNew();
            else
                groups = CurrentGroup;

            groups.Name = uiTextBoxName.Text;
            groups.Description = uiTextBoxDesc.Text;
            groups.ItemCategoryID = Convert.ToInt32(uiDropDownListCats.SelectedValue);
            groups.Save();
            ClearFields();
            CurrentGroup = null;
            uiPanelEditGroup.Visible = false;
            uiPanelAllGroups.Visible = true;
            BindGroups();
        }
 protected void uiLinkButtonCancel_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentGroup = null;
     uiPanelEditGroup.Visible = false;
     uiPanelAllGroups.Visible = true;
 }
 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;
 }
Beispiel #7
0
 private void LoadGroups()
 {
     IStock.BLL.ItemGroups groups = new IStock.BLL.ItemGroups();
     if (!string.IsNullOrEmpty(uiDropDownListCats.SelectedValue))
         groups.GetItemGroupsByCategoryID(Convert.ToInt32(uiDropDownListCats.SelectedValue));
     uiDropDownListGroup.DataSource = groups.DefaultView;
     uiDropDownListGroup.DataTextField = "Name";
     uiDropDownListGroup.DataValueField = "ItemGroupID";
     uiDropDownListGroup.DataBind();
     uiDropDownListGroup.Items.Insert(0, new ListItem("إختر مجموعة", ""));
 }
Beispiel #8
0
        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;
        }