//TODO: CalculateAge from BirthDate public void CalculateAge() { _ageCalculated = true; PersonAge personAge = null; try { personAge = SharedKernel.Custom.Utils.CalculateAge(BirthDate); } catch (Exception ex) { } if (null == personAge) { return; } Age = personAge.Age; _ageCalculated = false; var ageUnit = AgeUnitOptions.FirstOrDefault(x => x.Value == personAge.AgeUnit); _ageUnitCalculated = true; SelectedAgeUnit = ageUnit; _ageUnitCalculated = false; }
public ClientDemographicViewModel(IDialogService dialogService, ISettings settings) : base(dialogService, settings) { Step = 1; GenderOptions = CustomLists.GenderList; AgeUnitOptions = CustomLists.AgeUnitList; SelectedGender = GenderOptions.First(); SelectedAgeUnit = AgeUnitOptions.First(); BirthDate = DateTime.Today;//.AddDays(-1); Title = "Demographics"; MovePreviousLabel = ""; MoveNextLabel = "NEXT"; Age = 0; SelectedAgeUnit = AgeUnitOptions.First(); }
public override void LoadFromStore(VMStore modelStore) { try { Demographic = JsonConvert.DeserializeObject<ClientDemographicDTO>(modelStore.Store); Downloaded = Demographic.Downloaded; PersonId = Demographic.PersonId; FirstName = Demographic.FirstName; MiddleName = Demographic.MiddleName; LastName = Demographic.LastName; NickName = Demographic.NickName; SelectedGender = GenderOptions.FirstOrDefault(x => x.Value == Demographic.Gender); Age = Demographic.Age; if (!string.IsNullOrWhiteSpace(Demographic.AgeUnit)) SelectedAgeUnit = AgeUnitOptions.FirstOrDefault(x => x.Value == Demographic.AgeUnit); BirthDate = Demographic.BirthDate; } catch (Exception e) { Mvx.Error(e.Message); } }