/** * Validates a property based on the property name and property value. * @param propertyName The name of the property to be checked. * @param propertyValue The value of the property to be checked. * @returns true if the property is valid, false otherwise. */ public new static bool ValidateProperty(string propertyName, string propertyValue) { bool isPropertyValid = WidgetBaseWindowsPhone.ValidateProperty(propertyName, propertyValue); if (propertyName.Equals("maxdateyear") || propertyName.Equals("maxdatemonth") || propertyName.Equals("maxdateday") || propertyName.Equals("mindateyear") || propertyName.Equals("mindatemonth") || propertyName.Equals("mindateday")) { int value; if (!int.TryParse(propertyValue, out value)) { isPropertyValid = false; } if (propertyName.Equals("maxdateyear")) { if (MinDate > MaxDate.AddYears(-1 * (MaxDate.Year - value)) || value > MaxYear) isPropertyValid = false; } else if (propertyName.Equals("maxdatemonth")) { if (value <= 12 && value >= 1) { if (MinDate > MaxDate.AddMonths(-1 * (MaxDate.Month - value))) isPropertyValid = false; } else { isPropertyValid = false; } } else if (propertyName.Equals("maxdateday")) { int month = MaxDate.Month; if (MinDate > MaxDate.AddDays(value - MaxDate.Day)) isPropertyValid = false; // If the month have changed it means that the day value was not valid. if (month != MaxDate.AddDays(value - MaxDate.Day).Month) isPropertyValid = false; } else if (propertyName.Equals("mindateyear")) { if (MinDate.AddYears(-1 * (MinDate.Year - value)) > MaxDate || value < MinYear) isPropertyValid = false; } else if (propertyName.Equals("mindatemonth")) { if (value <= 12 && value >= 1) { if (MinDate.AddMonths(-1 * (MinDate.Month - value)) > MaxDate) isPropertyValid = false; } else { isPropertyValid = false; } } else if (propertyName.Equals("mindateday")) { int month = MinDate.Month; if (MinDate.AddDays(value - MinDate.Day) > MaxDate) isPropertyValid = false; // IF the month have changed it means that the day value was not valid. if (month != MinDate.AddDays(value - MinDate.Day).Month) isPropertyValid = false; } } return isPropertyValid; }
/// <summary> /// Initializes a new instance of the <see cref="TimePicker"/> class. /// </summary> public TimePicker() { Format = DateTimePickerFormat.Custom; CustomFormat = "mmm minutes ss seconds"; ShowUpDown = true; MinDate = DateTime.MinValue; MaxDate = MinDate.AddDays(1).AddSeconds(-1); }
public PatientSearchPageViewModel(INavigationService navigationService, IGenericRepo <mstr_ward_details> mstrWardRepo, IGenericRepo <mstr_bed_details> mstrBedRepo, IPatientManager patientManager, IGenericRepo <mstr_patient_info> patientRepo, IPageDialogService pageDialog) : base(navigationService, pageDialog) { _mstrWardRepo = mstrWardRepo; _mstrBedRepo = mstrBedRepo; _patientManager = patientManager; _patientRepo = patientRepo; SearchBtnCommand = new DelegateCommand <string>(GetPatientsList); LoadData(); var currentDate = DateTime.UtcNow.Date; MaxDate = MinDate.AddDays(1); }
public PatientSearchPageViewModel(INavigationService navigationService, IGenericRepo <mstr_ward_details> mstrWardRepo, IGenericRepo <mstr_bed_details> mstrBedRepo, IPatientManager patientManager, IGenericRepo <mstr_patient_info> patientRepo, IPageDialogService pageDialog) : base(navigationService, pageDialog) { _mstrWardRepo = mstrWardRepo; _mstrBedRepo = mstrBedRepo; _patientManager = patientManager; _patientRepo = patientRepo; SearchBtnCommand = new DelegateCommand <string>(GetPatientsList); Library.KEY_langchangedfrommealpage = "no"; LoadData(); var currentDate = DateTime.UtcNow.Date; MaxDate = Device.RuntimePlatform == Device.Android ? MinDate.AddDays(2) : MinDate.AddDays(1); }
public object GetRandom(EntityProperty column) { var range = (MaxDate - MinDate).Days; return(MinDate.AddDays(Randomize.Next(range))); }