Exemple #1
0
        /// <summary>
        /// To get the list of available employees (in the current selected company)
        /// </summary>
        /// <param name="searchText">The text to search</param>
        private void GetEmployeeDetails(string searchText, bool activatedDeactivated)
        {
            try
            {
                // Get the list of employees
                EmployeeDL employeeDetails = new EmployeeDL();

                DataView dView = employeeDetails.GetEmployeeByCompanyID(_companyID, searchText, activatedDeactivated).Tables[0].DefaultView;
                dView.Sort = ViewState["SortExpression"].ToString() + " " + ViewState["SortDirection"].ToString();
                if (dView.Table.Rows.Count == 0)
                {
                    dView.Table.Rows.Add(dView.Table.NewRow());
                    gvEmployeeDetails.DataSource = dView;
                    gvEmployeeDetails.DataBind();
                    int columncount = gvEmployeeDetails.Rows[0].Cells.Count;
                    gvEmployeeDetails.Rows[0].Cells.Clear();
                    gvEmployeeDetails.Rows[0].Cells.Add(new TableCell());
                    gvEmployeeDetails.Rows[0].Cells[0].ColumnSpan = columncount;
                    gvEmployeeDetails.Rows[0].Cells[0].Attributes.CssStyle.Add("text-align", "Center");
                    gvEmployeeDetails.Rows[0].Cells[0].Attributes.CssStyle.Add("font-weight", "bold");
                    gvEmployeeDetails.Rows[0].Cells[0].Text = "Currently there are no entries to display";
                }
                else
                {
                    gvEmployeeDetails.DataSource = dView;
                    gvEmployeeDetails.DataBind();
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogErrorMessageToDB("ManageEmployee.aspx", "", "GetEmployeeDetails(string searchText)", ex.Message.ToString(), new ACEConnection());
            }
        }