コード例 #1
0
        public ActionResult Validate(FormCollection frmCllctn, TemplateItems ti)
        {
            //save response from formCollection into the DB
            ResultsController rc = new ResultsController(formsRepo);

            rc.ControllerContext = ControllerContext;
            rc.Save(frmCllctn, ti);

            int formResultId = SessionHelper.SessionForm.formResultId;

            SessionHelper.SessionForm.sectionId = -1;

            //Run generic validation
            AdapValidationErrorsModel model = new AdapValidationErrorsModel();

            model.navMenuModel       = AJBoggs.Adap.Templates.TemplateMenus.getAdapNavMenuModel(SessionHelper.SessionForm, formsRepo);
            model.validationMessages = new List <string>();
            model.missingItemVariablesBySectionByPart = new Dictionary <int, Dictionary <int, List <string> > >();
            def_Forms        frm          = formsRepo.GetFormById(SessionHelper.SessionForm.formId);
            List <ValuePair> allResponses = CommonExport.GetDataByFormResultId(formResultId);
            SharedValidation sv           = new SharedValidation(allResponses);
            bool             invalid      = sv.DoGenericValidation(formsRepo, model, frm);

            //transfer generic validation results to an ADAP-specific model
            model.titlesOfMissingSubsectionsBySectionByPart = new Dictionary <int, Dictionary <int, List <string> > >();
            foreach (int prtId in model.missingItemVariablesBySectionByPart.Keys)
            {
                model.titlesOfMissingSubsectionsBySectionByPart.Add(prtId, new Dictionary <int, List <string> >());
                foreach (int sctId in model.missingItemVariablesBySectionByPart[prtId].Keys)
                {
                    def_Sections sct = formsRepo.GetSectionById(sctId);
                    formsRepo.SortSectionItems(sct);
                    List <int> ssSectionIds = new List <int>();
                    foreach (def_SectionItems si in sct.def_SectionItems.Where(si => si.subSectionId.HasValue))
                    {
                        ssSectionIds.Add(formsRepo.GetSubSectionById(si.subSectionId.Value).sectionId);
                    }

                    model.titlesOfMissingSubsectionsBySectionByPart[prtId].Add(sctId, new List <string>());
                    foreach (string itemVariableIdent in model.missingItemVariablesBySectionByPart[prtId][sctId])
                    {
                        //for each item variable identifier returned by generic validation,
                        //lookup the corresponding subsection's title for display on the ADAP "validation errors" screen
                        def_ItemVariables iv  = formsRepo.GetItemVariableByIdentifier(itemVariableIdent);
                        def_Items         itm = iv == null ? null : iv.def_Items;
                        def_SectionItems  si  = itm == null ? null : formsRepo.getSectionItemsForItem(itm).Where(sit => ssSectionIds.Contains(sit.sectionId)).FirstOrDefault();
                        def_Sections      sub = si == null ? null : si.def_Sections;
                        if (sub != null && !model.titlesOfMissingSubsectionsBySectionByPart[prtId][sctId].Contains(sub.title))
                        {
                            model.titlesOfMissingSubsectionsBySectionByPart[prtId][sctId].Add(sub.title);
                        }
                    }
                }
            }

            //run CO-ADAP one-off validation
            if (AdapCOOneOffValidation.RunOneOffValidation(sv, model))
            {
                invalid = true;
            }

            //return the validation errors screen if any errors were found
            //model.validationMessages could have some warnings even if no errors were found, in which case "invalid" would be false here
            if (invalid)
            {
                return(View("~/Views/COADAP/ValidationErrors.cshtml", model));
            }

            //if no problems were found, or if warnings were found but no errors, return the next section in the application
            if (model.validationMessages.Count == 0)
            {
                model.validationMessages.Add("No errors were found");
            }
            int sectionId = Convert.ToInt16(frmCllctn["navSectionId"]);

            return(rc.Template(sectionId, model.validationMessages));
        }
コード例 #2
0
        /// <summary>
        /// Used by COADAPController.Validate()
        ///
        /// Runs the hard-coded validation rules, which can't be encoded into meta-data, for the CO-ADAP application.
        ///
        /// adds to the model's validation messages for any validation errors or warnings.
        /// </summary>
        /// <param name="sv"></param>
        /// <param name="model"></param>
        /// <returns>true if any validation ERRORS where found, false if nothin (or only wanrings) found</returns>

        public static bool RunOneOffValidation(IFormsRepository formsRepo, SharedValidation sv, AdapValidationErrorsModel model)
        {
            bool invalid = false;

            #region Contact Information

            //5. What is your Social Security Number?
            if (sv.HasPositiveResponse("C1_MemberHasSSN") && !sv.HasAnyResponse("C1_MemberSocSecNumber"))
            {
                invalid = true;
                model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 2, "CA-ADAP-Contact",
                                                       "You must enter your SSN or indicate that you do not have a SSN"));
            }
            //if (!sv.HasPositiveResponse("C1_MemberHasSSN"))
            //{
            //    invalid = true;
            //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 2, "CA-ADAP-Contact-2_sub",
            //             "You must select SSN field"));
            //}
            if (sv.HasPositiveResponse("C1_AddressHomeless"))
            {
                if (sv.GetResponseInt("C1_ResidentialAddressMayContact") != 3)
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                           "You selected Check this box if you are homeless. You must also select No, my enrollment site will receive information on my behalf for the question May we contact you at this address?"));
                }
            }
            else if (!sv.HasPositiveResponse("C1_AddressHomeless"))
            {
                if (sv.GetResponseInt("C1_ResidentialAddressMayContact") == 2)
                {
                    if (!sv.HasAnyResponse("C1_MailingAddressLine1"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Mailing Address"));
                    }
                    if (!sv.HasAnyResponse("C1_MailingAddressCity"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Mailing Address City"));
                    }
                    if (!sv.HasAnyResponse("C1_MailingAddressState"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Mailing Address State"));
                    }
                    if (!sv.HasAnyResponse("C1_MailingAddressZIP"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Mailing Address Zip Code"));
                    }
                }
                else if (sv.GetResponseInt("C1_ResidentialAddressMayContact") == 1)
                {
                    if (!sv.HasAnyResponse("C1_ResidentialAddressLine1"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Residential Address"));
                    }
                    if (!sv.HasAnyResponse("C1_ResidentialAddressCity"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Residential Address City"));
                    }
                    if (!sv.HasAnyResponse("C1_ResidentialAddressState"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Residential Address State"));
                    }
                    if (!sv.HasAnyResponse("C1_ResidentialAddressZIP"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                               "Please Enter Residential Address Zip Code"));
                    }
                }
                else if (sv.GetResponseInt("C1_ResidentialAddressMayContact") == 3)
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                                                           "Please check the Homeless box"));
                }
                else
                {
                    invalid = true;
                    model.validationMessages.Add("Contact Information:C3.Addresses: Please answer the question May we contact you at this address?");

                    //model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 3, "CA-ADAP-Contact-3_sub",
                    //         "Please select 'No, my enrollment site will receive information on my behalf'"));
                }
            }
            //if (!sv.HasAnyResponse("C1_DaytimePhoneNumber"))
            //{
            //    invalid = true;
            //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Contact", 5, "CA-ADAP-Contact-5_sub",
            //             "Please Enter Your Phone Number"));
            //}

            #endregion

            #region Health Coverage

            //If Response is Yes on Radiobutton on HC3

            if (sv.HasPositiveResponse("C1_ACAStateExchgEnroll"))
            {
                //C1_OtherInsuranceProvider
                //C1_OtherInsuranceMemberID2
                //C1_OtherInsuranceEffDate

                //if (!sv.HasAnyResponse("C1_OtherInsuranceProvider"))
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                //       "Please Enter Health Insurance Plan Name"));
                //}

                if (!sv.HasAnyResponse("C1_OtherInsuranceMemberID2"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                           "Please Enter Insurance Member ID"));
                }

                if (!sv.HasAnyResponse("C1_OtherInsuranceEffDate"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                           "Please Enter Effective Start Date"));
                }
            }
            else if (!sv.HasPositiveResponse("C1_ACAStateExchgEnroll") && sv.HasPositiveResponse("C1_OtherInsuranceEnroll"))
            {
                if (sv.GetResponseInt("C1_OtherInsuranceEnroll") == 2)
                {
                    if (!sv.HasAnyResponse("C1_NoInsurnaceDescription"))
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                               "Please Explain"));
                    }
                }
                else
                {
                    if (sv.GetResponseInt("C1_OtherInsuranceType") == -1)
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                               "Please select 'If yes, what health insurance coverage do you have?'"));
                    }


                    else if (sv.GetResponseInt("C1_OtherInsuranceType") == 1 || sv.GetResponseInt("C1_OtherInsuranceType") == 2 || sv.GetResponseInt("C1_OtherInsuranceType") == 3 || sv.GetResponseInt("C1_OtherInsuranceType") == 5 || sv.GetResponseInt("C1_OtherInsuranceType") == 7)
                    {
                        if (!sv.HasAnyResponse("C1_OtherInsuranceProvider"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                                   "Please Enter Name of health Insurance Plan"));
                        }
                        if (!sv.HasAnyResponse("C1_OtherInsurancePlanID"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                                   "Please Enter Policy number"));
                        }
                        if (!sv.HasAnyResponse("C1_OtherInsuranceMemberID2"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                                   "Please Enter Insurance Member ID Number"));
                        }
                        if (!sv.HasAnyResponse("C1_OtherInsuranceEffDate"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                                   "Please Enter Effective Start Date"));
                        }

                        //if (!sv.HasAnyResponse("C1_OtherInsuranceEndDate"))
                        //{
                        //    invalid = true;
                        //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                        //             "Please Enter Effective End Date"));
                        //}
                    }
                    if (sv.GetResponseInt("C1_OtherInsuranceType") == 4)
                    {
                        if (!sv.HasAnyResponse("C1_OtherInsuranceEffDate"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 3, "CA-ADAP-Insurance-3_sub",
                                                                   "Please Enter Effective Date"));
                        }
                    }
                }
            }
            else if (sv.HasPositiveResponse("C1_MedicareEligible") && sv.HasPositiveResponse("C1_MedicarePartDEnroll"))
            {
                if (!sv.HasAnyResponse("C1_MedicarePartDEffDate"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 2, "CA-ADAP-Insurance-2_sub",
                                                           "Please Enter Part D Eligibility Effective Date"));
                }
                //Commented required fields for now
                //if (!sv.HasAnyResponse("C1_MedicarePartDEnrollDate"))//Can be used if needed again for magellan
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 2, "CA-ADAP-Insurance-2_sub",
                //             "Please Enter Part D Enrollment Effective Date"));
                //}
                //if (!sv.HasAnyResponse("C1_MedicarePartDIdNumber"))
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 2, "CA-ADAP-Insurance-2_sub",
                //             "Please Enter What is your Medicare Health Insurance Claim (HIC) Number?"));
                //}
                //if (!sv.HasAnyResponse("C1_MedicarePartDPlanName"))
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 2, "CA-ADAP-Insurance-2_sub",
                //             "Please Enter What is the name of the Medicare Part D plan?"));
                //}
            }
            else if (sv.HasPositiveResponse("C1_MedicareEligible") && !sv.HasPositiveResponse("C1_MedicarePartDEnroll"))
            {
                invalid = true;
                model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 2, "CA-ADAP-Insurance-2_sub",
                                                       "Please check Medicare Part D (Prescription Drug Coverage) in order to get your medical benefits"));
            }
            else if (sv.GetResponseInt("C1_StateMedicaidEnrolled") == 0)
            {
                //if (!sv.HasAnyResponse("C1_StateMedicaidMemberId"))//Required field can be used if needed for magellan again
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 1, "CA-ADAP-Insurance-1_sub",
                //             "Please Enter your Medi-Cal Benefits Identification Card (BIC) Number"));
                //}

                if (!sv.HasAnyResponse("C1_StateMAidEffDate"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 1, "CA-ADAP-Insurance-1_sub",
                                                           "Please Enter your Medi-Cal Effective Date"));
                }
            }
            else
            {
                invalid = true;
                model.validationMessages.Add("<p>Health Coverage: 'HC1: You must answer HC1'</p><p>Health Coverage:'HC2: You must answer HC2'</p><p>Health Coverage:'HC3: If you do not have health insurance through a Covered CA plan, then you must indicate if you are enrolled in a different health insurance plan or if you do not have any insurance.'</p>");
                //model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 1, "CA-ADAP-Insurance-1_sub",
                //         "Please select any one of the condition 'Medi-Cal Coverage/Medicare Coverage/Private Insurance Coverage' in Health Coverage"));
            }

            #endregion

            #region Insurance Assistance

            if (sv.GetResponseInt("C1_MemberRequestsHIPP3") == -1)
            {
                invalid = true;
                model.validationMessages.Add("Insurance Assistance: Please select one of the options from 'Would you like to receive assistance with your premium payments?'");
                //model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-Insurance", 1, "CA-ADAP-Insurance-1_sub",
                //         "Please select any one of the condition 'Medi-Cal Coverage/Medicare Coverage/Private Insurance Coverage' in Health Coverage"));
            }
            else if (sv.GetResponseInt("C1_MemberRequestsHIPP3") == 1)
            {
                if (sv.HasPositiveResponse("C1_MemberHIPPEnrollPgm1"))
                {
                    if (sv.GetResponseInt("C1_MemberMedicalPlanType") == -1)
                    {
                        invalid = true;
                        model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                               "Please select 'What type of coverage is this medical plan?"));
                    }
                    if (sv.GetResponseInt("C1_MemberMedicalPlanType") == 0)
                    {
                        if (sv.GetResponseInt("C1_CoveredCAMedicalPlanType") == -1)
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please select 'What Covered CA metal tier did you select?"));
                        }
                        if (!sv.HasAnyResponse("C1_CoveredCAAPTCAmount"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter If eligible, you are required to take the maximum Advanced Premium Tax Credit (APTC) offered by Covered CA. Please enter the amount of APTC you received."));
                        }


                        if (!sv.HasAnyResponse("C1_CoveredCAMedicalPayee"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter What is the name of your health insurance plan?"));
                        }
                        if (!sv.HasAnyResponse("C1_MemberMedicalPlanSubscriberID"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter What is your Member or Subscriber ID?"));
                        }
                        if (!sv.HasAnyResponse("C1_CoveredCAPlanStartDate"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter When did your medical plan start?"));
                        }
                        if (!sv.HasAnyResponse("C1_CoveredCAPremiumAfterAPTC"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter What is your net premium amount?"));
                        }
                        if (sv.GetResponseInt("C1_CoveredCAPremiumDue") == -1)
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please select How often is your premium due?"));
                        }
                        if (!sv.HasAnyResponse("C1_CoveredCABillingDoc"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Upload file in Click BROWSE to attach a copy of your most recent medical plan billing statement."));
                        }
                    }



                    //if (!sv.HasAnyResponse("C1_CoveredCAProjectedStartHIPPDate"))
                    //{
                    //    invalid = true;
                    //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                    //             "Please Enter 'Premium payments begin on the month the complete application was submitted and approved. You will need to continue making payments until you are notified of your eligibility for premium payment assistance. Once approved, the payment start date will be listed here.'"));
                    //}

                    //private,CobrA,Cal-Cobra,other
                    else if (sv.GetResponseInt("C1_MemberMedicalPlanType") == 1 || sv.GetResponseInt("C1_MemberMedicalPlanType") == 2 || sv.GetResponseInt("C1_MemberMedicalPlanType") == 3 || sv.GetResponseInt("C1_MemberMedicalPlanType") == 4)
                    {
                        if (!sv.HasAnyResponse("C1_PrivateMedicalPayee"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter What is the name of your health insurance plan?"));
                        }
                        if (!sv.HasAnyResponse("C1_MemberMedicalPlanSubscriberID"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter What is your Member or Subscriber ID?"));
                        }
                        if (!sv.HasAnyResponse("C1_MemberMedicalPlanStartDate"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter When did your medical plan start?"));
                        }
                        if (!sv.HasAnyResponse("C1_MemberMedicalNetPremium"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Enter What is your net premium amount?"));
                        }
                        if (sv.GetResponseInt("C1_MemberMedicalPremiumFreqDue") == -1)
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please select How often is your premium due?"));
                        }
                        if (!sv.HasAnyResponse("C1_NonCoveredCABillingDoc"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 2, "CA-ADAP-InsAssist-2_sub",
                                                                   "Please Upload file in Click BROWSE to attach a copy of your most recent medical plan billing statement."));
                        }
                    }

                    //Cobra
                    //Cal-CObra
                    //OTHER
                }
                if (sv.HasPositiveResponse("C1_MemberHIPPEnrollPgm2"))
                {
                    if (sv.GetResponseInt("C1_MemberDentalPlanIncluded") == -1)
                    {
                        invalid = true;
                        model.validationMessages.Add("Insurance Assistance: Please select 'You indicated you would also like dental premium payment assistance. Was this dental plan purchased separately or is it included with your medical?'");
                    }
                    else if (sv.GetResponseInt("C1_MemberDentalPlanIncluded") == 0)
                    {
                        if (!sv.HasAnyResponse("C1_DentalPayee"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 3, "CA-ADAP-InsAssist-3_sub",
                                                                   "Please Enter What is the name of your health insurance plan?"));
                        }
                        if (!sv.HasAnyResponse("C1_MemberDentalPlanSubscriberID"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 3, "CA-ADAP-InsAssist-3_sub",
                                                                   "Please Enter What is your Member or Subscriber ID?"));
                        }
                        if (!sv.HasAnyResponse("C1_DentalPlanStartDate"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 3, "CA-ADAP-InsAssist-3_sub",
                                                                   "Please Enter When did your medical plan start?"));
                        }
                        if (!sv.HasAnyResponse("C1_DentalPremium"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 3, "CA-ADAP-InsAssist-3_sub",
                                                                   "Please Enter What is your net premium amount?"));
                        }
                        if (sv.GetResponseInt("C1_MemberDentalPremiumFreqDue") == -1)
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 3, "CA-ADAP-InsAssist-3_sub",
                                                                   "Please select How often is your premium due?"));
                        }
                        if (!sv.HasAnyResponse("C1_DentalBillingDoc"))
                        {
                            invalid = true;
                            model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 3, "CA-ADAP-InsAssist-3_sub",
                                                                   "Please Upload file in Click BROWSE to and attach a copy of your most recent dental billing statement."));
                        }
                        //if (!sv.HasAnyResponse("C1_DentalProjectedStartHIPPDate"))
                        //{
                        //    invalid = true;
                        //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 3, "CA-ADAP-InsAssist-3_sub",
                        //             "Please Enter 'Premium payments begin on the month the complete application was submitted and approved. You will need to continue making payments until you are notified of your eligibility for premium payment assistance. Once approved, your payments will start the same day as your medical plan premium payment assistance.'"));
                        //}
                    }
                }
                if (!sv.HasPositiveResponse("C1_MemberHIPPEnrollPgm1") && !sv.HasPositiveResponse("C1_MemberHIPPEnrollPgm2") && !sv.HasPositiveResponse("C1_MemberHIPPEnrollPgm3"))
                {
                    invalid = true;
                    model.validationMessages.Add("Insurance Assistance: Please select What type of health insurance premium plan assistance do you need?");
                }
            }
            else if (sv.GetResponseInt("C1_MemberRequestsHIPP3") == 2)
            {
                if (!sv.HasAnyResponse("C1_MemberMedicareDSubscriberID"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                                                           "Please Enter What is your Member or Subscriber ID?"));
                }
                if (!sv.HasAnyResponse("C1_MedicareDStartDate"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                                                           "Please Enter When did your Medicare Part D plan start?"));
                }
                if (!sv.HasAnyResponse("C1_MedicareDPremium"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                                                           "Please Enter What is your Medicare Part D premium amount excluding any fees"));
                }
                if (sv.GetResponseInt("C1_MedicareDPremiumFreqDue") == -1)
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                                                           "Please select How often is your Medicare Part D plan premium due?"));
                }
                if (!sv.HasAnyResponse("C1_MedicareDBillingDoc"))
                {
                    invalid = true;
                    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                                                           "Please Upload file If available, click BROWSE to attach the most recent copy of your Medicare Part D health insurance billing statement. Note: ADAP must send payments directly to Medicare Part D plans and will not pay for any fees (e.g. late fees, penalties)."));
                }
                //if (!sv.HasAnyResponse("C1_MedicareDProjectedStartHIPPDate"))
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                //             "Please Enter 'Premium payments begin on the month the complete application was submitted and approved. You will need to continue making payments until you are notified of your eligibility for premium payment assistance. Once approved, your payments will start:'"));
                //}

                //if (!sv.HasAnyResponse("C1_MedicareDBillingDoc"))
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                //             "Please Upload file in 'If available, click BROWSE to attach the most recent copy of your Medicare Part D health insurance billing statement. Note: ADAP must send payments directly to Medicare Part D plans and will not pay for any fees (e.g. late fees, penalties).'"));
                //}
                //if (!sv.HasAnyResponse("C1_MedicareDProjectedStartHIPPDate"))
                //{
                //    invalid = true;
                //    model.validationMessages.Add(valErrMsg(formsRepo, "CA-ADAP-InsuranceAssistance", 6, "CA-ADAP-InsAssist-6_sub",
                //             "Please Enter 'Premium payments begin on the month the complete application was submitted and approved. You will need to continue making payments until you are notified of your eligibility for premium payment assistance. Once approved, your payments will start:'"));
                //}
            }
            #endregion


            return(invalid);
        }
コード例 #3
0
        /// <summary>
        /// Used by COADAPController.Validate()
        ///
        /// Runs the hard-coded validation rules, which can't be encoded into meta-data, for the CO-ADAP application.
        ///
        /// adds to the model's validation messages for any validation errors or warnings.
        /// </summary>
        /// <param name="sv"></param>
        /// <param name="model"></param>
        /// <returns>true if any validation ERRORS where found, false if nothin (or only wanrings) found</returns>
        public static bool RunOneOffValidation(SharedValidation sv, AdapValidationErrorsModel model)
        {
            bool invalid = false;

            #region other validation (errors)

            #region Demographic Info
            //at least one of the D3 checkboxes must be checked
            if (!sv.AnyPositiveResponses(
                    "ADAP_D3_White", "ADAP_D3_Native", "ADAP_D3_Asian", /*"ADAP_D3_NA",*/ "ADAP_D3_Black", "ADAP_D3_Indian" /*, "ADAP_D3_Other"*/))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.DemographicInfo + ": " + Resources.Validation.MustCheckOneUnderSection_ + " D3");
            }

            //if Hispanic/Latino (a), at least on D4 checkbox must be checked
            if (sv.HasExactResponse("ADAP_D4_EthnicDrop", "1") && !sv.AnyPositiveResponses(
                    "ADAP_D4_Mexican", "ADAP_D4_Puerto", /*"ADAP_D4_NA",*/ "ADAP_D4_Cuban", "ADAP_D4_Other" /*, "ADAP_D4_Unknown"*/))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.DemographicInfo +
                                             " D4: " + Resources.Validation.SinceHispanic_ + Resources.Validation.MustCheckOneUnderSection_ + " D4");
            }

            //D5
            if (sv.HasPositiveResponse("ADAP_D3_Asian") && !sv.AnyPositiveResponses(
                    "ADAP_D5_Indian", "ADAP_D5_Filipino", "ADAP_D5_Korean", "ADAP_D5_Other",
                    "ADAP_D5_Chinese", "ADAP_D5_Japanese", "ADAP_D5_Vietnamese", "ADAP_D5_NA"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.DemographicInfo +
                                             " D5: " + Resources.Validation.SinceAsian_ + Resources.Validation.MustCheckOneUnderSection_ + " D5");
            }

            //D6
            if (sv.HasPositiveResponse("ADAP_D3_Native") && !sv.AnyPositiveResponses(
                    "ADAP_D6_Native", "ADAP_D6_Guam", "ADAP_D6_Samoan", "ADAP_D6_Other", "ADAP_D6_NA"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.DemographicInfo +
                                             " D6: " + Resources.Validation.SinceIslander_ + Resources.Validation.MustCheckOneUnderSection_ + " D6");
            }

            //D7
            if (sv.HasExactResponse("ADAP_D7_LangDrop", "17") && !sv.HasAnyResponse("ADAP_D7_LangOther"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.DemographicInfo +
                                             " D7: " + Resources.Validation.MustExplainOtherLang);
            }

            //D9
            //If the Ramsell ID is a thing but not a positive (or, for that matter, any numeric) response...
            //ASSUMES The entry is "_" where it is not numeric.
            if (sv.HasAnyResponse("ADAP_D9_Ramsell") && !sv.HasPositiveResponse("ADAP_D9_Ramsell"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.DemographicInfo +
                                             " D9: " + Resources.Validation.RamsellID11Digits);
            }

            #endregion

            #region Contact Info

            //C2
            if (!sv.HasExactResponse("ADAP_C2_SameAsMailing", "1") && !sv.AllComplete(
                    "ADAP_C2_Address", "ADAP_C2_MayContactYN", "ADAP_C2_City", "ADAP_C2_State", "ADAP_C2_Zip", "ADAP_C2_County"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.ContactInfo +
                                             ": " + Resources.Validation.SinceMailNotResid_ + " " + Resources.Validation.MustCompleteAllFieldsUnder_ + " C2.");
            }

            //C4
            if (sv.HasExactResponse("ADAP_C4_MayCallYN", "1") && !sv.AllComplete(
                    "ADAP_C4_Name", "ADAP_C4_Phone", "ADAP_C4_KnowHivYN"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.ContactInfo +
                                             ": " + Resources.Validation.SinceYesUnder_ + " C4, " + Resources.Validation.MustCompleteAllFieldsUnder_ + " C4");
            }

            //C5
            if (sv.HasExactResponse("ADAP_C5_HasCaseMngrYN", "1") && !sv.AllComplete(
                    "ADAP_C5_Mngr1_Name" /*, "ADAP_C5_Mngr1_Clinic", "ADAP_C5_Mngr2_Name", "ADAP_C5_Mngr2_Clinic"*/))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.ContactInfo +
                                             ": " + Resources.Validation.SinceYesUnder_ + " C5, " + Resources.Validation.MustEnterCaseWorker);
            }

            #endregion

            #region Medical (currently empty)

            #endregion

            #region Health Insurance

            //I2 invoice uploads
            if (sv.HasExactResponse("ADAP_I2_AffCareOpt", "0") &&
                sv.HasPositiveResponse("ADAP_I2_InvoiceYN") &&
                !sv.HasAnyResponse("ADAP_I2_Invoice"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.Insurance + " I2: " + Resources.Validation.CheckedYesButNoInvoice);
            }

            //I3 invoice uploads
            if (sv.HasExactResponse("ADAP_I3_MedicareYN", "1") &&
                sv.HasPositiveResponse("ADAP_I3_InvoiceYN") &&
                !sv.HasAnyResponse("ADAP_I3_Invoice"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.Insurance + " I3: " + Resources.Validation.CheckedYesButNoInvoice);
            }

            //I3
            if (sv.HasExactResponse("ADAP_I3_MedicareYN", "1"))
            {
                bool partA = sv.HasExactResponse("ADAP_I3_PartAYN", "1");
                bool partB = sv.HasExactResponse("ADAP_I3_PartBYN", "1");

                if (!partA && !partB)
                {
                    invalid = true;
                    model.validationMessages.Add(Resources.AdapAppNavMenu.Insurance
                                                 + " I3: " + Resources.Validation.SinceMedicareMustCheckAOrB);
                }
            }

            //I4 (if "other" is selected, require explaination)
            if (sv.HasExactResponse("ADAP_I4_InsSourceOpt", "4"))
            {
                if (!sv.HasAnyResponse("ADAP_I4_InsSourceOther"))
                {
                    invalid = true;
                    model.validationMessages.Add(Resources.AdapAppNavMenu.Insurance
                                                 + " I4: " + Resources.Validation.MustExplainOther);
                }
            }

            #endregion

            #region Household

            //H2
            if (sv.HasExactResponse("ADAP_H2_RelnDrop", "0") && !sv.HasAnyResponse("ADAP_H2_RelnOther"))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.Household +
                                             " H2: " + Resources.Validation.MustExplainOther);
            }

            //H3
            int statusRsp = sv.GetResponseInt("ADAP_H3_FileTaxYN");
            if (((statusRsp == 1) && !sv.AllComplete("ADAP_H3_TaxStatusOpt", "ADAP_H3_TaxDependants")) ||
                ((statusRsp == 0) && !sv.AllComplete("ADAP_H3_TaxNotFileOpt", "ADAP_H3_Relatives")))
            {
                invalid = true;
                model.validationMessages.Add(Resources.AdapAppNavMenu.Household +
                                             " H3: " + Resources.Validation.MustCompleteAllFieldsUnder_ + " H3");
            }

            //H5
            //if (hasExactResponse("ADAP_D8_CurrGenderDrop", "2", formResultId ) ){
            //    if(!hasAnyResponse( "ADAP_H5_PregnantOpt", formResultId ) )
            //    {
            //        invalid = true;
            //        amt.validationMessages.Add("Since you are female, you must indicate whether or not you are pregnant under H5");
            //    }
            //    if (hasExactResponse("ADAP_H5_PregnantOpt", "1", formResultId) && !hasAnyResponse("ADAP_H5_PregnantDue", formResultId))
            //    {
            //        invalid = true;
            //        amt.validationMessages.Add("H5: since you indicated that you are pregnant, you must enter a due date.");
            //    }
            //}

            #endregion

            #region Household Income

            //F1, F2
            int employOptRsp = sv.GetResponseInt("ADAP_F1_EmployOpt");
            //if ((employOptRsp == 7) && !sv.HasAnyResponse("ADAP_F1_EmployOther"))
            //{
            //    invalid = true;
            //    model.validationMessages.Add(Resources.AdapAppNavMenu.HouseholdIncome +
            //        " F1: " + Resources.Validation.SinceEmpOtherMustSpecify );
            //}

            if ((employOptRsp == 4) || (employOptRsp == 5) || (employOptRsp == 6))
            {
                if (!sv.HasAnyResponse("ADAP_F1_EmployerInsOpt"))
                {
                    invalid = true;
                    model.validationMessages.Add(Resources.AdapAppNavMenu.HouseholdIncome +
                                                 " F1: " + Resources.Validation.SinceHaveEmp_ + ", " + Resources.Validation.MustSelectEmployerInsOpt);
                }
                else if (sv.HasExactResponse("ADAP_F1_EmployerInsOpt", "4") && !sv.HasAnyResponse("ADAP_F1_EmployNotEnrolled"))
                {
                    invalid = true;
                    model.validationMessages.Add(Resources.AdapAppNavMenu.HouseholdIncome +
                                                 " F1: " + Resources.Validation.NeeedReasonNotEnrolledEmpIns);
                }

                if (!sv.HasAnyResponse("ADAP_F2_EmployLast90YN"))
                {
                    invalid = true;
                    model.validationMessages.Add(Resources.AdapAppNavMenu.HouseholdIncome +
                                                 " F2: " + Resources.Validation.SinceHaveEmp_ + ", " + Resources.Validation.YouMustComplete_ + " F2.");
                }
            }

            //F3

            //iterate through each of teh "proof of income #x" sections
            for (int proofSectionIndex = 1; proofSectionIndex <= 4; proofSectionIndex++)
            {
                string letter  = "ABCD".Substring(proofSectionIndex - 1, 1);
                string prefix  = "ADAP_F3_" + letter + "_";
                int    typeRsp = sv.GetResponseInt(prefix + "IncomeTypeDrop");

                //if income type "other" was selected, but no explaination provided...
                if ((typeRsp == 14) && !sv.HasAnyResponse(prefix + "IncomeTypeOther"))
                {
                    invalid = true;
                    model.validationMessages.Add(Resources.AdapAppNavMenu.HouseholdIncome + " F3 ("
                                                 + Resources.Validation.ProofOfIncome + " #" + proofSectionIndex + "): "
                                                 + Resources.Validation.SinceIncomOtherMustSpecify);
                }

                //if employed and enrolled in employer insurance...
                if (typeRsp == 0 && sv.HasExactResponse("ADAP_F1_EmployerInsOpt", "1"))
                {
                    //if there are any missing responses in this "proof of income #X" section...
                    if (!sv.AllComplete(
                            prefix + "Employer", prefix + "EmployStart", prefix + "TempYN", prefix + "IncomeAmt", prefix + "IncomeProof", prefix + "EmployerForm"))
                    {
                        invalid = true;
                        model.validationMessages.Add(Resources.AdapAppNavMenu.HouseholdIncome + " F3 ("
                                                     + Resources.Validation.ProofOfIncome + " #" + proofSectionIndex + "): "
                                                     + Resources.Validation.SinceIncomeEmpMustComplete);
                    }
                }

                //if employed but not enrolled in employer insurance...
                else if (typeRsp == 0)
                {
                    //if there are any missing responses in this "proof of income #X" section (other than the employer insurance form)...
                    if (!sv.AllComplete(
                            prefix + "Employer", prefix + "EmployStart", prefix + "TempYN", prefix + "IncomeAmt", prefix + "IncomeProof"))
                    {
                        invalid = true;
                        model.validationMessages.Add(Resources.AdapAppNavMenu.HouseholdIncome + " F3 ("
                                                     + Resources.Validation.ProofOfIncome + " #" + proofSectionIndex + "): "
                                                     + Resources.Validation.SinceIncomeEmpMustComplete);
                    }
                }
            }

            #endregion

            #endregion

            #region other validation (warnings)


            //C1
            if (!sv.HasAnyResponse("ADAP_C1_AddressProof"))
            {
                model.validationMessages.Add(Resources.Validation.WARNING + ": " + Resources.AdapAppNavMenu.ContactInfo + " C1: " + Resources.Validation.NoProofResidency);
            }

            //I3
            if (sv.HasExactResponse("ADAP_I3_MedicareYN", "1"))
            {
                bool partA = sv.HasExactResponse("ADAP_I3_PartAYN", "1");
                bool partB = sv.HasExactResponse("ADAP_I3_PartBYN", "1");

                if (partA && !sv.HasAnyResponse("ADAP_I3_PartADate"))
                {
                    model.validationMessages.Add(Resources.Validation.WARNING + ": " + Resources.AdapAppNavMenu.HealthInsurance + " I3: " + Resources.Validation.MedicareANoDate);
                }

                if (partB && !sv.HasAnyResponse("ADAP_I3_PartBDate"))
                {
                    model.validationMessages.Add(Resources.Validation.WARNING + ": " + Resources.AdapAppNavMenu.HealthInsurance + " I3: " + Resources.Validation.MedicareBNoDate);
                }
            }

            #endregion

            return(invalid);
        }
コード例 #4
0
        /*  This method validates the SIS templates in Views/Templates/SIS
         *
         *
         */
        private bool ValidateFormResult(def_FormResults fr, TemplateItems amt = null)
        {
            // * * * OT 3-15-16 completed form results need to be validated on every save (Bug 13110)
            //// * * * OT 1-4-16   form results that are already marked as completed get to skip validation
            //if (fr.formStatus == (byte)FormResults_formStatus.COMPLETED)
            //    return true;

            if (amt == null)
            {
                amt = new GeneralForm();
            }

            //retrieve all responses for this formResult, by def_ItemVariable identifier
            List <ValuePair> allResponses = CommonExport.GetDataByFormResultId(fr.formResultId);

            //pass the response data through generic validation (meta-data driven validation)
            def_Forms frm = formsRepo.GetFormById(fr.formId);

            string[]         ItemVariableSuffixesToSkip = { "Notes", "portantTo", "portantFor", "cl_age", "int_id" };
            SharedValidation sv      = new SharedValidation(allResponses);
            bool             invalid = sv.DoGenericValidation(formsRepo, amt, frm, ItemVariableSuffixesToSkip);

            //pass the response data through one-off validation (rules that can't be encoded into meta-data)
            //populate amt.valdiationMessages in the process
            amt.validationMessages = new List <string>();
            if (SisOneOffValidation.RunOneOffValidation(formsRepo, frm, fr.EnterpriseID.Value, allResponses, amt))
            {
                invalid = true;
            }

            if (invalid)
            {
                return(false);
            }

            //  Mark the FormResult as Complete
            new Assessments(formsRepo).AssessmentComplete(fr);// formsRepo.FormResultComplete(fr);

            // Insert status log indicating assessment has been marked complete
            if (SessionHelper.IsVentureMode == false)
            {
                ReviewStatus.AssessmentIsCompleted(formsRepo, fr);

                if (WebServiceActivity.IsWebServiceEnabled())
                {
                    WebServiceActivity.CallWebService(formsRepo, (int)WebServiceActivity.webServiceActivityFunctions.COMPLETE, "formResultId=" + fr.formResultId.ToString());
                }
            }

            // Populate the hidden Venture Version field upon validation

            if (SessionHelper.IsVentureMode == true)
            {
                string ventureVersion = SessionHelper.Read <string>("venture_version");

                if (ventureVersion != null)
                {
                    Updates.AddField(formsRepo, Updates.SIS_HIDDEN, fr, Updates.VENTURE_VERSION, ventureVersion);
                }
            }

            return(true);
        }