public void LoadFrequencies(IFamilyResearch familyResearchRepository) { Frequencies = familyResearchRepository.GetFrequencies().OrderBy(o => o.Id).ToList(); int size = Foods.Count; FrequencyIdsSelected = new Frequency[size]; }
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; } } }
public void LoadTypeOfDistrictList(IFamilyResearch familyResearchRepository) { TypeOfDistrictList = familyResearchRepository.GetTypeOfDistricts().ToList(); TypeOfDistrictList.Insert(0, new TypeOfDistrict() { Name = "Selecciona uno" }); }
public void LoadTipoDeMobiliarioList(IFamilyResearch familyResearchRepository) { TipoDeMobiliarioList = familyResearchRepository.GetTipoDeMobiliarios().ToList(); TipoDeMobiliarioList.Insert(0, new TipoDeMobiliario() { Name = "Selecciona uno" }); }
public void LoadHomeAcquisitionList(IFamilyResearch familyResearchRepository) { HomeAcquisitionList = familyResearchRepository.GetHomeAcquisitions().ToList(); HomeAcquisitionList.Insert(0, new HomeAcquisition() { Name = "Selecciona uno" }); }
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" }); }
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; }
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; }
public void LoadFoods(IFamilyResearch familyResearchRepository) { Foods = familyResearchRepository.GetFoods().OrderBy(o => o.Name).ToList(); }
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; }