示例#1
0
        public List <CustomDay_WBIWithWBINameVM> GetAllTimeslipTemplatesByCustomDayWithWBIName(string customDayId)
        {
            WBIRepo wbiRepo = new WBIRepo(_context);

            var timeslipTemplateListByCustomDay = GetAllTimeslipTemplateByCustomDay(customDayId);

            var timeslipTemplateListWithWBIName = new List <CustomDay_WBIWithWBINameVM>();

            foreach (CustomDay_WBI t in timeslipTemplateListByCustomDay)
            {
                CustomDay_WBIWithWBINameVM customDay_WBIWithWBINameVM = new CustomDay_WBIWithWBINameVM()
                {
                    TimeslipTemplateId = t.TimeslipTemplateId,
                    StartTime          = t.StartTime,
                    EndTime            = t.EndTime,
                    Remarks            = t.Remarks,
                    NewChangeRequestId = t.NewChangeRequestId,
                    WBIName            = _context.NewChangeRequestExtensionBase.Where(u => u.NewChangeRequestId == t.NewChangeRequestId).FirstOrDefault().NewName
                };

                timeslipTemplateListWithWBIName.Add(customDay_WBIWithWBINameVM);
            }

            return(timeslipTemplateListWithWBIName);
        }
        public List <TimeslipWithWBINameVM> GetAllTimeslipsByUserIdWithWBIName(Guid userId)
        {
            WBIRepo wbiRepo = new WBIRepo(_context);

            var timeslipListByUserId = GetAllTimeslipsByUserId(userId);

            var timeslipListWithWBIName = new List <TimeslipWithWBINameVM>();

            foreach (NewTimesheetEntryExtensionBase t in timeslipListByUserId)
            {
                DateTime?newStartTime = t.NewStartTask;
                DateTime?newEndTime   = t.NewEndTask;

                TimeslipWithWBINameVM timeslipWithWBINameVM = new TimeslipWithWBINameVM()
                {
                    newTimesheetEntryId = t.NewTimesheetEntryId.ToString(),
                    newStartTask        = newStartTime.ToString(),
                    newEndTask          = newEndTime.ToString(),
                    newRemarks          = t.NewRemarks,
                    newChangeRequestId  = t.NewChangeRequestId.ToString(),
                    WBIName             = _context.NewChangeRequestExtensionBase.Where(u => u.NewChangeRequestId == t.NewChangeRequestId).FirstOrDefault().NewName
                };

                timeslipListWithWBIName.Add(timeslipWithWBINameVM);
            }

            return(timeslipListWithWBIName);
        }