Esempio n. 1
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;
                }
            }
        }
Esempio n. 2
0
        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();
        }