/// <summary> /// Updates the news comment /// </summary> /// <param name="NewsCommentID">The news comment identifier</param> /// <param name="NewsID">The news identifier</param> /// <param name="CustomerID">The customer identifier</param> /// <param name="Title">The title</param> /// <param name="Comment">The comment</param> /// <param name="CreatedOn">The date and time of instance creation</param> /// <returns>News comment</returns> public static NewsComment UpdateNewsComment(int NewsCommentID, int NewsID, int CustomerID, string Title, string Comment, DateTime CreatedOn) { CreatedOn = DateTimeHelper.ConvertToUtcTime(CreatedOn); DBNewsComment dbItem = DBProviderManager <DBNewsProvider> .Provider.UpdateNewsComment(NewsCommentID, NewsID, CustomerID, Title, Comment, CreatedOn); NewsComment newsComment = DBMapping(dbItem); return(newsComment); }
/// <summary> /// Gets a news comment /// </summary> /// <param name="NewsCommentID">News comment identifer</param> /// <returns>News comment</returns> public static NewsComment GetNewsCommentByID(int NewsCommentID) { if (NewsCommentID == 0) { return(null); } DBNewsComment dbItem = DBProviderManager <DBNewsProvider> .Provider.GetNewsCommentByID(NewsCommentID); NewsComment newsComment = DBMapping(dbItem); return(newsComment); }
/// <summary> /// Inserts a news comment /// </summary> /// <param name="NewsID">The news identifier</param> /// <param name="CustomerID">The customer identifier</param> /// <param name="Title">The title</param> /// <param name="Comment">The comment</param> /// <param name="CreatedOn">The date and time of instance creation</param> /// <param name="notify">A value indicating whether to notify the store owner</param> /// <returns>News comment</returns> public static NewsComment InsertNewsComment(int NewsID, int CustomerID, string Title, string Comment, DateTime CreatedOn, bool notify) { CreatedOn = DateTimeHelper.ConvertToUtcTime(CreatedOn); DBNewsComment dbItem = DBProviderManager <DBNewsProvider> .Provider.InsertNewsComment(NewsID, CustomerID, Title, Comment, CreatedOn); NewsComment newsComment = DBMapping(dbItem); if (notify) { MessageManager.SendNewsCommentNotificationMessage(newsComment, LocalizationManager.DefaultAdminLanguage.LanguageID); } return(newsComment); }
private static NewsComment DBMapping(DBNewsComment dbItem) { if (dbItem == null) { return(null); } NewsComment item = new NewsComment(); item.NewsCommentID = dbItem.NewsCommentID; item.NewsID = dbItem.NewsID; item.CustomerID = dbItem.CustomerID; item.Title = dbItem.Title; item.Comment = dbItem.Comment; item.CreatedOn = dbItem.CreatedOn; return(item); }
private static NewsComment DBMapping(DBNewsComment dbItem) { if (dbItem == null) { return(null); } var item = new NewsComment(); item.NewsCommentId = dbItem.NewsCommentId; item.NewsId = dbItem.NewsId; item.CustomerId = dbItem.CustomerId; item.IPAddress = dbItem.IPAddress; item.Title = dbItem.Title; item.Comment = dbItem.Comment; item.CreatedOn = dbItem.CreatedOn; return(item); }