public List <Employee> ListOfEmployeeNameInEmp(string empName) { List <Employee> empCodeList = new List <Employee>(); List <Employee> empSearchList = empDao.SearchByEmployeeName(empName); //string userRoleName = null; //foreach (Employee emp in empSearchList) //{ // userRoleName = GetUserRoleName(emp.UserName); // if (userRoleName.Equals("Store Supervisor")) // { // break; // } //} foreach (Employee e in empSearchList) { if (e.DepartmentCode.Equals("STOR") && !GetUserRoleName(e.UserName).Equals("Store Supervisor")) { empCodeList.Add(e); } } return(empCodeList); }
public List <Employee> ListOfEmployeeNameInDepartment(string empName, string deptCode) { List <Employee> empList = new List <Employee>(); List <Employee> empSearchList = edao.SearchByEmployeeName(empName) .Where(e => e.DepartmentCode == deptCode).ToList(); foreach (Employee e in empSearchList) { Role role = udao.getRoleNameByUsername(e.UserName); if (role != null) { if (role.Id == "Empl") { empList.Add(e); } } } return(empList); }