Exemple #1
0
        public async Task <List <Notice> > GetUpcomingEvents(string userId)
        {
            var user = await _db.DBUsers
                       .Include(x => x.Batch)
                       .FirstOrDefaultAsync(x => x.Id == userId);

            var nextWeek     = CurrentTime.AddMonths(1);
            var primaryQuery = _db.Notices
                               .Include(x => x.DBFiles)
                               .Where(x => x.EventDate > CurrentTime &&
                                      x.EventDate <= nextWeek)
                               .Include(m => m.Batch)
                               .OrderBy(x => x.EventDate);

            if (user.Role == AppConstants.Admin)
            {
                var notices = await primaryQuery.ToListAsync();

                return(notices);
            }
            else
            {
                var notices = await primaryQuery.Where(x => x.Batch == null || x.Batch == user.Batch)
                              .ToListAsync();

                return(notices);
            }
        }
 private void btnMouthNext_BtnClick(object sender, EventArgs e)
 {
     panSelectYear.Visible  = false;
     panSelectMonth.Visible = false;
     CurrentTime            = CurrentTime.AddMonths(1);
 }