public ActionResult Reject(Models.Timesheet.Timesheet timesheetVm) { if (!string.IsNullOrEmpty(timesheetVm.ApprovalNotes)) { _tsManager.SetApprovalNotes(timesheetVm.TimesheetId, timesheetVm.ApprovalNotes); } _tsManager.SetState(timesheetVm.TimesheetId, TimesheetStatus.Rejected); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { if (TempData["saved"] != null) { ViewBag.SuccessMessage = "Timesheet Saved"; TempData.Remove("saved"); } Models.Timesheet.Timesheet tsViewModel = _tsUtil.GetTimeSheet(id); return(View(tsViewModel)); }
public ActionResult Details(int id) { if (TempData["submitted"] != null) { ViewBag.SuccessMessage = "Timesheet Submitted"; TempData.Remove("submitted"); } Models.Timesheet.Timesheet timesheetVM = Mapper.Map <Models.Timesheet.Timesheet>(_tsManager.GetTimeSheet(id)); return(View(timesheetVM)); }
public void UpdateTimesheet(Models.Timesheet.Timesheet timesheetVm) { foreach (var timeEntryVm in timesheetVm.TimeEntries) { if (timeEntryVm.EntryId == 0) { _tsManager.AddTimeEntry(timesheetVm.TimesheetId, timeEntryVm.ProjectId, timeEntryVm.WorkTypeId, BuildDailyTime(timeEntryVm)); } else { _tsManager.UpdateTimeEntry(timeEntryVm.EntryId, timeEntryVm.ProjectId, timeEntryVm.WorkTypeId, BuildDailyTime(timeEntryVm)); } } }
public Models.Timesheet.Timesheet GetTimeSheet(int id) { TimeSheet timesheet = _tsManager.GetTimeSheet(id); Models.Timesheet.Timesheet tsViewModel = _mapper.Map <Models.Timesheet.Timesheet>(timesheet); List <Models.Project.Project> projectList = BuildProjectList(); List <Models.Timesheet.WorkType> workTypes = BuildWorkTypes(); tsViewModel.TimeEntries.ForEach(i => { i.Projects = new SelectList(projectList, "ProjectId", "ProjectName", i.ProjectId); i.WorkTypes = new SelectList(workTypes, "WorkTypeId", "WorkTypeName", i.WorkTypeId); }); return(tsViewModel); }
public ActionResult Edit(Models.Timesheet.Timesheet timesheetVm) { _tsUtil.UpdateTimesheet(timesheetVm); if (timesheetVm.SubmitForApproval) { _tsManager.SetState(timesheetVm.TimesheetId, TimesheetStatus.Submitted, timesheetVm.Notes); TempData["submitted"] = true; return(RedirectToAction("Details", new { id = timesheetVm.TimesheetId })); } else { TempData["saved"] = true; return(RedirectToAction("Edit", new { id = timesheetVm.TimesheetId })); } }
public ActionResult Approve(Models.Timesheet.Timesheet timesheetVm) { _tsUtil.UpdateTimesheet(timesheetVm); _tsManager.SetState(timesheetVm.TimesheetId, TimesheetStatus.Approved); return(RedirectToAction("Index")); }
public ActionResult ReviewTimeSheet(int id) { Models.Timesheet.Timesheet tsViewModel = _tsUtil.GetTimeSheet(id); return(View(tsViewModel)); }