Пример #1
0
        public void LoadFrequencies(IFamilyResearch familyResearchRepository)
        {
            Frequencies = familyResearchRepository.GetFrequencies().OrderBy(o => o.Id).ToList();
            int size = Foods.Count;

            FrequencyIdsSelected = new Frequency[size];
        }
Пример #2
0
        public void GetFamilyNutritionFoodRelationFromViewModel(IFamilyResearch familyResearchRepository)
        {
            var _foods = familyResearchRepository.GetFoods().OrderBy(o => o.Name).ToList();

            if (FamilyNutrition == null)
            {
                FamilyNutrition = new FamilyNutrition();
            }

            if (FamilyNutritionId > 0)
            {
                FamilyNutrition.Id = Convert.ToInt32(FamilyNutritionId);
            }

            FamilyNutrition.FamilyNutritionFoodRelation = new FamilyNutritionFoodRelation[_foods.Count];
            for (int index = 0; index < FrequencyIdsSelected.Length; index++)
            {
                FamilyNutrition.FamilyNutritionFoodRelation[index]             = new FamilyNutritionFoodRelation();
                FamilyNutrition.FamilyNutritionFoodRelation[index].FoodId      = _foods[index].Id;
                FamilyNutrition.FamilyNutritionFoodRelation[index].FrequencyId = FrequencyIdsSelected[index].Id;
                if (FamilyNutritionId > 0)
                {
                    FamilyNutrition.FamilyNutritionFoodRelation[index].FamilyNutritionId = FamilyNutrition.Id;
                }
            }
        }
Пример #3
0
 public void LoadTypeOfDistrictList(IFamilyResearch familyResearchRepository)
 {
     TypeOfDistrictList = familyResearchRepository.GetTypeOfDistricts().ToList();
     TypeOfDistrictList.Insert(0, new TypeOfDistrict()
     {
         Name = "Selecciona uno"
     });
 }
Пример #4
0
 public void LoadTipoDeMobiliarioList(IFamilyResearch familyResearchRepository)
 {
     TipoDeMobiliarioList = familyResearchRepository.GetTipoDeMobiliarios().ToList();
     TipoDeMobiliarioList.Insert(0, new TipoDeMobiliario()
     {
         Name = "Selecciona uno"
     });
 }
Пример #5
0
 public void LoadHomeAcquisitionList(IFamilyResearch familyResearchRepository)
 {
     HomeAcquisitionList = familyResearchRepository.GetHomeAcquisitions().ToList();
     HomeAcquisitionList.Insert(0, new HomeAcquisition()
     {
         Name = "Selecciona uno"
     });
 }
Пример #6
0
 public void LoadStatesOfMexico(IFamilyResearch familyResearchRepository)
 {
     StatesOfMexico = familyResearchRepository.GetStatesOfMexico().ToList();
     StatesOfMexico.Insert(0, new StatesOfMexico()
     {
         Nombre = "Selecciona un estado"
     });
 }
 public void LoadRelationships(IFamilyResearch familyResearchRepository)
 {
     RelationshipList = familyResearchRepository.GetRelationships().ToList();
     RelationshipList.Insert(0, new Relationship()
     {
         Id   = 0,
         Name = "Selecciona parentesco"
     });
 }
 public void LoadMaritalStatuses(IFamilyResearch familyResearchRepository)
 {
     MaritalStatusList = familyResearchRepository.GetMaritalStatuses().ToList();
     MaritalStatusList.Insert(0, new MaritalStatus()
     {
         Id   = 0,
         Name = "Selecciona estado civil"
     });
 }
Пример #9
0
 public void LoadMunicipalitiesOfMexico(IFamilyResearch familyResearchRepository)
 {
     if (string.IsNullOrEmpty(LegalGuardian?.Address?.State) ||
         LegalGuardian?.Address?.State.StartsWith("Selecciona") == true)
     {
         MunicipalitiesOfMexico = new List <MunicipalitiesOfMexico>();
         MunicipalitiesOfMexico.Add(new MunicipalitiesOfMexico()
         {
             Nombre = "Selecciona un municipio"
         });
     }
     else
     {
         MunicipalitiesOfMexico = familyResearchRepository
                                  .GetMunicipalitiesOfMexicoByStateOfMexicoName(LegalGuardian.Address.State).ToList();
     }
 }
 public FamilyResearchController(IFamilyResearch _familyResearchRepository, ILogger <FamilyResearchController> _logger)
 {
     familyResearchRepository = _familyResearchRepository;
     logger = _logger;
 }
Пример #11
0
        public void GetEconomicSituationPatrimonyRelationFromViewModel(IFamilyResearch familyResearchRepository)
        {
            var patrimonies = familyResearchRepository.GetPatrimonies()?.ToList();

            if (patrimonies == null)
            {
                return;
            }

            if (EconomicSituation == null)
            {
                EconomicSituation = new EconomicSituation();
            }

            EconomicSituation.EconomicSituationPatrimonyRelation     = new EconomicSituationPatrimonyRelation[PatrimonyViewModelCollection.Count];
            EconomicSituation.EconomicSituationPatrimonyRelation[0]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[1]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[2]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[3]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[4]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[5]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[6]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[7]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[8]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[9]  = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[10] = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[11] = new EconomicSituationPatrimonyRelation();
            EconomicSituation.EconomicSituationPatrimonyRelation[12] = new EconomicSituationPatrimonyRelation();

            if (EconomicSituationId > 0)
            {
                EconomicSituation.Id = Convert.ToInt32(EconomicSituationId);
                EconomicSituation.EconomicSituationPatrimonyRelation[0].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[1].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[2].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[3].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[4].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[5].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[6].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[7].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[8].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[9].EconomicSituationId  = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[10].EconomicSituationId = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[11].EconomicSituationId = EconomicSituation.Id;
                EconomicSituation.EconomicSituationPatrimonyRelation[12].EconomicSituationId = EconomicSituation.Id;
            }

            EconomicSituation.EconomicSituationPatrimonyRelation[0].PatrimonyId = patrimonies.First(p => string.Equals(p.Name, "Automovil", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[0].Value       = PatrimonyViewModelCollection[0].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[1].PatrimonyId = patrimonies.First(p => string.Equals(p.Name, "Modelo", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[1].Value       = PatrimonyViewModelCollection[1].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[9].PatrimonyId = patrimonies.First(p => string.Equals(p.Name, "AutomovilValor", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[9].Value       = PatrimonyViewModelCollection[9].Value;

            EconomicSituation.EconomicSituationPatrimonyRelation[2].PatrimonyId  = patrimonies.First(p => string.Equals(p.Name, "CasaHabitacion", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[2].Value        = PatrimonyViewModelCollection[2].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[3].PatrimonyId  = patrimonies.First(p => string.Equals(p.Name, "CasaHabitacionUbicacion", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[3].Value        = PatrimonyViewModelCollection[3].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[10].PatrimonyId = patrimonies.First(p => string.Equals(p.Name, "CasaHabitacionValor", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[10].Value       = PatrimonyViewModelCollection[10].Value;

            EconomicSituation.EconomicSituationPatrimonyRelation[4].PatrimonyId  = patrimonies.First(p => string.Equals(p.Name, "Terreno", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[4].Value        = PatrimonyViewModelCollection[4].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[5].PatrimonyId  = patrimonies.First(p => string.Equals(p.Name, "TerrenoUbicacion", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[5].Value        = PatrimonyViewModelCollection[5].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[11].PatrimonyId = patrimonies.First(p => string.Equals(p.Name, "TerrenoValor", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[11].Value       = PatrimonyViewModelCollection[11].Value;

            EconomicSituation.EconomicSituationPatrimonyRelation[6].PatrimonyId = patrimonies.First(p => string.Equals(p.Name, "Otros", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[6].Value       = PatrimonyViewModelCollection[6].Value;

            EconomicSituation.EconomicSituationPatrimonyRelation[7].PatrimonyId  = patrimonies.First(p => string.Equals(p.Name, "Ahorros", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[7].Value        = PatrimonyViewModelCollection[7].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[8].PatrimonyId  = patrimonies.First(p => string.Equals(p.Name, "FrecuenciaDeAhorro", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[8].Value        = PatrimonyViewModelCollection[8].Value;
            EconomicSituation.EconomicSituationPatrimonyRelation[12].PatrimonyId = patrimonies.First(p => string.Equals(p.Name, "AhorrosValor", StringComparison.OrdinalIgnoreCase)).Id;
            EconomicSituation.EconomicSituationPatrimonyRelation[12].Value       = PatrimonyViewModelCollection[12].Value;
        }
Пример #12
0
 public void LoadFoods(IFamilyResearch familyResearchRepository)
 {
     Foods = familyResearchRepository.GetFoods().OrderBy(o => o.Name).ToList();
 }
Пример #13
0
        public void SetInitialPatrimonyViewModelCollection(IFamilyResearch familyResearchRepository)
        {
            var patrimonies = familyResearchRepository.GetPatrimonies()?.OrderBy(o => o.Id)?.ToList();

            if (patrimonies == null)
            {
                return;
            }

            PatrimonyViewModelCollection = new List <PatrimonyViewModel>();
            foreach (var p in patrimonies)
            {
                switch (p.Name)
                {
                case "Automovil":
                    PatrimonyViewModelCollection.Insert(0, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "Modelo":

                    PatrimonyViewModelCollection.Insert(1, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "CasaHabitacion":

                    PatrimonyViewModelCollection.Insert(2, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "CasaHabitacionUbicacion":

                    PatrimonyViewModelCollection.Insert(3, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "Terreno":

                    PatrimonyViewModelCollection.Insert(4, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "TerrenoUbicacion":

                    PatrimonyViewModelCollection.Insert(5, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "Otros":

                    PatrimonyViewModelCollection.Insert(6, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "Ahorros":

                    PatrimonyViewModelCollection.Insert(7, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "FrecuenciaDeAhorro":

                    PatrimonyViewModelCollection.Insert(8, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "AutomovilValor":
                    PatrimonyViewModelCollection.Insert(9, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "CasaHabitacionValor":
                    PatrimonyViewModelCollection.Insert(10, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "TerrenoValor":
                    PatrimonyViewModelCollection.Insert(11, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                case "AhorrosValor":
                    PatrimonyViewModelCollection.Insert(12, new PatrimonyViewModel()
                    {
                        Name  = p.Name,
                        Value = string.Empty
                    });
                    break;

                default:
                    throw new Exception("Patrimony not supported");
                }
            }
        }
 public FamilyResearchController(IFamilyResearch _familyResearchRepository)
 {
     familyResearchRepository = _familyResearchRepository;
 }