Ejemplo n.º 1
0
        public List <MessageErrorVo> CheckInValidBeforeExport(DisclosureFormVo disclosureFormVm, AssessmentDataVo assessmentForm)
        {
            var listError = new List <MessageErrorVo>();
            ////check error disclosure form
            //var listErrorDisclosureForm = CheckInValidDisclosureForm(disclosureFormVm);
            //if (listErrorDisclosureForm.Count > 0)
            //{
            //    listError.AddRange(listErrorDisclosureForm);
            //}

            //check match MID
            var fieldMid = assessmentForm.AssessmentSectionQuestions.FirstOrDefault(o => o.Order == 13);

            if (fieldMid != null)
            {
                if (string.IsNullOrEmpty(fieldMid.Field01))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "MID at PCST Form is required."
                    });
                }
                else if (!string.IsNullOrEmpty(disclosureFormVm.Member.Mid) && !string.IsNullOrEmpty(fieldMid.Field01))
                {
                    if (disclosureFormVm.Member.Mid != fieldMid.Field01)
                    {
                        listError.Add(new MessageErrorVo
                        {
                            MessageError = "MID at Disclosure Form not match PCST Form."
                        });
                    }
                }
            }
            //check is Expedited Request
            var fieldRequestType = assessmentForm.AssessmentSectionQuestions.FirstOrDefault(o => o.Order == 5);
            var fieldPeriod      = assessmentForm.AssessmentSectionQuestions.FirstOrDefault(o => o.Order == 64);

            if (fieldRequestType != null && fieldRequestType.Field01 != null)
            {
                if (fieldRequestType.Field01.ToString() == "2")
                {
                    if (fieldPeriod != null && fieldPeriod.Field01 != null)
                    {
                        if (fieldPeriod.Field01.ToString() != "5")
                        {
                            listError.Add(new MessageErrorVo
                            {
                                MessageError = "PCST Form - Item 64:  You must be chosen 1 months (4 weeks) because this request is Expedited Request."
                            });
                        }
                    }
                }
            }


            return(listError);
        }
Ejemplo n.º 2
0
        private RequestAssessmentPcsVo GetUpdateAssessment(int id)
        {
            var result = new RequestAssessmentPcsVo();

            //var SectionVos = new List<SectionVo>();
            using (var context = new AssessmentContext())
            {
                var assessment = context.Assessments.FirstOrDefault(o => o.Id == id);
                if (assessment != null)
                {
                    //Case for the new assessment
                    if (string.IsNullOrEmpty(assessment.AssessmentData) &&
                        string.IsNullOrEmpty(assessment.DisclosureFormData))
                    {
                        return(GetNewAssessment(assessment.FileName, id));
                    }



                    string encyptKey = ConfigurationManager.AppSettings["EncyptKey"];
                    if (string.IsNullOrEmpty(encyptKey))
                    {
                        throw new Exception("EncyptKey not found in App.config");
                    }

                    var dataJsonAssessmentData = new AssessmentDataVo();
                    if (!string.IsNullOrEmpty(assessment.AssessmentData))
                    {
                        var decryptAssessmentData = EncryptHelper.Decrypt(assessment.AssessmentData, encyptKey);
                        dataJsonAssessmentData = JsonConvert.DeserializeObject <AssessmentDataVo>(decryptAssessmentData);
                    }

                    var dataJsonDiscloseData = new DisclosureFormVo();
                    if (!string.IsNullOrEmpty(assessment.DisclosureFormData))
                    {
                        var decryptDiscloseData = EncryptHelper.Decrypt(assessment.DisclosureFormData, encyptKey);
                        dataJsonDiscloseData = JsonConvert.DeserializeObject <DisclosureFormVo>(decryptDiscloseData);
                    }

                    //always get content new
                    result.Sections = GetHtmlToDisplay();//dataJsonAssessmentData.Sections;



                    result.AssessmentSectionQuestions = dataJsonAssessmentData.AssessmentSectionQuestions;
                    result.AssessmentPcsId            = assessment.Id;
                    result.AssessmentName             = assessment.FileName;

                    if (dataJsonDiscloseData != null && dataJsonDiscloseData.Providers != null && dataJsonDiscloseData.Providers.Count > 0)
                    {
                        foreach (var dt in dataJsonDiscloseData.Providers)
                        {
                            dt.Id = CaculatorHelper.TryParseIntFromStr(dt.Mpi);
                        }
                    }
                    result.DisclosureFormVo = dataJsonDiscloseData;
                    //parse string to DateTime
                    if (result.DisclosureFormVo != null)
                    {
                        if (result.DisclosureFormVo.Member != null)
                        {
                            result.DisclosureFormVo.Member.DobStr = result.DisclosureFormVo.Member.Dob != null?
                                                                    result.DisclosureFormVo.Member.Dob.GetValueOrDefault().ToShortDateString() : "";
                        }
                        result.DisclosureFormVo.DateSignedStr = result.DisclosureFormVo.DateSigned != null?
                                                                result.DisclosureFormVo.DateSigned.GetValueOrDefault().ToShortDateString() : "";

                        result.DisclosureFormVo.TheFollowingDateStr = result.DisclosureFormVo.TheFollowingDate != null
                            ? result.DisclosureFormVo.TheFollowingDate.GetValueOrDefault().ToShortDateString()
                            : "";
                    }
                    return(result);
                }
                return(GetNewAssessment());
            }
            return(result);
        }
Ejemplo n.º 3
0
        public List <MessageErrorVo> CheckInValidDisclosureForm(DisclosureFormVo disclosureFormVm)
        {
            var listError        = new List <MessageErrorVo>();
            var disclosureFormVo = disclosureFormVm;

            #region Member
            var member = disclosureFormVo.Member;

            if (string.IsNullOrEmpty(member.Name))
            {
                listError.Add(new MessageErrorVo
                {
                    MessageError = "Full Name is required.(Disclosure Form)"
                });
            }

            if (string.IsNullOrEmpty(member.Address))
            {
                listError.Add(new MessageErrorVo
                {
                    MessageError = "Full Address is required.(Disclosure Form)"
                });
            }
            if (string.IsNullOrEmpty(member.Mid))
            {
                listError.Add(new MessageErrorVo
                {
                    MessageError = "ForwardHealth ID # is required.(Disclosure Form)"
                });
            }
            if (string.IsNullOrEmpty(member.DobStr))
            {
                listError.Add(new MessageErrorVo
                {
                    MessageError = "DOB is required.(Disclosure Form)"
                });
            }
            else
            {
                try
                {
                    //var valDate = DateTime.ParseExact(valStr, "MM/dd/yyyy", provider);
                    DateTime dt = DateTime.Parse(member.DobStr, new CultureInfo("en-US"));
                    if (CaculatorHelper.CompareDateTime(DateTime.Now, dt, "MM/dd/yyyy") == -1)
                    {
                        listError.Add(new MessageErrorVo
                        {
                            MessageError = "DOB should not be greater than the current date.(Disclosure Form)"
                        });
                    }
                }
                catch (FormatException)
                {
                }
            }

            #endregion
            #region Physician
            var physician = disclosureFormVo.Physician;
            if (physician != null && physician.IsHasPhysician)
            {
                if (string.IsNullOrEmpty(physician.FullName))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Physician's Name is required.(Disclosure Form)"
                    });
                }

                if (string.IsNullOrEmpty(physician.ClinicName))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Physician's Clinic Name is required.(Disclosure Form)"
                    });
                }

                if (string.IsNullOrEmpty(physician.Phone.RemoveFormatPhone()))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Physician's Phone is required.(Disclosure Form)"
                    });
                }

                if (string.IsNullOrEmpty(physician.Fax.RemoveFormatPhone()))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Physician's Fax is required.(Disclosure Form)"
                    });
                }
            }
            #endregion
            #region Other Healthcare Professtional
            var ohp = disclosureFormVo.OtherHealthcareProfessional;
            if (ohp != null && ohp.IsHasOtherHealthcareProfessional)
            {
                if (string.IsNullOrEmpty(ohp.FullName))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Other Healthcare Professional's Name is required.(Disclosure Form)"
                    });
                }

                if (string.IsNullOrEmpty(ohp.ClinicName))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Other Healthcare Professional's Clinic Name is required.(Disclosure Form)"
                    });
                }

                if (string.IsNullOrEmpty(ohp.Phone.RemoveFormatPhone()))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Other Healthcare Professional's Phone is required.(Disclosure Form)"
                    });
                }

                if (string.IsNullOrEmpty(ohp.Fax.RemoveFormatPhone()))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Other Healthcare Professional's Fax is required.(Disclosure Form)"
                    });
                }
            }
            #endregion
            #region Other As Listed
            var oal = disclosureFormVo.OtherAsListed;
            if (oal != null && oal.IsHasOtherAsListed)
            {
                foreach (var item in oal.OtherDisclosureForms)
                {
                    if (string.IsNullOrEmpty(item.Name) || string.IsNullOrEmpty(item.Relationship))
                    {
                        listError.Add(new MessageErrorVo
                        {
                            MessageError = "All fields in Other as listed are required.(Disclosure Form)"
                        });
                        break;
                    }
                }
            }
            #endregion
            #region Providers
            if (disclosureFormVo.IsHasProviderAgency)
            {
                var isHasFirstProvider = disclosureFormVo.Providers.Any(o => o.Order == 1);
                if (!isHasFirstProvider)
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Provider #1 is required.(Disclosure Form)"
                    });
                }
            }
            #endregion
            #region Other
            if (string.IsNullOrEmpty(disclosureFormVo.NotBeReleased))
            {
                listError.Add(new MessageErrorVo
                {
                    MessageError = "The following information should not be released is required.(Disclosure Form)"
                });
            }

            if (disclosureFormVo.IsOnTheFollowingDate)
            {
                if (string.IsNullOrEmpty(disclosureFormVo.TheFollowingDateStr))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "On the following date is required.(Disclosure Form)"
                    });
                }
            }


            #endregion
            #region Guardian
            var guardian = disclosureFormVo.Guardian;
            if (guardian != null)
            {
                if (!string.IsNullOrEmpty(guardian.Name) || !string.IsNullOrEmpty(guardian.Relationship) ||
                    (guardian.Signature != "_blank" && guardian.Signature != null))
                {
                    if (string.IsNullOrEmpty(guardian.Name))
                    {
                        listError.Add(new MessageErrorVo
                        {
                            MessageError = "Print Name is required.(Disclosure Form)"
                        });
                    }

                    if (string.IsNullOrEmpty(guardian.Relationship))
                    {
                        listError.Add(new MessageErrorVo
                        {
                            MessageError = "Relationship To Member is required.(Disclosure Form)"
                        });
                    }


                    if (guardian.Signature == "_blank")
                    {
                        listError.Add(new MessageErrorVo
                        {
                            MessageError = "Legal Guardian Signature is required.(Disclosure Form)"
                        });
                    }
                }

                if (string.IsNullOrEmpty(disclosureFormVo.DateSignedStr))
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Date Signed is required.(Disclosure Form)"
                    });
                }

                if (member.Signature == "_blank" || member.Signature == null)
                {
                    listError.Add(new MessageErrorVo
                    {
                        MessageError = "Member Signature is required.(Disclosure Form)"
                    });
                }
            }
            #endregion
            return(listError);
        }
Ejemplo n.º 4
0
        private void ExportAssessment(int assessmentId)
        {
            string encyptKey = ConfigurationManager.AppSettings["EncyptKey"];

            if (string.IsNullOrEmpty(encyptKey))
            {
                throw new Exception("EncyptKey not found in App.config");
            }

            var assessment = _assessmentService.GetById(assessmentId);

            if (assessment != null)
            {
                var isShowExportForm = true;
                var listError        = new List <MessageErrorVo>();

                var dataJsonDiscloseData = new DisclosureFormVo();
                var dataJsonAssessment   = new AssessmentDataVo();

                if (string.IsNullOrEmpty(assessment.DisclosureFormData))
                {
                    isShowExportForm = false;
                    var errorMsg = "To export assessment, please input data fully to Disclosure Form.\n";
                    MessageBox.Show(errorMsg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (!string.IsNullOrEmpty(assessment.DisclosureFormData))
                {
                    var decryptDiscloseData = EncryptHelper.Decrypt(assessment.DisclosureFormData, encyptKey);
                    dataJsonDiscloseData = JsonConvert.DeserializeObject <DisclosureFormVo>(decryptDiscloseData);

                    if (!string.IsNullOrEmpty(assessment.AssessmentData))
                    {
                        var decryptAssessment = EncryptHelper.Decrypt(assessment.AssessmentData, encyptKey);
                        dataJsonAssessment = JsonConvert.DeserializeObject <AssessmentDataVo>(decryptAssessment);
                    }

                    var listErrorDisclosureForm = _assessmentService.CheckInValidDisclosureForm(dataJsonDiscloseData);
                    listError = _assessmentService.CheckInValidBeforeExport(dataJsonDiscloseData, dataJsonAssessment);

                    if (listErrorDisclosureForm != null && listErrorDisclosureForm.Count > 0)
                    {
                        if (listError != null && listError.Count > 0)
                        {
                            listErrorDisclosureForm.AddRange(listError);
                        }
                        isShowExportForm = false;
                        var errorMsg = "To export assessment, please input data fully to Disclosure Form.\n" +
                                       "Following business rules are failed:\n";
                        foreach (var item in listErrorDisclosureForm)
                        {
                            errorMsg += " - " + item.MessageError.Replace("(Disclosure Form)", "") + "\n";
                        }
                        MessageBox.Show(errorMsg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else if (listError != null && listError.Count > 0)
                    {
                        isShowExportForm = false;
                        var errorMsg = "Following business rules are failed:\n";
                        foreach (var item in listError)
                        {
                            errorMsg += " - " + item.MessageError.Replace("(Disclosure Form)", "") + "\n";
                        }
                        MessageBox.Show(errorMsg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }

                if (isShowExportForm)
                {
                    var form = new FrmExport(assessment);
                    form.ShowDialog();
                }
            }
        }