public void TestStatisticsSp() { var dal = new CoiStatisicsManager(); var table = dal.GetCrawlerStatistics(); Assert.IsNotNull(table); Assert.Greater(table.Rows.Count, 0); foreach (var row in table) { Console.WriteLine(row.Count.ToString("#,###") + " " + row.Description); } }
protected void Page_Load(object sender, EventArgs e) { var manager = new CoiStatisicsManager(); var table = manager.GetFormIngestQueue(); this.GridView1.DataSource = table; this.GridView1.DataBind(); if (this.GridView1.Columns.Count == 2) { this.GridView1.Columns[0].HeaderText = "Count"; this.GridView1.Columns[1].HeaderText = "Description"; } }
private void ParSearchToHTMLBySortOrder(string sort, bool usingCompanyHeaders, bool generateControls) { var description = DateTime.Now.ToString("yyyy-MM-dd HH:mm") + " | " + TextSearchForms.Text.Replace("\r\n", " "); if (description.Length > 100) { description = description.Substring(0, 100); } try{ SaveSearch(description, AutoSaveSearchType); } catch (Exception e) { e.ToString(); } var lastCo = string.Empty; var paragraphResultsCount = 0; var dtst = GetDtst(); var vw = new DataView(dtst.MPSresults, "", sort, DataViewRowState.CurrentRows); if (generateControls) { Session["dtst"] = dtst; } var table2 = new StringWriter(); var table0 = new StringWriter(); CheckBoxControlsVisible.Checked = false; //data table2.WriteLine(TableHead); _alternateRowBackground = true; foreach (DataRowView srchResV in vw) { var srchRes = (DtstFilingSearchResult.MPSresultsRow)srchResV.Row; if (srchRes.Paragraph.Trim() == string.Empty) { srchRes.Paragraph = "-"; } if (usingCompanyHeaders && srchRes.Company != lastCo) { lastCo = srchRes.Company; var cell = "Company: " + lastCo + "<a name=\"C" + Companies.IndexOf(lastCo) + "\">"; table2.WriteLine(GenRowInverse(GenCell(2) + GenCell(cell))); } var tr = string.Empty; tr += GenCell(srchRes.Date.ToString("yyyy MMM-dd")); var c0 = srchRes.Company; if (Companies.IndexOf(c0) > -1 && !usingCompanyHeaders) { c0 += "<a name=\"C" + Companies.IndexOf(c0).ToString() + "\">"; } tr += GenCell(c0); string p1; try{ p1 = srchRes.Paragraph.Replace( srchRes.Keyword, "<b><u>" + srchRes.Keyword + "</b></u>"); } catch { p1 = srchRes.Paragraph; } if (p1.Contains("<S>") & !p1.Contains("</S>")) { p1 = p1.Replace("<S>", ""); } if (p1.Contains("<s>") & !p1.Contains("</s>")) { p1 = p1.Replace("<s>", ""); } tr += GenCell("<b>Company: " + srchRes.Company + " | Date: " + srchRes.Date.ToString("yyyy-MM-dd") + " | Type: " + srchRes.Form + " | Keyword: " + srchRes.Keyword + "</b><br/>" + p1); paragraphResultsCount++; tr = GenRow(tr); table2.WriteLine(tr); if (!generateControls) { continue; } _lightgray = !_lightgray; table2.WriteLine(GenRow(GenCell(2) + GenCell("<a href=\"./SaveSnippetAsEvent.aspx?resultId=" + srchRes.rowID + "\" target=\"_blank\">Save this snippet as event</a> - " + "<a href=\"ViewEditForm.aspx?formID=" + srchRes.FormID.ToString() + "\" target=\"_blank\">View Form</a>"))); } table2.WriteLine(TableFoot); //header(statistics) table0.WriteLine(TableHeadSimple); _alternateRowBackground = false; table0.WriteLine(GenRow(GenCell("Form search criteria: ", "bold") + GenCell(1) + GenCell(TextSearchForms.Text))); table0.WriteLine(GenRow(GenCell("Paragraph search criteria: ", "bold") + GenCell(1) + GenCell(TextSearchPars.Text.Replace("\r\n", " OR ")))); var index = new SortedList <DateTime, string>(); foreach (var c in Companies) { var i = Companies.IndexOf(c); var s = MinDates[i].ToString("MMM/yyyy") + " .. " + MaxDates[i].ToString("MMM/yyyy") + " <a href='#C" + i + "'>" + c + "</a> ("; foreach (var k in KeywordsPerCo[i]) { s += k; if (KeywordsPerCo[i].IndexOf(k) < KeywordsPerCo[i].Count - 1) { s += ", "; } } s += ")<br /> "; index.Add(MinDates[i], s); } table0.WriteLine(GenRow(GenCell("Companies: ", "bold") + GenCell(1))); foreach (var s in index.Values) { table0.WriteLine(GenRow(GenCell(2) + GenCell(s))); } var stat = new CoiStatisicsManager().GetCrawlerStatistics(); table0.WriteLine(GenRow(GenCell("Result set statistics", "bold") + GenCell(2))); table0.WriteLine(GenRow(GenCell(1) + GenCell(paragraphResultsCount.ToString("#,###"), "bodyRight") + GenCell("paragraphs"))); table0.WriteLine(GenRow(GenCell(1) + GenCell(Companies.Count.ToString("#,###"), "bodyRight") + GenCell("companies"))); table0.WriteLine(GenRow(GenCell("Database statistics", "bold") + GenCell(2))); foreach (var row in stat) { table0.WriteLine(GenRow(GenCell(1) + GenCell(row.Count.ToString("#,###"), "bodyRight") + GenCell(row.Description))); } table0.WriteLine(TableFoot); //output Literal1.Text = table0.ToString() + table2.ToString(); }