private void SetDate() { switch (xtraTabControl1.SelectedTabPageIndex) { case 1: StartDateEdit.DateTime = DateTime.Parse("01." + Convert.ToString(MonthEdit.SelectedIndex + 1) + "." + Convert.ToString(YearEdit.Value)); EndDateEdit.DateTime = DateTimeDayOfMonthExtensions.LastDayOfMonth(StartDateEdit.DateTime); break; case 2: string year = Convert.ToString(YearEdit2.Value); switch (comboBoxEdit3.SelectedIndex) { case 0: StartDateEdit.DateTime = DateTime.Parse("01.01." + year); EndDateEdit.DateTime = DateTime.Parse("31.03." + year).SetEndDay(); break; case 1: StartDateEdit.DateTime = DateTime.Parse("01.04." + year); EndDateEdit.DateTime = DateTime.Parse("30.06." + year).SetEndDay(); break; case 2: StartDateEdit.DateTime = DateTime.Parse("01.07." + year); EndDateEdit.DateTime = DateTime.Parse("30.09." + year).SetEndDay(); break; case 3: StartDateEdit.DateTime = DateTime.Parse("01.10." + year); EndDateEdit.DateTime = DateTime.Parse("31.12." + year).SetEndDay(); break; } break; case 3: StartDateEdit.DateTime = DateTime.Parse("01.01." + Convert.ToString(YearEdit3.Value)); EndDateEdit.DateTime = DateTime.Parse("31.12." + Convert.ToString(YearEdit3.Value)).SetEndDay(); break; } }
public async Task <IEnumerable <UrlStatistic> > GetCountFromActualMonthForUserAsync(string userid) { var results = await _appDbContext.UrlStatistics.Where ( stat => ( (DateTimeDayOfMonthExtensions.Between(stat.EventDate, DateTimeDayOfMonthExtensions.FirstDayOfMonth(stat.EventDate), DateTimeDayOfMonthExtensions.LastDayOfMonth(stat.EventDate))) && (stat.Link.AdOwner.Id == userid) ) ).ToListAsync(); return(results); }