protected override void Initialize() { base.Initialize(); TypeSelectorItems.Insert(0, new ProductType { Name = "Не обрано", Id = -1 }); IntervalList = AggregationInterval.GetList(); SelectedInterval = IntervalList.FirstOrDefault(); ProductType = TypeSelectorItems.FirstOrDefault(); }
private DateTime CutTimeTo(DateTime dt, AggregationInterval intl) { switch (intl.Value) { case AggregationIntervalValue.Day: return(new DateTime(dt.Year, dt.Month, dt.Day)); case AggregationIntervalValue.Week: return(dt.Round(TimeSpan.FromDays(7))); case AggregationIntervalValue.Month: return(new DateTime(dt.Year, dt.Month, 1)); case AggregationIntervalValue.Quarter: return(new DateTime(dt.Year, ((int)(Math.Ceiling((double)dt.Month / 3) * 3 - 2)), 1)); case AggregationIntervalValue.Year: return(new DateTime(dt.Year, 1, 1)); } return(new DateTime()); }