public virtual Source CreateSourceFromReader(IDataReader reader) { Source item = new Source(); try { if (!reader.IsDBNull(reader.GetOrdinal("SourceId"))) item.SourceId = (int)reader["SourceId"]; if (!reader.IsDBNull(reader.GetOrdinal("SiteName"))) item.SiteName = (string)reader["SiteName"]; if (!reader.IsDBNull(reader.GetOrdinal("URL"))) item.URL = (string)reader["URL"]; } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.DataAccessCreateSourceFromReaderException, ex); } return item; }
public static void UpdateSource(Source source) { try { SourceDAO sourceDAO = new SourceDAO(); sourceDAO.UpdateSource(source); } catch (ApplicationException) { throw; } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.BusinessUpdateSourceException, ex); } }
public virtual void UpdateSource(Source source) { try { Database database = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = database.GetStoredProcCommand("spSourceUpdate"); database.AddInParameter(dbCommand, "@SourceId", DbType.Int32, source.SourceId); database.AddInParameter(dbCommand, "@SiteName", DbType.String, source.SiteName); database.AddInParameter(dbCommand, "@URL", DbType.String, source.URL); database.ExecuteNonQuery(dbCommand); } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.DataAccessUpdateSourceException, ex); } }