コード例 #1
0
ファイル: EmployeeManager.cs プロジェクト: thindev/Calen.IOP
 public resultForEmployees QueryEmployees(criteriaForEmployees criteria)
 {
     using (IOPContext db = new IOPContext())
     {
         int pageSize  = criteria.pageSize;
         int pageIndex = criteria.pageIndex;
         criteria.employeeCode = criteria.employeeCode == null ? "" : criteria.employeeCode;
         criteria.employeeName = criteria.employeeName == null ? "" : criteria.employeeName;
         int totalCount = 0;
         EmployeeConverter  converter = new EmployeeConverter(db);
         IList <Employee>   list      = Utils.LoadPageItems <Employee, string>(db, pageSize, pageIndex, out totalCount, e => e.Code.Contains(criteria.employeeCode) && e.Name.Contains(criteria.employeeName), e => e.Code, true).ToList();
         resultForEmployees result    = new resultForEmployees();
         result.employees    = list.Select(i => converter.ToDto(i)).ToArray();
         result.totalCount   = totalCount;
         result.currentIndex = result.currentIndex;
         return(result);
     }
 }