Example #1
0
        private bool PromptRange(string fieldName, ref DateTime startDate, ref DateTime endDate)
        {
            if (RangeSelection == RangeType.DayOfOperationRange)
            {
                PosDialogWindow window  = DayOfOperationRangeSelectionControl.CreateInDefaultWindow();
                var             control = window.DockedControl as DayOfOperationRangeSelectionControl;

                window.Title = fieldName;
                window.ShowDialogForActiveWindow();
                if (window.ClosedByUser)
                {
                    return(false);
                }
                startDate = control.StartRange;
                endDate   = control.EndRange;
                return(true);
            }
            if (RangeSelection == RangeType.DateRange)
            {
                return(PosDialogWindow.PromptDateRange(Strings.SelectDateRange,
                                                       ref startDate, ref endDate));
            }
            if (RangeSelection == RangeType.AllDates)
            {
                startDate = SqlDateTime.MinValue.Value;
                endDate   = SqlDateTime.MaxValue.Value;
                return(true);
            }
            if (RangeSelection == RangeType.MonthToDate)
            {
                endDate   = DateTime.Now;
                startDate = new DateTime(endDate.Year, endDate.Month, 1, 0, 0, 0);
                return(true);
            }
            if (RangeSelection == RangeType.YearToDay)
            {
                endDate   = DateTime.Now;
                startDate = new DateTime(endDate.Year, 1, 1, 0, 0, 0);
                return(true);
            }
            if (RangeSelection == RangeType.TodayOnly)
            {
                endDate   = DateTime.Now;
                startDate = new DateTime(endDate.Year, endDate.Month, endDate.Day, 0, 0, 0);
                return(true);
            }
            return(false);
        }
Example #2
0
        public static PosDialogWindow CreateInDefaultWindow()
        {
            DayOfOperationRangeSelectionControl control = new DayOfOperationRangeSelectionControl();

            return(new PosDialogWindow(control, Strings.SelectedRange, 710, 530));
        }