// Token: 0x060008C7 RID: 2247 RVA: 0x0003F258 File Offset: 0x0003D458
        public static MaintenanceRenewalItemDAL GetItemForProduct(string productTag)
        {
            if (string.IsNullOrEmpty(productTag))
            {
                throw new ArgumentNullException("productTag");
            }
            MaintenanceRenewalItemDAL result;

            using (SqlCommand sqlCommand = new SqlCommand("SELECT * FROM NotificationMaintenanceRenewals LEFT JOIN NotificationItems ON \r\n                                                NotificationMaintenanceRenewals.RenewalID = NotificationItems.NotificationID\r\n                                              WHERE ProductTag=@ProductTag"))
            {
                sqlCommand.Parameters.AddWithValue("@ProductTag", productTag);
                using (IDataReader dataReader = SqlHelper.ExecuteReader(sqlCommand))
                {
                    if (dataReader.Read())
                    {
                        MaintenanceRenewalItemDAL maintenanceRenewalItemDAL = new MaintenanceRenewalItemDAL();
                        maintenanceRenewalItemDAL.LoadFromReader(dataReader);
                        result = maintenanceRenewalItemDAL;
                    }
                    else
                    {
                        result = null;
                    }
                }
            }
            return(result);
        }
 public static MaintenanceRenewalItemDAL Insert(
     Guid renewalId,
     string title,
     string description,
     bool ignored,
     string url,
     DateTime?acknowledgedAt,
     string acknowledgedBy,
     string productTag,
     DateTime dateReleased,
     string newVersion)
 {
     using (SqlConnection connection = DatabaseFunctions.CreateConnection())
     {
         using (SqlTransaction tr = connection.BeginTransaction())
         {
             try
             {
                 MaintenanceRenewalItemDAL maintenanceRenewalItemDal = MaintenanceRenewalItemDAL.Insert(connection, tr, renewalId, title, description, ignored, url, acknowledgedAt, acknowledgedBy, productTag, dateReleased, newVersion);
                 tr.Commit();
                 return(maintenanceRenewalItemDal);
             }
             catch (Exception ex)
             {
                 tr.Rollback();
                 NotificationItemDAL.log.Error((object)(string.Format("Can't INSERT maintenance renewal item: ") + ex.ToString()));
                 throw;
             }
         }
     }
 }
        private static MaintenanceRenewalItemDAL Insert(
            SqlConnection con,
            SqlTransaction tr,
            Guid renewalId,
            string title,
            string description,
            bool ignored,
            string url,
            DateTime?acknowledgedAt,
            string acknowledgedBy,
            string productTag,
            DateTime dateReleased,
            string newVersion)
        {
            if (tr == null)
            {
                throw new ArgumentNullException(nameof(tr));
            }
            if (string.IsNullOrEmpty(productTag))
            {
                throw new ArgumentNullException(nameof(productTag));
            }
            if (dateReleased == DateTime.MinValue)
            {
                throw new ArgumentNullException(nameof(dateReleased));
            }
            if (string.IsNullOrEmpty(newVersion))
            {
                throw new ArgumentNullException(nameof(newVersion));
            }
            MaintenanceRenewalItemDAL maintenanceRenewalItemDal = NotificationItemDAL.Insert <MaintenanceRenewalItemDAL>(con, tr, renewalId, title, description, ignored, url, acknowledgedAt, acknowledgedBy);

            if (maintenanceRenewalItemDal == null)
            {
                return((MaintenanceRenewalItemDAL)null);
            }
            using (SqlCommand sqlCommand = new SqlCommand("INSERT INTO NotificationMaintenanceRenewals (RenewalID, ProductTag, DateReleased, Version) VALUES (@RenewalID, @ProductTag, @DateReleased, @NewVersion)"))
            {
                sqlCommand.Parameters.AddWithValue("@RenewalID", (object)renewalId);
                sqlCommand.Parameters.AddWithValue("@ProductTag", (object)productTag);
                sqlCommand.Parameters.AddWithValue("@DateReleased", (object)dateReleased);
                sqlCommand.Parameters.AddWithValue("@NewVersion", (object)newVersion);
                if (SqlHelper.ExecuteNonQuery(sqlCommand, con, tr) == 0)
                {
                    maintenanceRenewalItemDal = (MaintenanceRenewalItemDAL)null;
                }
                else
                {
                    maintenanceRenewalItemDal.ProductTag   = productTag;
                    maintenanceRenewalItemDal.DateReleased = dateReleased;
                    maintenanceRenewalItemDal.NewVersion   = newVersion;
                }
            }
            return(maintenanceRenewalItemDal);
        }
 public static MaintenanceRenewalItemDAL GetItemForProduct(
     string productTag)
 {
     if (string.IsNullOrEmpty(productTag))
     {
         throw new ArgumentNullException(nameof(productTag));
     }
     using (SqlCommand sqlCommand = new SqlCommand("SELECT * FROM NotificationMaintenanceRenewals LEFT JOIN NotificationItems ON \r\n                                                NotificationMaintenanceRenewals.RenewalID = NotificationItems.NotificationID\r\n                                              WHERE ProductTag=@ProductTag"))
     {
         sqlCommand.Parameters.AddWithValue("@ProductTag", (object)productTag);
         using (IDataReader rd = SqlHelper.ExecuteReader(sqlCommand))
         {
             if (!rd.Read())
             {
                 return((MaintenanceRenewalItemDAL)null);
             }
             MaintenanceRenewalItemDAL maintenanceRenewalItemDal = new MaintenanceRenewalItemDAL();
             maintenanceRenewalItemDal.LoadFromReader(rd);
             return(maintenanceRenewalItemDal);
         }
     }
 }
        // Token: 0x060008C9 RID: 2249 RVA: 0x0003F400 File Offset: 0x0003D600
        public static MaintenanceRenewalItemDAL Insert(Guid renewalId, string title, string description, bool ignored, string url, DateTime?acknowledgedAt, string acknowledgedBy, string productTag, DateTime dateReleased, string newVersion)
        {
            MaintenanceRenewalItemDAL result;

            using (SqlConnection sqlConnection = DatabaseFunctions.CreateConnection())
            {
                using (SqlTransaction sqlTransaction = sqlConnection.BeginTransaction())
                {
                    try
                    {
                        MaintenanceRenewalItemDAL maintenanceRenewalItemDAL = MaintenanceRenewalItemDAL.Insert(sqlConnection, sqlTransaction, renewalId, title, description, ignored, url, acknowledgedAt, acknowledgedBy, productTag, dateReleased, newVersion);
                        sqlTransaction.Commit();
                        result = maintenanceRenewalItemDAL;
                    }
                    catch (Exception ex)
                    {
                        sqlTransaction.Rollback();
                        NotificationItemDAL.log.Error(string.Format("Can't INSERT maintenance renewal item: ", Array.Empty <object>()) + ex.ToString());
                        throw;
                    }
                }
            }
            return(result);
        }