コード例 #1
0
 public static void UpdateExtensionMessage(ExtensionMessage extensionMessage)
 {            
     try
     {
         ExtensionMessageDAO extensionMessageDAO = new ExtensionMessageDAO();
         extensionMessageDAO.UpdateExtensionMessage(extensionMessage);
     }
     catch (ApplicationException)
     {
         throw;
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.BusinessUpdateExtensionMessageException, ex);
     }
 }        
コード例 #2
0
 public virtual ExtensionMessage CreateExtensionMessageFromReader(IDataReader reader)
 {
     ExtensionMessage item = new ExtensionMessage();
     try
     {
         if (!reader.IsDBNull(reader.GetOrdinal("ExtensionMessageID"))) item.ExtensionMessageID = (long)reader["ExtensionMessageID"];
         if (!reader.IsDBNull(reader.GetOrdinal("Title"))) item.Title = (string)reader["Title"];
         if (!reader.IsDBNull(reader.GetOrdinal("Content"))) item.Content = (string)reader["Content"];
         if (!reader.IsDBNull(reader.GetOrdinal("CreatedDate"))) item.CreatedDate = (DateTime)reader["CreatedDate"];
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.DataAccessCreateExtensionMessageFromReaderException, ex);
     }
     return item;
 }
コード例 #3
0
 public virtual void UpdateExtensionMessage(ExtensionMessage extensionMessage)
 {
     try
     {
         Database database = DatabaseFactory.CreateDatabase();
         DbCommand dbCommand = database.GetStoredProcCommand("spExtensionMessageUpdate");            
         
         database.AddInParameter(dbCommand, "@ExtensionMessageID", DbType.Int64, extensionMessage.ExtensionMessageID);
         database.AddInParameter(dbCommand, "@Title", DbType.String, extensionMessage.Title);
         database.AddInParameter(dbCommand, "@Content", DbType.String, extensionMessage.Content);
         database.AddInParameter(dbCommand, "@CreatedDate", DbType.DateTime, extensionMessage.CreatedDate);
         
         database.ExecuteNonQuery(dbCommand);
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.DataAccessUpdateExtensionMessageException, ex);
     }
 }