public ActionResult AdapPortal() { String userId = Request["userId"]; String err = Request["error"]; if (!String.IsNullOrEmpty(err) && err.Equals("Not Approved")) { err = "New Applications cannot be created while an application is being processed."; } int uId; UAS.DataDTO.LoginStatus ls = SessionHelper.LoginStatus; if (String.IsNullOrEmpty(userId)) { uId = ls.UserID; } else { try { uId = Convert.ToInt32(userId); } catch (Exception ex) { uId = 0; Debug.WriteLine("Adap Controller AdapPortal exception:" + ex.Message); } } AuthenticationClient webclient = new AuthenticationClient(); UserDisplay ud = webclient.GetUserDisplay(uId); IQueryable <vFormResultUser> query = formsRepo.GetFormResultsWithSubjects(SessionHelper.LoginStatus.EnterpriseID, 6); int?soInt = formsRepo.GetStatusDetailByMasterIdentifier(1, "APPROVED").sortOrder; query = query.Where(q => (q.subject == uId) && (q.formStatus == soInt)); String recert; if (query.Count() > 0) { DateTime dob = Convert.ToDateTime(ud.DOB); recert = new Applications(formsRepo).GetRecert(dob, query.Count(), Convert.ToDateTime(query.OrderByDescending(q => q.statusChangeDate).Select(q => q.statusChangeDate).FirstOrDefault())).ToString("MMMM yyyy"); } else { recert = "None Pending"; } AdapPortal ap = new AdapPortal() { Name = ud.FirstName + " " + ud.LastName, RecertDate = recert, UserId = uId.ToString(), errorMsg = err, EnterpriseID = SessionHelper.LoginStatus.EnterpriseID }; return(View("~/Views/Templates/ADAP/AdapPortal.cshtml", ap)); }
public ActionResult AdapPortal() { //* * * OT 3-18-16 //create instance of the "base" Adap controller to reference its shared functions //these functions should be moved to adap domain so AdapController won't need to be referenced here AdapController adapCtrl = new AdapController(formsRepo); adapCtrl.ControllerContext = ControllerContext; String userId = Request["userId"]; String err = Request["error"]; if (!String.IsNullOrEmpty(err) && err.Equals("Not Approved")) { err = "New Applications cannot be created while an application is being processed."; } int uId; UAS.DataDTO.LoginStatus ls = SessionHelper.LoginStatus; if (String.IsNullOrEmpty(userId)) { uId = ls.UserID; } else { try { uId = Convert.ToInt32(userId); } catch (Exception ex) { uId = 0; Debug.WriteLine("Adap Controller AdapPortal exception:" + ex.Message); } } AuthenticationClient webclient = new AuthenticationClient(); UserDisplay ud = webclient.GetUserDisplay(uId); bool isCaseMgr = UAS.Business.UAS_Business_Functions.hasPermission(2, "RptsExpts"); // Case Manager permission if (isCaseMgr) { // Case Managers will no longer be creating apps for clients. //string clientUserId = Session["clientUserId"] as string; //if (clientUserId != null) //{ // try // { // int cuId = Int32.Parse(clientUserId); // if (cuId > 0) // { // Session["clientUserId"] = null; // return RedirectToAction("CreateAdapApplication", new { userId = cuId } ); // } // } // catch (Exception excptn) // { // Debug.WriteLine("* * * AdapPortal clientUserId exception: " + excptn.Message); // } //} // Check existing formResults to ensure each user is still assigned to this CM. CheckAndRemoveCaseManager(); } IQueryable <vFormResultUser> query = formsRepo.GetFormResultsWithSubjects(SessionHelper.LoginStatus.EnterpriseID, 6); int?soInt = formsRepo.GetStatusDetailByMasterIdentifier(1, "APPROVED").sortOrder; if (isCaseMgr) { query = query.Where(q => q.interviewer == uId); } else { query = query.Where(q => (q.subject == uId) && (q.formStatus == soInt)); } String recert = String.Empty; if (!isCaseMgr) { if (query.Count() > 0) { DateTime dob = Convert.ToDateTime(ud.DOB); recert = new Applications(formsRepo).GetRecert(dob, query.Count(), Convert.ToDateTime(query.OrderByDescending(q => q.statusChangeDate).Select(q => q.statusChangeDate).FirstOrDefault())).ToString("MMMM yyyy"); } else { recert = "None Pending"; } } AdapPortal ap = new AdapPortal() { Name = ud.FirstName + " " + ud.LastName, RecertDate = recert, UserId = uId.ToString(), errorMsg = err, EnterpriseID = SessionHelper.LoginStatus.EnterpriseID }; return(View("~/Views/LA_ADAP/LA_AdapPortal.cshtml", ap)); }