Пример #1
0
        //protected void DataBind()
        //{
        //    //IInventoryManagerBLL objBLL = InventoryManagerBLLFactory.CreateInventoryManagerBLLObject();
        //    //gvVendorDetailList.DataSource = objBLL.GetVendorDetails();
        //    //gvVendorDetailList.DataBind();
        //    IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();
        //    gvshowItems.DataSource = objBLL.GetEmployeeDetailsList();
        //    gvshowItems.DataBind();

        //}

        /// <summary>
        /// This method is used for dinding the data.
        /// </summary>
        protected void DataManageEmployeeBinding()
        {
            IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();

            gvManageEmployee.DataSource = objBLL.GetEmployeeDetailsList();
            gvManageEmployee.DataBind();
        }
Пример #2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string    name   = txtSearchBox.Text;
            IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();

            gvManageEmployee.DataSource = objBLL.GetEmployeeDetailsList(name);
            gvManageEmployee.DataBind();
        }
Пример #3
0
 /// <summary>
 /// This is the page load method for managing employees.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     //gvManageEmployee.Visible = true;
     if (!IsPostBack)
     {
         btnUP.Visible = false;
         IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();
         gvManageEmployee.DataSource = objBLL.GetEmployeeDetailsList();
         gvManageEmployee.DataBind();
     }
 }
Пример #4
0
        /// <summary>
        /// Function to delete an employee from the list.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            IAdminBLL objBLL = AdminBLLFactory.CreateAdminBLLObject();

            try
            {
                bool       isEmployeeSelected = false;
                bool       isDeleted          = false;
                List <int> selectedItemList1  = new List <int>();


                //loop through the grid to find the selected item
                for (int i = 0; i < gvManageEmployee.Rows.Count; i++)
                {
                    GridViewRow gvEmployeeRow = gvManageEmployee.Rows[i];
                    isEmployeeSelected = (Boolean)((CheckBox)gvEmployeeRow.FindControl("chkSelect")).Checked;
                    if (isEmployeeSelected)
                    {
                        selectedItemList1.Add(Convert.ToInt32(gvManageEmployee.Rows[i].Cells[1].Text));
                    }
                }
                if (selectedItemList1.Count == 0)
                {
                    lblMessage.Text = "Please select employee";
                }
                else
                {
                    isDeleted = objBLL.DeleteEmployeeDetails(selectedItemList1);
                    gvManageEmployee.DataSource = objBLL.GetEmployeeDetailsList();
                    gvManageEmployee.DataBind();


                    //if (isEmployeeSelected)
                    //{
                    //    lblMessage.Text = "Please select an employee";
                    //}
                    if (isDeleted)
                    {
                        lblMessage.Text = "Employee(s) deleted successfully";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }