示例#1
0
 public DtoFactStaffEmployee[] GetDepartmentFactStaffs(int idDepartment)
 {
     using (var db = new KadrDataContext())
     {
         return
             (db.FactStaffs.Where(w => w.PlanStaff.idDepartment == idDepartment && (w.DateEnd == null || w.DateEnd > DateTime.Today)).Select(
                  s => DtoClassConstructor.DtoFactStaffEmployee(s.CurrentChange)).ToArray());
     }
 }
示例#2
0
 public DtoFactStaffEmployee[] GetEmployeesForTimeSheet(int idDepartment, DtoApprover approver, DateTime dateStart, DateTime dateEnd)
 {
     using (var db = new KadrDataContext())
     {
         //var depsId = GetDepartmentsIdList(idDepartment);
         var loadOptions = new DataLoadOptions();
         loadOptions.LoadWith((FactStaffWithHistory fswh) => fswh.PlanStaff);
         loadOptions.LoadWith((PlanStaff ps) => ps.Post);
         loadOptions.LoadWith((Post p) => p.Category);
         loadOptions.LoadWith((PlanStaff ps) => ps.WorkShedule);
         loadOptions.LoadWith((FactStaffWithHistory fswh) => fswh.Employee);
         loadOptions.LoadWith((OK_Otpusk oko) => oko.OK_Otpuskvid);
         db.LoadOptions = loadOptions;
         var ts = new TimeSheetManaget(idDepartment, dateStart, dateEnd, approver.EmployeeLogin, db);
         return
             (ts.GetAllEmployees()
              .Select(s => DtoClassConstructor.DtoFactStaffEmployee(db, s.idFactStaffHistory))
              .ToArray());
     }
 }