public static void UpdateLink(Link link) { try { LinkDAO linkDAO = new LinkDAO(); linkDAO.UpdateLink(link); } catch (ApplicationException) { throw; } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.BusinessUpdateLinkException, ex); } }
public virtual Link CreateLinkFromReader(IDataReader reader) { Link item = new Link(); try { if (!reader.IsDBNull(reader.GetOrdinal("LinkId"))) item.LinkId = (int)reader["LinkId"]; if (!reader.IsDBNull(reader.GetOrdinal("SourceId"))) item.SourceId = (int)reader["SourceId"]; if (!reader.IsDBNull(reader.GetOrdinal("Link"))) item.Link = (string)reader["Link"]; if (!reader.IsDBNull(reader.GetOrdinal("LinkShortDescription"))) item.LinkShortDescription = (string)reader["LinkShortDescription"]; if (!reader.IsDBNull(reader.GetOrdinal("LinkDescription"))) item.LinkDescription = (string)reader["LinkDescription"]; } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.DataAccessCreateLinkFromReaderException, ex); } return item; }
public virtual void UpdateLink(Link link) { try { Database database = DatabaseFactory.CreateDatabase(); DbCommand dbCommand = database.GetStoredProcCommand("spLinkUpdate"); database.AddInParameter(dbCommand, "@LinkId", DbType.Int32, link.LinkId); database.AddInParameter(dbCommand, "@SourceId", DbType.Int32, link.SourceId); database.AddInParameter(dbCommand, "@Link", DbType.String, link.Link); database.AddInParameter(dbCommand, "@LinkShortDescription", DbType.String, link.LinkShortDescription); database.AddInParameter(dbCommand, "@LinkDescription", DbType.String, link.LinkDescription); database.ExecuteNonQuery(dbCommand); } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.DataAccessUpdateLinkException, ex); } }