Наследование: DisposableModelBase
        public SortieStatisticDefaultTimeSpanGroupViewModel(SortieStatisticViewModel rpOwner, SortieStatisticTimeSpanType rpType) : base(rpOwner, rpType)
        {
            switch (rpType)
            {
                case SortieStatisticTimeSpanType.Today:
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of day', 'utc')";
                    TimeSpanEnd = "strftime('%s', 'now')";
                    break;

                case SortieStatisticTimeSpanType.ThisWeek:
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'weekday 0', '-6 days', 'start of day', 'utc')";
                    TimeSpanEnd = "strftime('%s', 'now')";
                    break;

                case SortieStatisticTimeSpanType.ThisMonth:
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of month', 'utc')";
                    TimeSpanEnd = "strftime('%s', 'now')";
                    break;

                case SortieStatisticTimeSpanType.Yesterday:
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of day', '-1 days', 'utc')";
                    TimeSpanEnd = "strftime('%s', 'now', 'localtime', 'start of day', 'utc')";
                    break;

                case SortieStatisticTimeSpanType.LastWeek:
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'weekday 0', '-13 days', 'start of day', 'utc')";
                    TimeSpanEnd = "strftime('%s', 'now', 'localtime', 'weekday 0', '-6 days', 'start of day', 'utc')";
                    break;

                case SortieStatisticTimeSpanType.LastMonth:
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of month', '-1 month', 'utc')";
                    TimeSpanEnd = "strftime('%s', 'now', 'localtime', 'start of month', 'utc')";
                    break;
            }
        }
        public SortieStatisticCustomTimeSpanGroupViewModel(SortieStatisticViewModel rpOwner) : base(rpOwner, SortieStatisticTimeSpanType.Custom)
        {
            var rNow = DateTime.Now.Tomorrow().AddSeconds(-1.0).AsOffset();

            r_SelectedDateStart = r_SelectedDateEnd = rNow.DateTime;
            TimeSpanStart       = TimeSpanEnd = rNow.ToUnixTime().ToString();
        }
        public SortieStatisticDefaultTimeSpanGroupViewModel(SortieStatisticViewModel rpOwner, SortieStatisticTimeSpanType rpType) : base(rpOwner, rpType)
        {
            switch (rpType)
            {
            case SortieStatisticTimeSpanType.Today:
                TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of day', 'utc')";
                TimeSpanEnd   = "strftime('%s', 'now')";
                break;

            case SortieStatisticTimeSpanType.ThisWeek:
                TimeSpanStart = "strftime('%s', 'now', 'localtime', 'weekday 0', '-6 days', 'start of day', 'utc')";
                TimeSpanEnd   = "strftime('%s', 'now')";
                break;

            case SortieStatisticTimeSpanType.ThisMonth:
                TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of month', 'utc')";
                TimeSpanEnd   = "strftime('%s', 'now')";
                break;

            case SortieStatisticTimeSpanType.Yesterday:
                TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of day', '-1 days', 'utc')";
                TimeSpanEnd   = "strftime('%s', 'now', 'localtime', 'start of day', 'utc')";
                break;

            case SortieStatisticTimeSpanType.LastWeek:
                TimeSpanStart = "strftime('%s', 'now', 'localtime', 'weekday 0', '-13 days', 'start of day', 'utc')";
                TimeSpanEnd   = "strftime('%s', 'now', 'localtime', 'weekday 0', '-6 days', 'start of day', 'utc')";
                break;

            case SortieStatisticTimeSpanType.LastMonth:
                TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of month', '-1 month', 'utc')";
                TimeSpanEnd   = "strftime('%s', 'now', 'localtime', 'start of month', 'utc')";
                break;
            }
        }
        public SortieStatisticCustomTimeSpanGroupViewModel(SortieStatisticViewModel rpOwner) : base(rpOwner, SortieStatisticTimeSpanType.Custom)
        {
            var rNow = new DateTimeOffset(DateTime.Now.AddDays(1.0).Date.AddSeconds(-1.0));

            r_SelectedDateStart = r_SelectedDateEnd = rNow.DateTime;
            TimeSpanStart = TimeSpanEnd = rNow.ToUnixTime().ToString();
        }
Пример #5
0
        public SortieStatisticDefaultTimeSpanGroupViewModel(SortieStatisticViewModel rpOwner, SortieStatisticTimeSpanType rpType) : base(rpOwner, rpType)
        {
            var r8amJstOrigin = Preference.Instance.Game.SortieStatistic_8amJstOrigin.Value;

            switch (rpType)
            {
            case SortieStatisticTimeSpanType.Today:
                TimeSpanStart = !r8amJstOrigin ? "strftime('%s', 'now', 'localtime', 'start of day', 'utc')"
                                                   : "strftime('%s', 'now', '+1 hour', 'start of day', '-1 hour')";
                TimeSpanEnd = "strftime('%s', 'now')";
                break;

            case SortieStatisticTimeSpanType.ThisWeek:
                TimeSpanStart = !r8amJstOrigin ? "strftime('%s', 'now', 'localtime', 'weekday 0', '-6 days', 'start of day', 'utc')"
                                                   : "strftime('%s', 'now', '+1 hour', 'weekday 0', '-6 days', 'start of day', '-1 hour')";
                TimeSpanEnd = "strftime('%s', 'now')";
                break;

            case SortieStatisticTimeSpanType.ThisMonth:
                TimeSpanStart = !r8amJstOrigin ? "strftime('%s', 'now', 'localtime', 'start of month', 'utc')"
                                                   : "strftime('%s', 'now', '+1 hour', 'start of month', '-1 hour')";
                TimeSpanEnd = "strftime('%s', 'now')";
                break;

            case SortieStatisticTimeSpanType.Yesterday:
                if (!r8amJstOrigin)
                {
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of day', '-1 days', 'utc')";
                    TimeSpanEnd   = "strftime('%s', 'now', 'localtime', 'start of day', 'utc')";
                }
                else
                {
                    TimeSpanStart = "strftime('%s', 'now', '+1 hour', 'start of day', '-25 hour')";
                    TimeSpanEnd   = "strftime('%s', 'now', '+1 hour', 'start of day', '-1 hour')";
                }
                break;

            case SortieStatisticTimeSpanType.LastWeek:
                if (!r8amJstOrigin)
                {
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'weekday 0', '-13 days', 'start of day', 'utc')";
                    TimeSpanEnd   = "strftime('%s', 'now', 'localtime', 'weekday 0', '-6 days', 'start of day', 'utc')";
                }
                else
                {
                    TimeSpanStart = "strftime('%s', 'now', '+1 hour', 'weekday 0', '-13 days', 'start of day', '-1 hour')";
                    TimeSpanEnd   = "strftime('%s', 'now', '+1 hour', 'weekday 0', '-13 days', 'start of day', '-1 hour')";
                }
                break;

            case SortieStatisticTimeSpanType.LastMonth:
                if (!r8amJstOrigin)
                {
                    TimeSpanStart = "strftime('%s', 'now', 'localtime', 'start of month', '-1 month', 'utc')";
                    TimeSpanEnd   = "strftime('%s', 'now', 'localtime', 'start of month', 'utc')";
                }
                else
                {
                    TimeSpanStart = "strftime('%s', 'now', '+1 hour', 'start of month', '-1 month', '-1 hour')";
                    TimeSpanEnd   = "strftime('%s', 'now', '+1 hour', 'start of month', '-1 hour')";
                }
                break;
            }
        }
        protected SortieStatisticTimeSpanGroupViewModel(SortieStatisticViewModel rpOwner, SortieStatisticTimeSpanType rpType)
        {
            r_Owner = rpOwner;

            Type = rpType;
        }
        protected SortieStatisticTimeSpanGroupViewModel(SortieStatisticViewModel rpOwner, SortieStatisticTimeSpanType rpType)
        {
            r_Owner = rpOwner;

            Type = rpType;
        }