Exemplo n.º 1
0
        protected void uiGridViewEmp_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditEmp")
            {
                IStock.BLL.Employees objData = new IStock.BLL.Employees();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

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

                uiPanelAllEmp.Visible = false;
                uiPanelEditEmployees.Visible = true;
                CurrentEmployee = objData;

                BindEmployees();
            }
            else if (e.CommandName == "DeleteEmp")
            {
                try
                {
                    IStock.BLL.Employees objData = new IStock.BLL.Employees();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
                    objData.MarkAsDeleted();
                    objData.Save();
                    CurrentEmployee = null;
                    BindEmployees();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }
Exemplo n.º 2
0
        private void loadDDLs()
        {
            IStock.BLL.Clients Clients = new IStock.BLL.Clients();
            Clients.LoadAll();
            Clients.Sort = "Name";
            uiDropDownListClients.DataSource = Clients.DefaultView;
            uiDropDownListClients.DataTextField = "Name";
            uiDropDownListClients.DataValueField = "ClientID";
            uiDropDownListClients.DataBind();
            uiDropDownListClients.Items.Insert(0, new ListItem("إختر العميل",""));

            IStock.BLL.Employees employees = new IStock.BLL.Employees();
            employees.LoadAll();
            employees.Sort = "Name";
            uiDropDownListEmployee.DataSource = employees.DefaultView;
            uiDropDownListEmployee.DataTextField = "Name";
            uiDropDownListEmployee.DataValueField = "EmployeeID";
            uiDropDownListEmployee.DataBind();
            uiDropDownListEmployee.Items.Insert(0, new ListItem("إختر الموظف",""));

               /* IStock.BLL.Items items = new IStock.BLL.Items();
            items.LoadAll();
            items.Sort = "Name";
            uiDropDownListItems.DataSource = items.DefaultView;
            uiDropDownListItems.DataTextField = "Name";
            uiDropDownListItems.DataValueField = "ItemID";
            uiDropDownListItems.DataBind();
            uiDropDownListItems.Items.Insert(0, new ListItem("إختر الصنف",""));*/
        }
Exemplo n.º 3
0
 protected void uiLinkButtonBack_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentEmployee = null;
     uiPanelEditEmployees.Visible = false;
     uiPanelAllEmp.Visible = true;
     BindEmployees();
 }
Exemplo n.º 4
0
 private void BindEmployees()
 {
     IStock.BLL.Employees Supps = new IStock.BLL.Employees();
     Supps.LoadAll();
     Supps.Sort = "Name";
     uiGridViewEmp.DataSource = Supps.DefaultView;
     uiGridViewEmp.DataBind();
 }
Exemplo n.º 5
0
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            IStock.BLL.Employees Supp = new IStock.BLL.Employees();
            if (CurrentEmployee == null)
                Supp.AddNew();
            else
                Supp = CurrentEmployee;

            Supp.Name = uiTextBoxName.Text;
            Supp.Description = uiTextBoxDesc.Text;
            Supp.Save();
            ClearFields();
            CurrentEmployee = null;
            uiPanelEditEmployees.Visible = false;
            uiPanelAllEmp.Visible = true;
            BindEmployees();
        }