public ActionResult GetTeachers(DtoEmployeeSearch search) { search.Status = StatusEnum.效; search.RoleCode = "teacher"; EmployeeBll bll = new EmployeeBll(); var employees = bll.GetEmployees(search); Dictionary <int, string> dic = new Dictionary <int, string>(); employees.ToList().ForEach(e => dic.Add(e.Id, e.Name)); var result = OptionFactory.CreateOptions(dic); return(Select2(result)); }
public IList <DtoTeacher> GetEmployees(DtoEmployeeSearch search) { StringBuilder sqlBuilder = new StringBuilder(); sqlBuilder.Append(@"SELECT e.Bem_Id AS Id, e.Bem_Name AS Name FROM Bas_Role AS r INNER JOIN Bas_EmployeeRole AS er on er.Ber_RoleId = r.Bro_Id INNER JOIN Bas_Employee AS e on er.Ber_EmployeeId = e.Bem_Id"); sqlBuilder.Append(" WHERE e.Bem_Status = @Status"); if (search.RoleCode.HasValue()) { sqlBuilder.Append(" AND r.Bro_code = @RoleCode"); } if (search.Grade > 0) { sqlBuilder.Append(" AND (e.Bem_Grades & @Grade) > 0"); } return(Query <DtoTeacher>( sqlBuilder.ToString(), search).ToList()); }
public IList <DtoTeacher> GetEmployees(DtoEmployeeSearch search) { return(BllEmployeeRepository.GetEmployees(search)); }