/// <summary> /// Select all Creators for a BibId. /// </summary> /// <param name="sqlConnection">Sql connection or null.</param> /// <param name="sqlTransaction">Sql transaction or null.</param> /// <returns>Object of type Creator.</returns> private Stats StatsSelect( SqlConnection sqlConnection, SqlTransaction sqlTransaction, bool expanded, bool names) { SqlConnection connection = CustomSqlHelper.CreateConnection( CustomSqlHelper.GetConnectionStringFromConnectionStrings( "BHL" ), sqlConnection ); SqlTransaction transaction = sqlTransaction; using ( SqlCommand command = CustomSqlHelper.CreateCommand( "StatsSelect", connection, transaction, CustomSqlHelper.CreateInputParameter("Expanded", SqlDbType.Bit, null, false, expanded), CustomSqlHelper.CreateInputParameter("Names", SqlDbType.Bit, null, false, names))) { CustomGenericList<CustomDataRow> list = CustomSqlHelper.ExecuteReaderAndReturnRows( command ); CustomDataRow row = list[ 0 ]; Stats stats = new Stats(); stats.TitleCount = (int)row[ "TitleCount" ].Value; stats.VolumeCount = (int)row[ "VolumeCount" ].Value; stats.PageCount = (int)row[ "PageCount" ].Value; stats.PageTotal = (int)row[ "PageTotal" ].Value; stats.TitleTotal = (int)row[ "TitleTotal" ].Value; stats.VolumeTotal = (int)row[ "VolumeTotal" ].Value; stats.UniqueCount = (int)row[ "UniqueCount" ].Value; stats.UniqueTotal = (int)row[ "UniqueTotal" ].Value; return stats; } }
private string SelectExpandedNames() { try { MOBOT.BHL.DataObjects.Stats stats = null; stats = new BHLProvider().StatsSelectExpandedNames(); JavaScriptSerializer js = new JavaScriptSerializer(); return(js.Serialize(stats)); } catch { return(null); } }
protected void Page_Load(object sender, EventArgs e) { int ageLimit = Convert.ToInt32(ConfigurationManager.AppSettings["StatsPendingApprovalDownloadLimit"]); BHLProvider bp = new BHLProvider(); //BHLImportWebService.BHLImportWS ws = new BHLImportWebService.BHLImportWS(); //gvItemStatus.DataSource = ws.StatsSelectIAItemGroupByStatus(); //gvItemStatus.DataBind(); // Get the PDF generation stats gvPDFGeneration.DataSource = bp.PDFStatsSelectOverview(); gvPDFGeneration.DataBind(); // Get the data harvest stats //BHLImportWebService.Stats importStats = ws.StatsCountIAItemPendingApproval(ageLimit); litNumDays.Text = ageLimit.ToString(); //hypNumItems.NavigateUrl += ageLimit.ToString(); //hypNumItems.Text = importStats.NumberOfItems.ToString(); // Get the production stats String cacheKey = "DashboardStats"; MOBOT.BHL.DataObjects.Stats stats = null; if (Cache[cacheKey] != null) { // Use cached version stats = (MOBOT.BHL.DataObjects.Stats)Cache[cacheKey]; } else { // Refresh cache stats = bp.StatsSelectExpanded(); Cache.Add(cacheKey, stats, null, DateTime.Now.AddMinutes( Convert.ToDouble(ConfigurationManager.AppSettings["DashboardStatsCacheTime"])), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null); } titlesAllCell.InnerHtml = stats.TitleTotal.ToString(); titlesActiveCell.InnerHtml = stats.TitleCount.ToString(); itemsActiveCell.InnerHtml = stats.VolumeCount.ToString(); itemsAllCell.InnerHtml = stats.VolumeTotal.ToString(); pagesActiveCell.InnerHtml = stats.PageCount.ToString(); pagesAllCell.InnerHtml = stats.PageTotal.ToString(); string wid = (((float)stats.TitleCount / (float)stats.TitleTotal) * 100) + "%"; titlesGreenBar.Style["width"] = wid; wid = (((float)stats.VolumeCount / (float)stats.VolumeTotal) * 100) + "%"; itemsGreenBar.Style["width"] = wid; wid = (((float)stats.PageCount / (float)stats.PageTotal) * 100) + "%"; pagesGreenBar.Style["width"] = wid; if (stats.UniqueTotal == stats.UniqueCount) { uniqueGreenBar.Style["width"] = "100%"; uniqueWhiteBar.Visible = false; } else { wid = (((float)stats.UniqueCount / (float)stats.UniqueTotal) * 100) + "%"; uniqueGreenBar.Style["width"] = wid; } // Get the growth stats CustomGenericList <MonthlyStats> growthYear = bp.MonthlyStatsSelectCurrentYearSummary(); CustomGenericList <MonthlyStats> growthMonth = bp.MonthlyStatsSelectCurrentMonthSummary(); foreach (MonthlyStats stat in growthYear) { switch (stat.StatType) { case "Titles Created": titlesThisYear.InnerHtml = stat.StatValue.ToString(); break; case "Items Created": itemsThisYear.InnerHtml = stat.StatValue.ToString(); break; case "Pages Created": pagesThisYear.InnerHtml = stat.StatValue.ToString(); break; case "PageNames Created": namesThisYear.InnerHtml = stat.StatValue.ToString(); break; } } foreach (MonthlyStats stat in growthMonth) { switch (stat.StatType) { case "Titles Created": titlesThisMonth.InnerHtml = stat.StatValue.ToString(); break; case "Items Created": itemsThisMonth.InnerHtml = stat.StatValue.ToString(); break; case "Pages Created": pagesThisMonth.InnerHtml = stat.StatValue.ToString(); break; case "PageNames Created": namesThisMonth.InnerHtml = stat.StatValue.ToString(); break; } } }