コード例 #1
0
        public ActionResult DailyActivity(int?SelectedStudentId, DateTime?SelectedDate)
        {
            DailyActivityViewModel vm = new DailyActivityViewModel();

            if (SelectedStudentId != null && SelectedDate != null)
            {
                vm.SelectedDate      = (DateTime)SelectedDate;
                vm.SelectedStudentId = (int)SelectedStudentId;
                DateTime tomorrow = vm.SelectedDate.AddDays(1);

                //pull event logs
                List <EventLog> logs = Db.EventLogs
                                       .Where(u => u.SenderId == vm.SelectedStudentId)
                                       .Where(e => e.DateReceived > vm.SelectedDate)
                                       .Where(e => e.DateReceived < tomorrow)
                                       .ToList();
                foreach (EventLog log in logs)
                {
                    vm.ActivityItems.Add(log.DateReceived, log);
                }

                //pull request logs from azure storage
                var requestLogs = DomainObjectHelpers.GetActionRequests(1, vm.SelectedStudentId)
                                  .Where(l => l.CreatorId == vm.SelectedStudentId)
                                  .Where(l => l.AccessDate > vm.SelectedDate)
                                  .Where(l => l.AccessDate < tomorrow)
                                  .ToList();
                foreach (OSBIDE.Data.DomainObjects.ActionRequestLog log in requestLogs)
                {
                    vm.ActivityItems.Add(log.AccessDate, log);
                }

                //pull comments
                List <LogCommentEvent> comments = Db.LogCommentEvents
                                                  .Where(c => c.EventLog.SenderId == vm.SelectedStudentId)
                                                  .Where(c => c.EventDate > vm.SelectedDate)
                                                  .Where(c => c.EventDate < tomorrow)
                                                  .ToList();
                foreach (LogCommentEvent comment in comments)
                {
                    vm.ActivityItems.Add(comment.EventDate, comment);
                }
            }
            vm.Students = Db.Users.Where(u => u.RoleValue == (int)SystemRole.Student).OrderBy(s => s.LastName).ToList();

            return(View(vm));
        }
コード例 #2
0
        public object GetDailyActivity(Guid projectId, Guid dailyActivityId)
        {
            CurrentUserInfo currentUserInfo = _tokenHelper.GetUserInfo();

            if (!_projectLogic.IsProjectExist(currentUserInfo.Id, projectId))
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, new BaseResponse(ResponseStatus.Notfound.ToString(), ResponseMessagesModel.ProjectNotFound)));
            }

            DailyActivityData dailyActivityData = _dailyActivityLogic.GetDailyActivity(dailyActivityId);

            return(Request.CreateResponse(HttpStatusCode.OK, new BaseResponse(ResponseStatus.Success.ToString(),
                                                                              ResponseMessagesModel.Success, DailyActivityViewModel.GetDailyActivityViewModel(dailyActivityData))));
        }