Exemplo n.º 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");
            }
        }
Exemplo n.º 2
0
        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;
                }
            }
        }
Exemplo n.º 3
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;
        }