private void CreateTimesheetUI() { var days = (WeeksOfYearVm.EndDate - WeeksOfYearVm.StartDate).TotalDays + 1; for (int i = 0; i < days; i++) { var currDate = WeeksOfYearVm.StartDate.AddDays(i); TimesheetVm.Add(new TimesheetVm { Day = currDate.ToString("dddd"), Date = currDate, WorkHours = 0F, LunchHours = 0F, Comments = "" }); } }
private void CreateTimesheetUI() { var days = (WeeksOfYearVm.EndDate - WeeksOfYearVm.StartDate).TotalDays + 1; for (int i = 0; i < days; i++) { var currDate = WeeksOfYearVm.StartDate.AddDays(i); TimesheetVm.Add(new TimesheetVm { Day = currDate.ToString("dddd"), Date = currDate, WorkHours = 0F, LunchHours = 0F, Comments = "", isDisabled = !(currDate >= CurrentUser.ContractStartTime) }); } if (WeeksOfYearVm.WeekNumber == Convert.ToInt32(CurrentWeekNumber)) { TimesheetState = ApplicationContants.TS_STATUS_PLACEHOLDER + ApplicationContants.TS_NEW; } //if previous week if (WeeksOfYearVm.WeekNumber < Convert.ToInt32(CurrentWeekNumber)) { isLastDayOfWeek = !(TimesheetVm.Any(tm => !tm.isDisabled)); isSaveDisabled = isLastDayOfWeek; if (!isLastDayOfWeek) { TimesheetState = ApplicationContants.TS_STATUS_PLACEHOLDER + ApplicationContants.TS_PENDING_FOR_SUBMISSION; } } //if future week else if (WeeksOfYearVm.WeekNumber > Convert.ToInt32(CurrentWeekNumber)) { isLastDayOfWeek = true; isSaveDisabled = isLastDayOfWeek; } }