Esempio n. 1
0
        public static List <PrestSante> NormalizeGroupGarantyLabelsInPrestaTable(List <PrestSante> myPrestData)
        {
            try
            {
                List <PrestSante> prestaNormalized = new List <PrestSante>();

                //Pre-load Groups and Garanties for all Assureurs that are found in the Presta Table
                List <string> assList = myPrestData.OrderBy(p => p.AssureurName).Select(p => p.AssureurName).Distinct().ToList();

                List <GroupGarantySante> groupSanteListForAssureur = new List <GroupGarantySante>();
                List <GroupGarantySante> groupSanteListAll         = GroupGarantySante.GetGroupsAndGarantiesForAssureur(C.cDEFAULTASSUREUR);

                foreach (string assurName in assList)
                {
                    //int assurId = Assureur.GetAssIdForAssName(assurName);
                    if (assurName != C.cDEFAULTASSUREUR)
                    {
                        groupSanteListForAssureur = GroupGarantySante.GetGroupsAndGarantiesForAssureur(assurName);
                        groupSanteListAll.AddRange(groupSanteListForAssureur);
                    }
                }

                List <Assureur> myAssurList = Assureur.GetAllAssureurs();

                foreach (PrestSante prest in myPrestData)
                {
                    //get Garanty Label
                    //int assureurId = Assureur.GetAssIdForAssName(prest.AssureurName);
                    //int assureurId = myAssurList.Where(a => a.Name == prest.AssureurName).Select(a => a.Id).First();
                    string codeActe  = prest.CodeActe;
                    string assurName = prest.AssureurName;

                    //if (assureurId == C.cINVALIDID)
                    //    throw new Exception("CollectPrestaData:: No AssureurId was found for the AssureurName: " + prest.AssureurName);
                    if (String.IsNullOrEmpty(assurName))
                    {
                        throw new Exception("NormalizeGroupGarantyLabelsInPrestaTable:: No Assureur Name was provided!");
                    }
                    if (String.IsNullOrEmpty(codeActe))
                    {
                        throw new Exception("NormalizeGroupGarantyLabelsInPrestaTable:: No CodeActe was provided!");
                    }

                    GenericClasses ggPair = BLGroupsAndGaranties.GetNormalizedGroupGarantyPair(assurName, codeActe, groupSanteListAll);

                    prest.GroupName   = ggPair.GroupName;
                    prest.GarantyName = ggPair.GarantyName;

                    prestaNormalized.Add(prest);
                    //Console.WriteLine(prestaNormalized.Count);
                }

                return(prestaNormalized);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                throw ex;
            }
        }
        public List <Assureur> GetAssureurs([Control] bool chkAssur)
        {
            try
            {
                List <Assureur> assur;

                if (chkAssur)
                {
                    assur = Assureur.GetAssureursWithoutGroupsAndGarantiesSante();
                }
                else
                {
                    assur = Assureur.GetAllAssureurs();
                    assur.Insert(0, new Assureur {
                        Id = -1, Name = C.cDEFAULTASSUREUR
                    });
                }

                return(assur);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);

                var myCustomValidator = new CustomValidator();
                myCustomValidator.IsValid      = false;
                myCustomValidator.ErrorMessage = ex.Message;
                Page.Validators.Add(myCustomValidator);

                return(null);
            }
        }
Esempio n. 3
0
        public List <Assureur> GetAssureurs()
        {
            try
            {
                List <Assureur> assur;

                assur = Assureur.GetAllAssureurs();

                return(assur);
            }
            catch (Exception ex) { UICommon.HandlePageError(ex, this.Page, "GestionExperience::GetAssureurs"); return(null); }
        }
        public List <Assureur> GetAssureurs([Control] bool chkAssur)
        {
            try
            {
                List <Assureur> assur;

                if (chkAssur)
                {
                    assur = Assureur.GetAssureursWithoutCadencier();
                }
                else
                {
                    assur = Assureur.GetAllAssureurs();
                    assur.Insert(0, new Assureur {
                        Id = -1, Name = C.cDEFAULTASSUREUR
                    });
                }

                return(assur);
            }
            catch (Exception ex) { UICommon.HandlePageError(ex, this.Page, "GestionCadencier::GetAssureurs"); return(null); }
        }