private DashboardList PublicationStatusList() { var dashboardList = new DashboardList(); var eventStatusMapping = PublicationStatusMapping(); foreach (var item in eventStatusMapping) { var count = 0; if (item.Key == (int)PublicationStatus.Verified) { foreach (var _item in item.Value) { count = 0; count = db.Publication.Count(q => db.PublicationApproval.Where(pa => pa.PublicationID == q.ID && pa.Status == PublicationApprovalStatus.None).OrderByDescending(pa => pa.ApprovalDate).FirstOrDefault().Level == (PublicationApprovalLevels)_item.Key); dashboardList.DashboardItemList.Add(new DashboardItemList() { StatusID = item.Key, StatusName = _item.Value, Count = count, ApprovalLevel = _item.Key }); } } else { if (item.Key == (int)PublicationStatus.VerifierRejected) { count = db.Publication.Count(q => q.Status == PublicationStatus.VerifierRejected || q.Status == PublicationStatus.ApproverRejected || q.Status == PublicationStatus.WithdrawalVerifierRejected || q.Status == PublicationStatus.WithdrawalApproverRejected); } else if (item.Key == (int)PublicationStatus.Trashed) { count = db.Publication.Count(q => q.Status == PublicationStatus.Trashed || q.Status == PublicationStatus.WithdrawalTrashed); } else { count = db.Publication.Count(q => (int)q.Status == item.Key); } dashboardList.DashboardItemList.Add(new DashboardItemList() { StatusID = item.Key, StatusName = item.Value.First().Value, Count = count }); } } return(dashboardList); }
/// <summary> /// Returns the dashboard content showing asynchronous operation status. /// </summary> /// <returns>The dashboard content. Can be null if no background operation managers, background operations or task processors.</returns> public virtual DashboardPanel GetAsynchronousOperationDashboardContent() { // Declare our list which will go into the panel. var list = new DashboardList(); // Iterate over all the background operation managers we can find // and add each of their background operations to the list. var taskQueueBackgroundOperationManagers = this .GetType() .GetPropertiesAndFieldsOfType <TaskQueueBackgroundOperationManager <TSecureConfiguration> >(this); foreach (var manager in taskQueueBackgroundOperationManagers.OrderBy(m => m.DashboardSortOrder)) { var listItems = manager.GetDashboardContent(); if (null == listItems) { continue; } list.Items.AddRange(listItems); } // Get the content from the task queue resolver. { var listItems = this.TaskManager.GetDashboardContent(this.TaskQueueResolver); if (null != listItems) { list.Items.AddRange(listItems); } } // Did we get anything? if (0 == list.Items.Count) { list.Items.Add(new DashboardListItem() { Title = "There are no current asynchronous operations.", StatusSummary = new DomainStatusSummary() { Status = VAF.Configuration.Domain.DomainStatus.Undefined } }); } // Return the panel. return(new DashboardPanel() { Title = "Asynchronous Operations", InnerContent = new DashboardContentCollection { new DashboardCustomContent($"<em>Time on server: {DateTime.Now.ToLocalTime().ToString("HH:mm:ss")}</em>"), list } }); }
private DashboardList SurveyStatusList() { var dashboardList = new DashboardList(); var SurveyStatusMapping = this.SurveyStatusMapping(); foreach (var item in SurveyStatusMapping) { var count = 0; if (item.Key == (int)SurveyStatus.Verified) { foreach (var _item in item.Value) { count = 0; count = db.Survey.Count(q => db.SurveyApproval.Where(pa => pa.SurveyID == q.ID && pa.Status == SurveyApprovalStatus.None).OrderByDescending(pa => pa.ApprovalDate).FirstOrDefault().Level == (SurveyApprovalLevels)_item.Key); dashboardList.DashboardItemList.Add(new DashboardItemList() { StatusID = item.Key, StatusName = _item.Value, Count = count, ApprovalLevel = _item.Key }); } } else { if (item.Key == (int)SurveyStatus.VerifierRejected) { count = db.Survey.Count(q => q.Status == SurveyStatus.VerifierRejected || q.Status == SurveyStatus.ApproverRejected); } else { count = db.Survey.Count(q => (int)q.Status == item.Key); } dashboardList.DashboardItemList.Add(new DashboardItemList() { StatusID = item.Key, StatusName = item.Value.First().Value, Count = count }); } } return(dashboardList); }
private DashboardList MediaEventDashboardStatusList() { var dashboardList = new DashboardList(); var eventStatusMapping = MediaEventStatusMapping(); foreach (var item in eventStatusMapping) { var count = db.EventMediaInterviewRequest.Count(x => (int)x.MediaStatus == item.Key && x.Display == true); dashboardList.DashboardItemList.Add(new DashboardItemList() { StatusID = item.Key, StatusName = item.Value, Count = count }); } return(dashboardList); }
private DashboardList ELearningDashboardStatusList() { var dashboardList = new DashboardList(); var eventStatusMapping = ELearningStatusMapping(); foreach (var item in eventStatusMapping) { var count = db.Courses.Count(x => (int)x.Status == item.Key && x.IsDeleted == false); dashboardList.DashboardItemList.Add(new DashboardItemList() { StatusID = item.Key, StatusName = item.Value, Count = count }); } return(dashboardList); }
public IHttpActionResult GetDashbordList(int userid, DashboardModule module) { //var userRole = db.UserRole.FirstOrDefault(x => x.UserId == 1); //if(userRole.RoleId == ) DashboardList dashboardList = new DashboardList(); if (module == DashboardModule.PublicEvent) { dashboardList = PublicEventDashboardStatusList(); } else if (module == DashboardModule.Courses) { dashboardList = ELearningDashboardStatusList(); } else if (module == DashboardModule.MediaInterview) { dashboardList = MediaEventDashboardStatusList(); } else if (module == DashboardModule.Exhibition) { dashboardList = ExhibitionEventDashboardStatusList(); } else if (module == DashboardModule.KMC) { dashboardList = KMCList(); } else if (module == DashboardModule.Publication) { dashboardList = PublicationStatusList(); } else if (module == DashboardModule.Survey) { dashboardList = SurveyStatusList(); } dashboardList.ModuleName = module; return(Ok(dashboardList)); }
private DashboardList PublicEventDashboardStatusList() { var dashboardList = new DashboardList(); //dashboardList.ModuleName = typeof(DashboardModule).GetEnumName(DashboardModule.eEvent); var eventStatusMapping = EventStatusMapping(); foreach (var item in eventStatusMapping) { var count = db.PublicEvent.Count(x => (int)x.EventStatus == item.Key && x.Display == true); dashboardList.DashboardItemList.Add(new DashboardItemList() { StatusID = item.Key, StatusName = item.Value, Count = count }); } return(dashboardList); }
private DashboardList KMCList() { var dashboardList = new DashboardList(); var items = db.KMCs.GroupBy(x => x.KMCCategoryId, (key, group) => new { CategoryID = key, Items = group.ToList() }) .ToList(); foreach (var item in items) { var itemList = new DashboardItemList(); itemList.Count = item.Items.Count; itemList.StatusName = db.KMCCategory.FirstOrDefault(x => x.Id == item.CategoryID).Title; itemList.RedirectLink = "/KMC/Manage/List/" + db.KMCCategory.FirstOrDefault(x => x.Id == item.CategoryID).Id; dashboardList.DashboardItemList.Add(itemList); } return(dashboardList); }
/// <summary> /// Returns the dashboard content showing background operation status. /// </summary> /// <returns>The dashboard content. Can be null if no background operation managers or background operations.</returns> public virtual DashboardPanel GetBackgroundOperationDashboardContent() { // Add each manager's data in turn. var list = new DashboardList(); foreach (var manager in this.GetTaskQueueBackgroundOperationManagers() ?? new TaskQueueBackgroundOperationManager[0]) { var listItems = manager.GetDashboardContent(); if (null == listItems) { continue; } list.Items.AddRange(listItems); } // Did we get anything? if (0 == list.Items.Count) { list.Items.Add(new DashboardListItem() { Title = "There are no current background operations.", StatusSummary = new Configuration.Domain.DomainStatusSummary() { Status = VAF.Configuration.Domain.DomainStatus.Undefined } }); } // Return the panel. return(new DashboardPanel() { Title = "Background Operations", InnerContent = new DashboardContentCollection { list, new DashboardCustomContent($"<em>Time on server: {DateTime.Now.ToLocalTime().ToString("HH:mm:ss")}</em>") } }); }