/// <summary> /// Adds new report to the collection. /// </summary> /// <param name="report">The report.</param> public void AddReport(Report report) { if (reportList.Contains(report)) { return; } reportList.Add(report); }
/// <summary> /// Gets the report info. /// </summary> public Report GetReportDetails() { Report report = new Report(); HtmlNode nodeTableReportSurround = htmlDocument.DocumentNode.SelectSingleNode("//table[@id='report_surround']"); if (nodeTableReportSurround!=null) { } HtmlNode nodeTableAttacker = htmlDocument.DocumentNode.SelectSingleNode("//table[@id='attacker']"); if (nodeTableAttacker!=null) { HtmlNode nodeAttackerInfo = nodeTableAttacker.SelectSingleNode("./thead/tr/td[2]"); if (nodeAttackerInfo!=null) { HtmlNode attackerName = nodeAttackerInfo.SelectSingleNode("./a[1]"); if (attackerName!=null) { report.AttackerName = attackerName.InnerText; } HtmlNode attackerVillage = nodeAttackerInfo.SelectSingleNode("./a[2]"); if (attackerVillage != null) { report.AttackerVillage = attackerVillage.InnerText; report.AttackerUrl = attackerVillage.Attributes["href"].Value; } } } HtmlNode nodeDivResources = htmlDocument.DocumentNode.SelectSingleNode("//div[@class='res']"); if (nodeDivResources != null) { report.ResourcesText = nodeDivResources.InnerText; } HtmlNode nodeDivCarry = htmlDocument.DocumentNode.SelectSingleNode("//div[@class='carry']"); if (nodeDivCarry!=null) { report.CarryText = nodeDivCarry.InnerText; } return report; }
public int InsertReport(Report report) { return ExecuteNonQuery(String.Format(CultureInfo.InvariantCulture, "INSERT INTO Reports (Id) VALUES ({0});", report.Id)); }