コード例 #1
0
        public void UpdateSupportTypeFor(PackageStatistic stat, SupportType supportType)
        {
            const string sql = "UPDATE dbo.[PackageStatistics] SET LatestSupportType = @LatestSupportType WHERE Name = @Name";

            using (var con = new SqlConnection(_connectionString))
            {
                con.Open();
                using (var cmd = new SqlCommand(sql, con))
                {
                    cmd.Parameters.AddWithValue("Name", stat.Name);
                    cmd.Parameters.AddWithValue("LatestSupportType", supportType.ToString());
                    cmd.ExecuteNonQuery();
                }
            }
        }
コード例 #2
0
 private void UpdatePackage(PackageResult packageResult, PackageStatistic stat)
 {
     if (packageResult == null)
     {
         Log.Information("No result returned for {package}", stat.Name);
     }
     else if (!packageResult.WasSuccessful)
     {
         Log.Information("Error occured for retrieving {package}: {error}", stat.Name, packageResult.Error);
     }
     else if (stat.LatestSupportType != packageResult.SupportType && packageResult.SupportType != SupportType.Error)
     {
         Log.Information("Updating support type for {package} from {from} to {to}", stat.Name, stat.LatestSupportType,
                         packageResult.SupportType);
         _statisticsRepository.UpdateSupportTypeFor(stat, packageResult.SupportType);
     }
 }