//Emp Grid Bind #region [Emp Grid Bind] private void GrdViewEmployeeBind() { try { EWA_EmpAssignSubject objEWA = new EWA_EmpAssignSubject(); BL_EmpAssignSubject objBL = new BL_EmpAssignSubject(); objEWA.Action = "FetchAssignedEmployee"; objEWA.OrgId = Session["OrgId"].ToString(); objEWA.DesignationTypeId = "1"; objEWA.ClassId = ddlClass.SelectedValue.ToString(); objEWA.CourseId = ddlCourse.SelectedValue.ToString(); objEWA.BranchId = ddlBranch.SelectedValue.ToString(); objEWA.SubjectId = ddlSubject.SelectedValue.ToString(); DataSet ds = objBL.EmployeeGridBind_BL(objEWA); if (ds.Tables[0].Rows.Count != 0) { GrdViewEmployee.DataSource = ds; GrdViewEmployee.DataBind(); GrdViewEmployee.Columns[3].Visible = true; } else { ShowEmptyGridView(GrdViewEmployee); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Emp Bind #region [Emp Bind] private void GrdViewEmployeeBind() { try { EWA_AssignDeptDes objEWA = new EWA_AssignDeptDes(); BL_AssignDeptDes objBL = new BL_AssignDeptDes(); objEWA.Action = "FetchAssignedEmployee"; objEWA.OrgId = Session["OrgId"].ToString(); objEWA.DepartmentId = ddlDepartment.SelectedValue.ToString(); objEWA.DesignationTypeId = rbtlDesType.SelectedValue.ToString(); objEWA.DesignationId = ddlDesignation.SelectedValue.ToString(); DataSet ds = objBL.EmployeeGridBind_BL(objEWA); if (ds.Tables[0].Rows.Count != 0) { GrdViewEmployee.DataSource = ds; GrdViewEmployee.DataBind(); dsGrdViewEmployee = ds.Copy(); GrdViewEmployee.Columns[3].Visible = true; } else { GrdViewEmployee.DataSource = null; GrdViewEmployee.DataBind(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Emp Page Index Change #region [Emp Page Index Change] protected void GrdViewEmployee_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { GrdViewEmployee.PageIndex = e.NewPageIndex; GrdViewEmployee.DataSource = dsGrdViewEmployee; GrdViewEmployee.DataBind(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
private void ViewAllEmployee() { if (GrdViewEmployee.Rows.Count < 1) { GrdViewEmployee.EmptyDataText = "There is no Employee to view."; } using (SqlConnection con = new SqlConnection(CS)) { SqlDataAdapter da = new SqlDataAdapter("SELECT EmpID, EmpFstName, EmpLstName, EmpEmail, Gender, PhnNo, CONVERT(nvarchar(30), DOB, 103) as DOB, Designation, Comment, EmpImage FROM Employees", con); con.Open(); DataTable dt = new DataTable(); da.Fill(dt); GrdViewEmployee.DataSource = dt; GrdViewEmployee.DataBind(); } }
//DDL Design Index Changed #region [Design Index Changed] protected void ddlDesignation_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlDesignation.SelectedItem.Text.Equals("Select")) { GrdViewEmployee.DataSource = null; GrdEmployee.DataSource = null; GrdEmployee.DataBind(); GrdViewEmployee.DataBind(); } else { GrdViewEmployeeBind(); GrdEmployeeBind(); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }