Example #1
0
        public static DtoTimeSheet DtoTimeSheet(TimeSheetView ts, bool isEmpty = false)
        {
            var timeSheet = new DtoTimeSheet
            {
                IdTimeSheet     = ts.id,
                DateBegin       = ts.DateBeginPeriod,
                DateEnd         = ts.DateEndPeriod,
                DateComposition = ts.DateComposition,
                Department      = DtoDepartment(ts.Dep.Department),
                ApproveStep     = ts.ApproveStep,
                IsFake          = ts.IsFake,
                EmployeesCount  = ts.EmployeeCount
            };

            if (isEmpty)
            {
                return(timeSheet);
            }
            var rec       = ts.TimeSheetRecord.ToArray();
            var employees = rec.DistinctBy(d => d.idFactStaffHistory);

            timeSheet.Employees = employees.Select(s => DtoTimeSheetEmployee(s.FactStaffHistory, rec.Where(w => w.idFactStaffHistory == s.idFactStaffHistory))).ToArray();

            return(timeSheet);
        }
Example #2
0
        public static DtoTimeSheet DtoTimeSheet(TimeSheetView ts)
        {
            var timeSheet = new DtoTimeSheet
            {
                IdTimeSheet     = ts.id,
                DateBegin       = ts.DateBeginPeriod,
                DateEnd         = ts.DateEndPeriod,
                DateComposition = ts.DateComposition,
                Department      = DtoDepartment(ts.Dep.Department),
                IsFake          = ts.IsFake,
                EmployeesCount  = ts.EmployeeCount,
                ApproveStep     = ts.ApproveStep
            };

            return(timeSheet);
        }