public static async Task <IEnumerable <DashboardContentModel> > GetContentLog(DashboardSearchModel searchModel) { List <DashboardContentModel> modelResult = new List <DashboardContentModel>(); DashboardContentModel report = null; if (searchModel != null) { object[] param = new object[] { searchModel.OrganizationUrl, searchModel.StartDate, searchModel.EndDate, searchModel.ErrorRecord, searchModel.PageNumber, searchModel.PageSize }; var result = await ColligoO365RMOManager <DashboardContentLog> .ExecuteSqlQueryAsync(Procedure.UspReportGetContentLog, param); //converT data to framework model if (result != null && result.Any()) { Type source = typeof(DashboardContentLog); Type destination = typeof(DashboardContentModel); foreach (var item in result) { report = new DashboardContentModel(); CopyHelper.Copy(source, item, destination, report); modelResult.Add(report); } } } return(modelResult); }
public IActionResult Index() { var statistics = new DashboardContentModel() { RecipesCount = this.recipesRepository.All().Count(), ArticlesCount = this.articlesRepository.All().Count(), ReviewsCount = this.reviewsRepository.All().Count(), RegisteredUsers = this.usersRepository.All().Count(), Admins = this.usersRepository.All().Where(x => x.UserName == "Admin").Count(), ArticleCommentsCount = this.articleCommentRepository.All().Count(), CategoriesCount = this.categoryRepository.All().Count(), }; return(this.View(statistics)); }
public DashboardContentModel SetReportGraphModelData(int DashboardId, DataTable dt) { DashboardContentModel tmp = new DashboardContentModel(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { tmp.DashboardContentId = dr["DashboardContentId"] == DBNull.Value ? 0 : Convert.ToInt32(dr["DashboardContentId"]); tmp.Height = dr["CalculatedHeight"] == DBNull.Value ? 0 : Convert.ToInt32(dr["CalculatedHeight"]); tmp.Width = dr["CalculatedWidth"] == DBNull.Value ? Convert.ToDecimal(0) : Convert.ToDecimal(dr["CalculatedWidth"]); tmp.ReportID = dr["ReportGraphId"] == DBNull.Value ? 0 : Convert.ToInt32(dr["ReportGraphId"]); tmp.DisplayName = dr["DisplayName"] == DBNull.Value ? "" : Convert.ToString(dr["DisplayName"]); tmp.DashboardId = DashboardId; } } return(tmp); }
public List <DashboardContentModel> GetDashboardComponents(int dashboardID, DataTable dt) { List <DashboardContentModel> model = new List <DashboardContentModel>(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { DashboardContentModel tmp = new DashboardContentModel(); DataView dv = new DataView(dt); dv.RowFilter = "DashboardContentId = " + Convert.ToInt32(dr["DashboardContentId"]); DataTable dtDashContents = new DataTable(); dtDashContents = dv.ToTable(); tmp = SetReportGraphModelData(dashboardID, dtDashContents); model.Add(tmp); } } return(model); }