コード例 #1
0
        public static (DateTime startUtc, DateTime endUtc) GetDateRange(ISiteModel siteModel, FilterResult filter)
        {
            if (filter?.StartUtc == null || !filter.EndUtc.HasValue)
            {
                var startEndDate = siteModel.GetDateRange();

                var startUtc = filter?.StartUtc ?? startEndDate.startUtc;
                var endUtc   = filter?.EndUtc ?? startEndDate.endUtc;
                return(startUtc, endUtc);
            }

            return(filter.StartUtc.Value, filter.EndUtc.Value);
        }
コード例 #2
0
        private ProgressiveVolumesRequestArgument DefaultRequestArgFromModel(ISiteModel siteModel, VolumeComputationType volumeType)
        {
            var arg = DefaultRequestArg(siteModel.ID);

            var(startUtc, endUtc) = siteModel.GetDateRange();

            arg.VolumeType = volumeType;
            arg.StartDate  = startUtc;
            arg.EndDate    = endUtc;
            arg.Interval   = new TimeSpan((arg.EndDate.Ticks - arg.StartDate.Ticks) / 10);

            return(arg);
        }
コード例 #3
0
        public JsonResult GetDateRange(string siteModelID)
        {
            ISiteModel siteModel = DIContext.Obtain <ISiteModels>().GetSiteModel(Guid.Parse(siteModelID));

            if (siteModel == null)
            {
                return(new JsonResult(new Tuple <DateTime, DateTime>(Common.Consts.MIN_DATETIME_AS_UTC, Common.Consts.MIN_DATETIME_AS_UTC)));
            }

            var startEndDates = siteModel.GetDateRange();

            return(new JsonResult(new Tuple <DateTime, DateTime>(startEndDates.startUtc, startEndDates.endUtc)));
        }