public virtual void CreateRejectedStockNew(RejectedStockNew rejectedStockNew)
 {
     try
     {
         Database database = DatabaseFactory.CreateDatabase();
         DbCommand dbCommand = database.GetStoredProcCommand("spRejectedStockNewsInsert");
         
         database.AddInParameter(dbCommand, "@NewsTitle", DbType.String, rejectedStockNew.NewsTitle);
         database.AddInParameter(dbCommand, "@NewsDescription", DbType.String, rejectedStockNew.NewsDescription);
         database.AddInParameter(dbCommand, "@NewsContent", DbType.String, rejectedStockNew.NewsContent);
         database.AddInParameter(dbCommand, "@NewsDate", DbType.DateTime, rejectedStockNew.NewsDate);
         database.AddInParameter(dbCommand, "@NewsSource", DbType.String, rejectedStockNew.NewsSource);
         database.AddInParameter(dbCommand, "@ShareSymbol", DbType.String, rejectedStockNew.ShareSymbol);
         database.AddInParameter(dbCommand, "@UseUrl", DbType.Boolean, rejectedStockNew.UseUrl);
         database.AddInParameter(dbCommand, "@NewsUrl", DbType.String, rejectedStockNew.NewsUrl);
         database.AddInParameter(dbCommand, "@LanguageID", DbType.Int32, rejectedStockNew.LanguageID);
         database.AddInParameter(dbCommand, "@IsApproved", DbType.Int32, rejectedStockNew.IsApproved);
         database.AddInParameter(dbCommand, "@ImageUrl", DbType.String, rejectedStockNew.ImageUrl);
         database.AddInParameter(dbCommand, "@RejectedReason", DbType.String, rejectedStockNew.RejectedReason);
         database.AddInParameter(dbCommand, "@LinkId", DbType.Int32, rejectedStockNew.LinkId);
         database.AddInParameter(dbCommand, "@OriginalUrl", DbType.String, rejectedStockNew.OriginalUrl);
         database.AddInParameter(dbCommand, "@RejectedDate", DbType.DateTime, rejectedStockNew.RejectedDate);
         database.AddInParameter(dbCommand, "@NewsId", DbType.Int64, rejectedStockNew.NewsId);
         
         database.ExecuteNonQuery(dbCommand);
         //rejectedStockNew.NewsId = (long)database.GetParameterValue(dbCommand, "@NewsId");
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.DataAccessCreateRejectedStockNewException, ex);
     }
 }
 public virtual RejectedStockNew CreateRejectedStockNewFromReader(IDataReader reader)
 {
     RejectedStockNew item = new RejectedStockNew();
     try
     {
         if (!reader.IsDBNull(reader.GetOrdinal("NewsId"))) item.NewsId = (long)reader["NewsId"];
         if (!reader.IsDBNull(reader.GetOrdinal("NewsTitle"))) item.NewsTitle = (string)reader["NewsTitle"];
         if (!reader.IsDBNull(reader.GetOrdinal("NewsDescription"))) item.NewsDescription = (string)reader["NewsDescription"];
         if (!reader.IsDBNull(reader.GetOrdinal("NewsContent"))) item.NewsContent = (string)reader["NewsContent"];
         if (!reader.IsDBNull(reader.GetOrdinal("NewsDate"))) item.NewsDate = (DateTime)reader["NewsDate"];
         if (!reader.IsDBNull(reader.GetOrdinal("NewsSource"))) item.NewsSource = (string)reader["NewsSource"];
         if (!reader.IsDBNull(reader.GetOrdinal("ShareSymbol"))) item.ShareSymbol = (string)reader["ShareSymbol"];
         if (!reader.IsDBNull(reader.GetOrdinal("UseUrl"))) item.UseUrl = (bool)reader["UseUrl"];
         if (!reader.IsDBNull(reader.GetOrdinal("NewsUrl"))) item.NewsUrl = (string)reader["NewsUrl"];
         if (!reader.IsDBNull(reader.GetOrdinal("LanguageID"))) item.LanguageID = (int)reader["LanguageID"];
         if (!reader.IsDBNull(reader.GetOrdinal("IsApproved"))) item.IsApproved = (int)reader["IsApproved"];
         if (!reader.IsDBNull(reader.GetOrdinal("ImageUrl"))) item.ImageUrl = (string)reader["ImageUrl"];
         if (!reader.IsDBNull(reader.GetOrdinal("RejectedReason"))) item.RejectedReason = (string)reader["RejectedReason"];
         if (!reader.IsDBNull(reader.GetOrdinal("LinkId"))) item.LinkId = (int)reader["LinkId"];
         if (!reader.IsDBNull(reader.GetOrdinal("OriginalUrl"))) item.OriginalUrl = (string)reader["OriginalUrl"];
         if (!reader.IsDBNull(reader.GetOrdinal("RejectedDate"))) item.RejectedDate = (DateTime)reader["RejectedDate"];
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.DataAccessCreateRejectedStockNewFromReaderException, ex);
     }
     return item;
 }
 public static void UpdateRejectedStockNew(RejectedStockNew rejectedStockNew)
 {            
     try
     {
         RejectedStockNewDAO rejectedStockNewDAO = new RejectedStockNewDAO();
         rejectedStockNewDAO.UpdateRejectedStockNew(rejectedStockNew);
     }
     catch (ApplicationException)
     {
         throw;
     }
     catch (Exception ex)
     {
         // log this exception
         log4net.Util.LogLog.Error(ex.Message, ex);
         // wrap it and rethrow
         throw new ApplicationException(SR.BusinessUpdateRejectedStockNewException, ex);
     }
 }        
Esempio n. 4
0
 private void StoreToRejectedNews(StockNew stockNew)
 {
     RejectedStockNew rejectedStockNew = new RejectedStockNew();
     rejectedStockNew.NewsId = stockNew.NewsId;
     rejectedStockNew.NewsDate = stockNew.NewsDate;
     rejectedStockNew.NewsTitle = stockNew.NewsTitle;
     rejectedStockNew.NewsDescription = stockNew.NewsDescription;
     rejectedStockNew.NewsContent = stockNew.NewsContent;
     rejectedStockNew.NewsSource = stockNew.NewsSource;
     rejectedStockNew.ShareSymbol = stockNew.ShareSymbol;
     rejectedStockNew.UseUrl = stockNew.UseUrl;
     rejectedStockNew.NewsUrl = stockNew.NewsUrl;
     rejectedStockNew.LanguageID = stockNew.LanguageID;
     rejectedStockNew.ImageUrl = stockNew.ImageUrl;
     rejectedStockNew.LinkId = stockNew.LinkId;
     rejectedStockNew.OriginalUrl = stockNew.OriginalUrl;
     rejectedStockNew.RejectedDate = DateTime.Now;
     RejectedStockNewService.CreateRejectedStockNew(rejectedStockNew);
 }