public ActionResult SubmitReqSupervisor() { try { sc.CheckSecurity(AppRoles.All, Session[SessionName.UserName.ToString()].ToString()); } catch { return(RedirectToAction("Login", "Home")); } string MasterReqID = Session[SessionName.MReqID.ToString()].ToString(); string SupID = string.Empty; MasterRequisition mReq = masterRepository.GetMasterRequisitionByID(MasterReqID); List <ReqDetail> reqDet = reqDetRepository.GetRequisitionsByMasterReqID(MasterReqID); Requisitioner reqr = reqRepository.GetRequisitionerByUserName(Session[SessionName.UserName.ToString()].ToString()); foreach (ReqDetail req in reqDet) { Approval routeApproval = new Approval(); routeApproval.RequisitionNumber = Convert.ToInt32(req.RequestID.ToString()); routeApproval.SupervisorID = GetRequisitionerManager(reqr.ID); routeApproval.Level = 1; routeApproval.Pass = 1; routeApproval.Status = "P"; routeApproval.SubmittedUserName = reqr.UserName; Int32 returnValue = approvalRepository.InsertApprovalRoute(routeApproval); SupID = routeApproval.SupervisorID; } SendEmailNotice(SupID, reqDet, MasterReqID, mReq.Description1); return(RedirectToAction("Index", "Home")); }