コード例 #1
0
ファイル: LinkService.cs プロジェクト: Soucre/Working_git_vfs
 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);
     }
 }        
コード例 #2
0
ファイル: LinkDAOBase.cs プロジェクト: Soucre/Working_git_vfs
 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;
 }
コード例 #3
0
ファイル: LinkDAOBase.cs プロジェクト: Soucre/Working_git_vfs
 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);
     }
 }