Beispiel #1
0
            void OnPeriodEditValueChanged(IList <EditParameterInfo> parametersInfo)
            {
                if (!canUpdateEditors)
                {
                    return;
                }
                BaseEdit edit = FindEditor(parametersInfo, periodParameterName);

                if (edit == null)
                {
                    return;
                }
                edit.DoValidate();
                DateTimeCorrector corrector = CreateCorrector((TimePeriod)edit.EditValue);

                if (corrector == null || corrector.IsEmpty)
                {
                    return;
                }
                DateTime endTime = DateTime.Now;

                SetValue(FindEditor(parametersInfo, startDateParameterName), corrector.Correct(endTime));
                SetValue(FindEditor(parametersInfo, endDateParameterName), endTime);
            }
Beispiel #2
0
            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;
            }