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;
                }
            }
        }
 protected void uiLinkButtonBack_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentType = null;
     uiPanelEditTypes.Visible = false;
     uiPanelAllTypes.Visible = true;
     BindTypes();
 }
        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();
        }
 private void BindTypes()
 {
     IStock.BLL.ClientTypes Types = new IStock.BLL.ClientTypes();
     Types.LoadAll();
     Types.Sort = "Name";
     uiGridViewTypes.DataSource = Types.DefaultView;
     uiGridViewTypes.DataBind();
 }
Example #5
0
 private void LoadClientTypes()
 {
     IStock.BLL.ClientTypes types = new IStock.BLL.ClientTypes();
     types.LoadAll();
     uiDropDownListClientTypes.DataSource = types.DefaultView;
     uiDropDownListClientTypes.DataTextField = "Name";
     uiDropDownListClientTypes.DataValueField = "ClientTypeID";
     uiDropDownListClientTypes.DataBind();
     uiDropDownListClientTypes.Items.Insert(0, new ListItem("إختر عميل", ""));
 }