Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        // *** RRB 2/6/16 - refactor UAS code out
        public List <def_FormResults> GetFormResultsByIvIdentifierAndValueFilterByAccess(UAS.DataDTO.LoginStatus loginStatus, string ivIdentifier, string rvValue)
        {
            List <int> authorizedGroups = loginStatus.appGroupPermissions[0].authorizedGroups;

            var formResults = from fr in db.def_FormResults
                              join ir in db.def_ItemResults on fr.formResultId equals ir.formResultId
                              join rv in db.def_ResponseVariables on ir.itemResultId equals rv.itemResultId
                              join iv in db.def_ItemVariables on rv.itemVariableId equals iv.itemVariableId
                              where iv.identifier == ivIdentifier && rv.rspValue == rvValue &&
                              (authorizedGroups.Contains(0) ||
                               authorizedGroups.Contains(fr.GroupID.Value) ||
                               loginStatus.UserID == fr.assigned)
                              select fr;

            return(formResults.ToList());
        }
Exemplo n.º 3
0
        public List <def_FormResults> GetAssessmentsByTrackingNumberFilterByAccess(UAS.DataDTO.LoginStatus loginStatus, string trackingNum)
        {
            List <def_FormResults> assessments = formsRepo.GetFormResultsByIvIdentifierAndValueFilterByAccess(loginStatus, "sis_track_num", trackingNum);

            return(assessments);
        }
Exemplo n.º 4
0
        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));
        }