예제 #1
0
        public void SetEndDates(IList <StationCashSr> dates)
        {
            EndDateFilters.Clear();
            long           idx    = 1;
            DateCollection noDate = new DateCollection()
            {
                Date  = DateTimeUtils.DATETIME1700,
                Index = 0,
                Value = TranslationProvider.Translate(MultistringTags.TERMINAL_FROM_CALENDER).ToString()
            };

            EndDateFilters.Add(noDate);

            if (dates != null && dates.Count > 0)
            {
                foreach (StationCashSr cash in dates)
                {
                    DateCollection date = new DateCollection()
                    {
                        Date  = cash.DateModified,
                        Index = idx,
                        Value = cash.DateModified.ToString("dd.MM.yyyy HH:mm") + " (" + (
                            ((OperatorUser)ChangeTracker.CurrentUser).AccountId.ToString() == cash.OperatorID ? ((OperatorUser)ChangeTracker.CurrentUser).Username : StationRepository.StationTyp) + ")"
                    };
                    if (cash.DateModified > StartDate && cash.DateModified <= ChangeTracker.CalendarEndDateAccounting)
                    {
                        EndDateFilters.Add(date);
                    }

                    idx++;
                }
            }
            if (idx <= 0)
            {
                DateTime creationDate = DateTimeUtils.DATETIMENULL;
                if (StationRepository.Created_At != null)
                {
                    creationDate = StationRepository.Created_At.Value;
                }
                DateCollection date = new DateCollection()
                {
                    Date  = creationDate,
                    Index = idx,
                    Value = creationDate.ToString("dd.MM.yyyy HH:mm")
                };
                EndDateFilters.Add(date);
            }
            if (StartDate > ChangeTracker.CalendarEndDateAccounting)
            {
                ChangeTracker.CalendarEndDateAccounting = StartDate.Date.Add(new TimeSpan(23, 59, 59));
            }
            SelectedEndDateFilterIndex = EndDateFilters.First();
        }
        public void SetDates(StationCashSr[] start)
        {
            var operatorUser = ChangeTracker.CurrentUser as SportBetting.WPF.Prism.Models.OperatorUser;

            if (ChangeTracker.CurrentUser.GetType() == typeof(SportBetting.WPF.Prism.Models.OperatorUser))
            {
                int startIdx = SelectedStartDateFilterIndex;
                int endIdx   = SelectedEndDateFilterIndex;

                StartDateFilters.Clear();
                EndDateFilters.Clear();
                long           idx    = 1;
                DateCollection noDate = new DateCollection()
                {
                    Date  = DateTimeUtils.DATETIME1700,
                    Index = 0,
                    Value =
                        TranslationProvider.Translate(
                            MultistringTags.TERMINAL_FROM_CALENDER).ToString()
                };
                StartDateFilters.Add(noDate);
                EndDateFilters.Add(noDate);

                if (start != null && start.Length > 0)
                {
                    foreach (StationCashSr cash in start)
                    {
                        DateCollection date = new DateCollection()
                        {
                            Date  = cash.DateModified,
                            Index = idx,
                            Value = cash.DateModified + " (" + (
                                ((SportBetting.WPF.Prism.Models.OperatorUser)ChangeTracker.CurrentUser).Username == cash.OperatorID ? cash.OperatorID : StationRepository.StationTyp) + ")"
                        };
                        if (CalStartDate <= cash.DateModified)
                        {
                            StartDateFilters.Add(date);
                        }
                        if (cash.DateModified > StartDate && CalEndDate <= cash.DateModified)
                        {
                            EndDateFilters.Add(date);
                        }

                        idx++;
                    }
                }
                if (idx <= 1)
                {
                    DateTime creationDate = DateTimeUtils.DATETIMENULL;
                    if (StationRepository.Created_At != null)
                    {
                        creationDate = StationRepository.Created_At.Value;
                    }
                    DateCollection date = new DateCollection()
                    {
                        Date  = creationDate,
                        Index = idx,
                        Value = creationDate.ToString()
                    };
                    StartDateFilters.Add(date);
                    EndDateFilters.Add(date);
                }
                if (StartDate > CalEndDate)
                {
                    CalEndDate = StartDate.Date.Add(new TimeSpan(23, 59, 59));
                }
                if (StartDateFilters.Count - 1 >= startIdx)
                {
                    SelectedStartDateFilterIndex = startIdx;
                }
                else
                {
                    SelectedStartDateFilterIndex = StartDateFilters.Count - 1;
                }
                if (EndDateFilters.Count - 1 >= endIdx)
                {
                    SelectedEndDateFilterIndex = endIdx;
                }
                else
                {
                    SelectedEndDateFilterIndex = EndDateFilters.Count - 1;
                }
            }
        }