示例#1
0
 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"));
 }
示例#2
0
 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));
 }
示例#3
0
 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));
 }
示例#4
0
 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));
         }
     }
 }
示例#5
0
        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);
        }
示例#6
0
 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 }));
     }
 }
示例#7
0
 public ActionResult Approve(Models.Timesheet.Timesheet timesheetVm)
 {
     _tsUtil.UpdateTimesheet(timesheetVm);
     _tsManager.SetState(timesheetVm.TimesheetId, TimesheetStatus.Approved);
     return(RedirectToAction("Index"));
 }
示例#8
0
 public ActionResult ReviewTimeSheet(int id)
 {
     Models.Timesheet.Timesheet tsViewModel = _tsUtil.GetTimeSheet(id);
     return(View(tsViewModel));
 }