Ejemplo n.º 1
0
        protected void uiGridViewTypes_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditType")
            {
                IStock.BLL.ClientTypes objData = new IStock.BLL.ClientTypes();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxName.Text = objData.Name;
                uiTextBoxDesc.Text = objData.Description;

                uiPanelAllTypes.Visible = false;
                uiPanelEditTypes.Visible = true;
                CurrentType = objData;

                BindTypes();
            }
            else if (e.CommandName == "DeleteType")
            {
                try
                {
                    IStock.BLL.ClientTypes objData = new IStock.BLL.ClientTypes();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentType = null;
                    BindTypes();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
Ejemplo n.º 2
0
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            IStock.BLL.ClientTypes Type = new IStock.BLL.ClientTypes();
            if (CurrentType == null)
                Type.AddNew();
            else
                Type = CurrentType;

            Type.Name = uiTextBoxName.Text;
            Type.Description = uiTextBoxDesc.Text;
            Type.Save();
            ClearFields();
            CurrentType = null;
            uiPanelEditTypes.Visible = false;
            uiPanelAllTypes.Visible = true;
            BindTypes();
        }