public JsonResult ButtonSubmitEvent(ScanTimeApprovalCollection objItem, string Event) { var result = 0; var timesheetCollection = new TimesheetEntryCollection(); TimesheetApproveReject timesheetApproveReject = new TimesheetApproveReject(); foreach (ScanTimeApproval item in objItem) { if (item.isSelect == "on") { var timesheetEntry = new TimesheetEntry() { EmployeeCode = item.EmployeeCode, WorkDate = item.WorkDate, ManualIn = item.ManualIn, ManualOut = item.ManualOut, RequestorNote = item.RequestorNote, ApproverNote = item.ApproverNote, }; timesheetCollection.Add(timesheetEntry); } } switch (Event) { case "approve": timesheetApproveReject.IsApproved = true; break; case "reject": timesheetApproveReject.IsApproved = false; break; } timesheetApproveReject.TimesheetEntryCollection = timesheetCollection; timesheetApproveReject.UserLoggedIn = CurrentUser.EmployeeCode; if (timesheetCollection.Count > 0) { result = ScanTimeApprovalManager.Update(timesheetApproveReject); } return(Json(new { objItem, Event, result, JsonRequestBehavior.AllowGet })); }
public Timesheet() { _entries = new TimesheetEntryCollection(); }