Example #1
0
        public XmlElement ToXmlElement(XmlHelper helper)
        {
            var xmlElement = helper.CreateElement("AboutYou");

            xmlElement.AppendChild(helper.CreateElement(nameof(IsInsured), UserIsInsured.ToString()));
            if (!UserIsInsured ?? false)
            {
                xmlElement.AppendChild(helper.CreateElement(nameof(InsuredFirstName), InsuredFirstName));
                xmlElement.AppendChild(helper.CreateElement(nameof(InsuredLastName), InsuredLastName));
            }
            xmlElement.AppendChild(helper.CreateElement(nameof(FirstName), FirstName));
            xmlElement.AppendChild(helper.CreateElement(nameof(LastName), LastName));
            xmlElement.AppendChild(helper.CreateElement(nameof(Email), Email));
            xmlElement.AppendChild(helper.CreateElement(nameof(IsInsurancePolicyOwner), UserIsInsurancePolicyOwner.ToString()));
            if (!UserIsInsurancePolicyOwner)
            {
                xmlElement.AppendChild(helper.CreateElement(nameof(IsAgent), UserIsAgent.ToString()));
                if (UserIsAgent)
                {
                    xmlElement.AppendChild(Advisor.ToXmlElement(helper));
                }
                xmlElement.AppendChild(helper.CreateElement(nameof(SendInsuranceBenefitsTo), SendInsuranceBenefitsTo));
            }
            xmlElement.AppendChild(helper.CreateElement(nameof(InsurancePolicies), InsurancePolicies.Where(x => x.MustBeValidated).Select(x => x.ToXmlElement(helper)).ToList()));
            return(xmlElement);
        }
        private void LoadInsurancePolicies()
        {
            List <InsurancePolicy> policies = null;

            ApplicationService.IsBusy(true);
            if (!String.IsNullOrEmpty(_pathToFile))
            {
                policies = GetPolicies();
            }

            ApplicationService.RunOnUI(() =>
            {
                InsurancePolicies.Clear();
                if (policies != null)
                {
                    policies.ForEach(item => InsurancePolicies.Add(new PolicyDataGridViewModel(item)));
                    FilterPolicies();
                }
            });
            LastReadDateTime = DateTime.Now;
            IsDataUpToDate   = true;

            ApplicationService.IsBusy(false);
        }
Example #3
0
        public XmlElement ToXmlElement(XmlHelper helper)
        {
            var xmlElement = helper.CreateElement(nameof(InsuredDeceaseClaimModel).Replace("Model", string.Empty));

            xmlElement.AppendChild(helper.CreateElement(nameof(PrenomAssure), PrenomAssure));
            xmlElement.AppendChild(helper.CreateElement(nameof(NomAssure), NomAssure));
            xmlElement.AppendChild(helper.CreateElement(nameof(InitialeAssure), InitialeAssure));
            xmlElement.AppendChild(helper.CreateElement(nameof(InsurancePolicies), InsurancePolicies.Where(x => x.MustBeValidated).Select(x => x.ToXmlElement(helper)).ToList()));

            xmlElement.AppendChild(helper.CreateElement(nameof(AdresseAssure), AdresseAssure.ToXmlElement(helper)));
            xmlElement.AppendChild(helper.CreateElement(nameof(DateNaissanceAssure), helper.TransformerDate(DateNaissanceAssure)));
            xmlElement.AppendChild(helper.CreateElement(nameof(DateDecesAssure), helper.TransformerDate(DateDecesAssure)));

            xmlElement.AppendChild(helper.CreateElement(nameof(EtatCivilAssure), EtatCivilAssure));
            if (EtatCivilAssure == ETAT_CIVIL_UNION_DE_FAIT)
            {
                xmlElement.AppendChild(helper.CreateElement(nameof(DateUnionFait), helper.TransformerDate(DateUnionFait)));
            }
            if (EtatCivilAssure == ETAT_CIVIL_DIVORCE)
            {
                xmlElement.AppendChild(helper.CreateElement(nameof(DateJugementDivorce), helper.TransformerDate(DateJugementDivorce)));
            }
            if (EtatCivilAssure == ETAT_CIVIL_SEPARE)
            {
                xmlElement.AppendChild(helper.CreateElement(nameof(TypeSeparation), TypeSeparation));
                if (TypeSeparation == TYPE_SEPARATION_FAIT)
                {
                    xmlElement.AppendChild(helper.CreateElement(nameof(DateSeparationFait), helper.TransformerDate(DateSeparationFait)));
                }
                if (TypeSeparation == TYPE_SEPARATION_LEGALE)
                {
                    xmlElement.AppendChild(helper.CreateElement(nameof(DateSeparationLegale), helper.TransformerDate(DateSeparationLegale)));
                }
            }

            xmlElement.AppendChild(helper.CreateElement(nameof(CauseDecesMaladie), CauseDecesMaladie));

            if (CauseDecesMaladie == CAUSE_DECES_AUTRE)
            {
                xmlElement.AppendChild(helper.CreateElement(nameof(CauseDeces), CauseDeces));
                if (Conseiller)
                {
                    xmlElement.AppendChild(helper.CreateElement(nameof(HasDiagnosisInLastFiveYears2), HasDiagnosisInLastFiveYears2));
                    if (HasDiagnosisInLastFiveYears2 == "O")
                    {
                        XmlElement XmlConsultations = helper.CreateElement("MedicalConsultations");
                        xmlElement.AppendChild(XmlConsultations);
                        foreach (var medicalconsultation in MedicalConsultations2)
                        {
                            XmlElement XmlConsultation = helper.CreateElement("Consultation");
                            XmlConsultations.AppendChild(XmlConsultation);
                            XmlConsultation.AppendChild(helper.CreateElement(nameof(medicalconsultation.Reason), medicalconsultation.Reason));
                            XmlConsultation.AppendChild(helper.CreateElement(nameof(medicalconsultation.Year), medicalconsultation.Year.ToString()));
                            XmlConsultation.AppendChild(helper.CreateElement(nameof(medicalconsultation.PhysicianInfos), medicalconsultation.PhysicianInfos.ToXmlElement(helper)));
                        }
                    }
                }
            }

            if (CauseDecesMaladie == CAUSE_DECES_MALADIE)
            {
                {
                    xmlElement.AppendChild(helper.CreateElement(nameof(PreciserMaladieCauseDeces), PreciserMaladieCauseDeces));

                    if (Conseiller)
                    {
                        xmlElement.AppendChild(helper.CreateElement(nameof(RdAnneePremiersSymptomes), RdAnneePremiersSymptomes));
                        if (RdAnneePremiersSymptomes == "O")
                        {
                            xmlElement.AppendChild(helper.CreateElement(nameof(AnneePremiersSymptomes), AnneePremiersSymptomes.Year));
                        }
                        xmlElement.AppendChild(helper.CreateElement(nameof(RdAnneePremiereConsultation), RdAnneePremiereConsultation));
                        if (RdAnneePremiereConsultation == "O")
                        {
                            xmlElement.AppendChild(helper.CreateElement(nameof(AnneePremiereConsultation), AnneePremiereConsultation.Year));
                        }

                        xmlElement.AppendChild(helper.CreateElement(nameof(HasDiagnosisInLastFiveYears2), HasDiagnosisInLastFiveYears2));
                        if (HasDiagnosisInLastFiveYears2 == "O")
                        {
                            XmlElement XmlConsultations = helper.CreateElement("MedicalConsultations");
                            xmlElement.AppendChild(XmlConsultations);
                            foreach (var medicalconsultation in MedicalConsultations2)
                            {
                                XmlElement XmlConsultation = helper.CreateElement("Consultation");
                                XmlConsultations.AppendChild(XmlConsultation);
                                XmlConsultation.AppendChild(helper.CreateElement(nameof(medicalconsultation.Reason), medicalconsultation.Reason));
                                XmlConsultation.AppendChild(helper.CreateElement(nameof(medicalconsultation.Year), medicalconsultation.Year.ToString()));
                                XmlConsultation.AppendChild(helper.CreateElement(nameof(medicalconsultation.PhysicianInfos), medicalconsultation.PhysicianInfos.ToXmlElement(helper)));
                            }
                        }
                    }
                }
            }

            xmlElement.AppendChild(helper.CreateElement(nameof(PaysDeces), PaysDeces));
            if (PaysDeces == PAYS_DECES_AUTRE)
            {
                xmlElement.AppendChild(helper.CreateElement(nameof(AutrePaysDeces), AutrePaysDeces));
            }

            return(xmlElement);
        }
 private List <InsurancePolicy> GetPolicies()
 {
     // Always do a refresh, as this will merge new entries not saved yet with the entries that
     // are loaded
     return(PolicyDataService.RefreshPolicies(InsurancePolicies.Select(s => s.InsurancePolicy).ToList()));
 }