protected override void OnBeforeShow(IList <EditParameterInfo> parametersInfo, XtraReport report) { EditParameterInfo info = FindParameterInfo(parametersInfo, periodParameterName); if (info == null) { return; } info.Editor = CreatePeriodEditor(Enum.GetValues(typeof(TimePeriod)), new string[] { "(Custom)", "Month", "3 Months", "6 Months", "Year", "2 Years", "5 Years", "10 Years" }); TimePeriod timePeriod = (TimePeriod)info.Parameter.Value; if (timePeriod != TimePeriod.Custom) { DateTimeCorrector corrector = CreateCorrector(timePeriod); DateTime endTime = DateTime.Now; FindParameterInfo(parametersInfo, startDateParameterName).Parameter.Value = (object)corrector.Correct(endTime); FindParameterInfo(parametersInfo, endDateParameterName).Parameter.Value = (object)endTime; } DateEdit startDateEdit = (DateEdit)FindEditor(parametersInfo, startDateParameterName); startDateEdit.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; DateEdit endDateEdit = (DateEdit)FindEditor(parametersInfo, endDateParameterName); endDateEdit.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.False; }
protected override void OnEditorValueChanged(IList <EditParameterInfo> parametersInfo, EditParameterInfo changedInstance, XtraReport report) { switch (changedInstance.Parameter.Name) { case periodParameterName: OnPeriodEditValueChanged(parametersInfo); break; case startDateParameterName: OnStartDateDateEditValueChanged(parametersInfo); break; case endDateParameterName: OnEndDateEditValueChanged(parametersInfo); break; default: throw new Exception("Invalid switch's branch."); } }
static BaseEdit FindEditor(IList <EditParameterInfo> parametersInfo, string name) { EditParameterInfo info = FindParameterInfo(parametersInfo, name); return(info != null ? info.Editor : null); }
static bool FindPredicate(EditParameterInfo item) { return(item.Parameter.Name == itemName); }