private void LoadEmployeeGrid() { string sql = "SELECT EmployeeID,Lastname,Firstname,Branch,TSApprover,TSSubmitter,isActive FROM Employee "; sql += "WHERE QBFile='" + GetCompany() + "' "; if (GetBranch() != "AA") { sql += "AND Branch = '" + GetBranch() + "' "; } switch (cbShow.SelectedIndex) { case 0: sql += "AND isActive = 1"; break; case 1: sql += "AND isActive = 0"; break; } DataSet ds = null; using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr)) { ds = dg.GetDataSet(sql); } // List<Employee> empList = new ReaderToModel<Employee>().CreateList(sql, CommonProcs.WCompanyConnStr); gvEmpList.DataSource = ds.Tables[0].DefaultView; }
private void LoadEmployeeGridFromSearch(string searchStr) { string sql = "SELECT EmployeeID,Lastname,Firstname,Branch,TSApprover,TSSubmitter,isActive FROM Employee "; sql += "WHERE FirstName LIKE '%" + searchStr + "%' "; sql += "OR LastName LIKE '%" + searchStr + "%' "; DataSet ds = null; using (clsDataGetter dg = new clsDataGetter(CommonProcs.WCompanyConnStr)) { ds = dg.GetDataSet(sql); } gvEmpList.DataSource = ds.Tables[0].DefaultView; }