Пример #1
0
        public ComparisonData GetComparisonDataForSiteCheck(ComparisonArgs args)
        {
            var data = new ComparisonData();

            using (var cmd = GetComparisonDataForSiteCheckCommand(args))
            {
                using (var reader = cmd.ExecuteReader())
                {
                    var row = 0;

                    while (reader.Read())
                    {
                        if (++row == 1)
                        {
                            data.Number = Convert.ToDouble(reader["ResultCount"]);
                        }
                        else
                        {
                            data.Comparison = Convert.ToDouble(reader["ResultCount"]);
                        }
                    }
                }
            }

            return(data);
        }
Пример #2
0
 protected override AdhocCommandBase GetComparisonDataForSiteCheckCommand(ComparisonArgs args)
 {
     return(SqlServerAdhocCommand.UsingSmartConnection(myConfig.ConnectionString)
            .WithSql(SqlServerStatement.Create(
                         "SELECT TOP 2 ResultCount FROM AgentData WHERE (ResultCount IS NOT NULL) AND (EventType = 'Result') AND (SiteId=")
                     .InsertParameter("@pSiteId", args.Site)
                     .Append(") AND (CheckId=")
                     .InsertParameter("@pCheckId", args.Check).Append(")")
                     .AppendIf(() => !string.IsNullOrEmpty(args.Tag), "AND (tag='{0}')", args.Tag)
                     .OrderBy("GeneratedOnUtc")));
 }
Пример #3
0
 protected abstract AdhocCommandBase GetComparisonDataForSiteCheckCommand(ComparisonArgs args);