/src/Libraries/Nop.Services/Forums/IForumService.cs

# · C# · 350 lines · 61 code · 44 blank · 245 comment · 0 complexity · 14245b3a3167be069bb421ab092cd28d MD5 · raw file

  1. using System.Collections.Generic;
  2. using Nop.Core;
  3. using Nop.Core.Domain.Customers;
  4. using Nop.Core.Domain.Forums;
  5. namespace Nop.Services.Forums
  6. {
  7. /// <summary>
  8. /// Forum service interface
  9. /// </summary>
  10. public partial interface IForumService
  11. {
  12. /// <summary>
  13. /// Deletes a forum group
  14. /// </summary>
  15. /// <param name="forumGroup">Forum group</param>
  16. void DeleteForumGroup(ForumGroup forumGroup);
  17. /// <summary>
  18. /// Gets a forum group
  19. /// </summary>
  20. /// <param name="forumGroupId">The forum group identifier</param>
  21. /// <returns>Forum group</returns>
  22. ForumGroup GetForumGroupById(int forumGroupId);
  23. /// <summary>
  24. /// Gets all forum groups
  25. /// </summary>
  26. /// <returns>Forum groups</returns>
  27. IList<ForumGroup> GetAllForumGroups();
  28. /// <summary>
  29. /// Inserts a forum group
  30. /// </summary>
  31. /// <param name="forumGroup">Forum group</param>
  32. void InsertForumGroup(ForumGroup forumGroup);
  33. /// <summary>
  34. /// Updates the forum group
  35. /// </summary>
  36. /// <param name="forumGroup">Forum group</param>
  37. void UpdateForumGroup(ForumGroup forumGroup);
  38. /// <summary>
  39. /// Deletes a forum
  40. /// </summary>
  41. /// <param name="forum">Forum</param>
  42. void DeleteForum(Forum forum);
  43. /// <summary>
  44. /// Gets a forum
  45. /// </summary>
  46. /// <param name="forumId">The forum identifier</param>
  47. /// <returns>Forum</returns>
  48. Forum GetForumById(int forumId);
  49. /// <summary>
  50. /// Gets forums by group identifier
  51. /// </summary>
  52. /// <param name="forumGroupId">The forum group identifier</param>
  53. /// <returns>Forums</returns>
  54. IList<Forum> GetAllForumsByGroupId(int forumGroupId);
  55. /// <summary>
  56. /// Inserts a forum
  57. /// </summary>
  58. /// <param name="forum">Forum</param>
  59. void InsertForum(Forum forum);
  60. /// <summary>
  61. /// Updates the forum
  62. /// </summary>
  63. /// <param name="forum">Forum</param>
  64. void UpdateForum(Forum forum);
  65. /// <summary>
  66. /// Deletes a forum topic
  67. /// </summary>
  68. /// <param name="forumTopic">Forum topic</param>
  69. void DeleteTopic(ForumTopic forumTopic);
  70. /// <summary>
  71. /// Gets a forum topic
  72. /// </summary>
  73. /// <param name="forumTopicId">The forum topic identifier</param>
  74. /// <returns>Forum Topic</returns>
  75. ForumTopic GetTopicById(int forumTopicId);
  76. /// <summary>
  77. /// Gets a forum topic
  78. /// </summary>
  79. /// <param name="forumTopicId">The forum topic identifier</param>
  80. /// <param name="increaseViews">The value indicating whether to increase forum topic views</param>
  81. /// <returns>Forum Topic</returns>
  82. ForumTopic GetTopicById(int forumTopicId, bool increaseViews);
  83. /// <summary>
  84. /// Gets all forum topics
  85. /// </summary>
  86. /// <param name="forumId">The forum identifier</param>
  87. /// <param name="customerId">The customer identifier</param>
  88. /// <param name="keywords">Keywords</param>
  89. /// <param name="searchType">Search type</param>
  90. /// <param name="limitDays">Limit by the last number days; 0 to load all topics</param>
  91. /// <param name="pageIndex">Page index</param>
  92. /// <param name="pageSize">Page size</param>
  93. /// <returns>Forum Topics</returns>
  94. IPagedList<ForumTopic> GetAllTopics(int forumId,
  95. int customerId, string keywords, ForumSearchType searchType,
  96. int limitDays, int pageIndex, int pageSize);
  97. /// <summary>
  98. /// Gets active forum topics
  99. /// </summary>
  100. /// <param name="forumId">The forum identifier</param>
  101. /// <param name="topicCount">Count of forum topics to return</param>
  102. /// <returns>Forum Topics</returns>
  103. IList<ForumTopic> GetActiveTopics(int forumId, int topicCount);
  104. /// <summary>
  105. /// Inserts a forum topic
  106. /// </summary>
  107. /// <param name="forumTopic">Forum topic</param>
  108. /// <param name="sendNotifications">A value indicating whether to send notifications to subscribed customers</param>
  109. void InsertTopic(ForumTopic forumTopic, bool sendNotifications);
  110. /// <summary>
  111. /// Updates the forum topic
  112. /// </summary>
  113. /// <param name="forumTopic">Forum topic</param>
  114. void UpdateTopic(ForumTopic forumTopic);
  115. /// <summary>
  116. /// Moves the forum topic
  117. /// </summary>
  118. /// <param name="forumTopicId">The forum topic identifier</param>
  119. /// <param name="newForumId">New forum identifier</param>
  120. /// <returns>Moved forum topic</returns>
  121. ForumTopic MoveTopic(int forumTopicId, int newForumId);
  122. /// <summary>
  123. /// Deletes a forum post
  124. /// </summary>
  125. /// <param name="forumPost">Forum post</param>
  126. void DeletePost(ForumPost forumPost);
  127. /// <summary>
  128. /// Gets a forum post
  129. /// </summary>
  130. /// <param name="forumPostId">The forum post identifier</param>
  131. /// <returns>Forum Post</returns>
  132. ForumPost GetPostById(int forumPostId);
  133. /// <summary>
  134. /// Gets all forum posts
  135. /// </summary>
  136. /// <param name="forumTopicId">The forum topic identifier</param>
  137. /// <param name="customerId">The customer identifier</param>
  138. /// <param name="keywords">Keywords</param>
  139. /// <param name="pageIndex">Page index</param>
  140. /// <param name="pageSize">Page size</param>
  141. /// <returns>Posts</returns>
  142. IPagedList<ForumPost> GetAllPosts(int forumTopicId,
  143. int customerId, string keywords, int pageIndex, int pageSize);
  144. /// <summary>
  145. /// Gets all forum posts
  146. /// </summary>
  147. /// <param name="forumTopicId">The forum topic identifier</param>
  148. /// <param name="customerId">The customer identifier</param>
  149. /// <param name="keywords">Keywords</param>
  150. /// <param name="ascSort">Sort order</param>
  151. /// <param name="pageIndex">Page index</param>
  152. /// <param name="pageSize">Page size</param>
  153. /// <returns>Forum Posts</returns>
  154. IPagedList<ForumPost> GetAllPosts(int forumTopicId, int customerId,
  155. string keywords, bool ascSort, int pageIndex, int pageSize);
  156. /// <summary>
  157. /// Inserts a forum post
  158. /// </summary>
  159. /// <param name="forumPost">The forum post</param>
  160. /// <param name="sendNotifications">A value indicating whether to send notifications to subscribed customers</param>
  161. void InsertPost(ForumPost forumPost, bool sendNotifications);
  162. /// <summary>
  163. /// Updates the forum post
  164. /// </summary>
  165. /// <param name="forumPost">Forum post</param>
  166. void UpdatePost(ForumPost forumPost);
  167. /// <summary>
  168. /// Deletes a private message
  169. /// </summary>
  170. /// <param name="privateMessage">Private message</param>
  171. void DeletePrivateMessage(PrivateMessage privateMessage);
  172. /// <summary>
  173. /// Gets a private message
  174. /// </summary>
  175. /// <param name="privateMessageId">The private message identifier</param>
  176. /// <returns>Private message</returns>
  177. PrivateMessage GetPrivateMessageById(int privateMessageId);
  178. /// <summary>
  179. /// Gets private messages
  180. /// </summary>
  181. /// <param name="storeId">The store identifier; pass 0 to load all messages</param>
  182. /// <param name="fromCustomerId">The customer identifier who sent the message</param>
  183. /// <param name="toCustomerId">The customer identifier who should receive the message</param>
  184. /// <param name="isRead">A value indicating whether loaded messages are read. false - to load not read messages only, 1 to load read messages only, null to load all messages</param>
  185. /// <param name="isDeletedByAuthor">A value indicating whether loaded messages are deleted by author. false - messages are not deleted by author, null to load all messages</param>
  186. /// <param name="isDeletedByRecipient">A value indicating whether loaded messages are deleted by recipient. false - messages are not deleted by recipient, null to load all messages</param>
  187. /// <param name="keywords">Keywords</param>
  188. /// <param name="pageIndex">Page index</param>
  189. /// <param name="pageSize">Page size</param>
  190. /// <returns>Private messages</returns>
  191. IPagedList<PrivateMessage> GetAllPrivateMessages(int storeId, int fromCustomerId,
  192. int toCustomerId, bool? isRead, bool? isDeletedByAuthor, bool? isDeletedByRecipient,
  193. string keywords, int pageIndex, int pageSize);
  194. /// <summary>
  195. /// Inserts a private message
  196. /// </summary>
  197. /// <param name="privateMessage">Private message</param>
  198. void InsertPrivateMessage(PrivateMessage privateMessage);
  199. /// <summary>
  200. /// Updates the private message
  201. /// </summary>
  202. /// <param name="privateMessage">Private message</param>
  203. void UpdatePrivateMessage(PrivateMessage privateMessage);
  204. /// <summary>
  205. /// Deletes a forum subscription
  206. /// </summary>
  207. /// <param name="forumSubscription">Forum subscription</param>
  208. void DeleteSubscription(ForumSubscription forumSubscription);
  209. /// <summary>
  210. /// Gets a forum subscription
  211. /// </summary>
  212. /// <param name="forumSubscriptionId">The forum subscription identifier</param>
  213. /// <returns>Forum subscription</returns>
  214. ForumSubscription GetSubscriptionById(int forumSubscriptionId);
  215. /// <summary>
  216. /// Gets forum subscriptions
  217. /// </summary>
  218. /// <param name="customerId">The customer identifier</param>
  219. /// <param name="forumId">The forum identifier</param>
  220. /// <param name="topicId">The topic identifier</param>
  221. /// <param name="pageIndex">Page index</param>
  222. /// <param name="pageSize">Page size</param>
  223. /// <returns>Forum subscriptions</returns>
  224. IPagedList<ForumSubscription> GetAllSubscriptions(int customerId, int forumId,
  225. int topicId, int pageIndex, int pageSize);
  226. /// <summary>
  227. /// Inserts a forum subscription
  228. /// </summary>
  229. /// <param name="forumSubscription">Forum subscription</param>
  230. void InsertSubscription(ForumSubscription forumSubscription);
  231. /// <summary>
  232. /// Updates the forum subscription
  233. /// </summary>
  234. /// <param name="forumSubscription">Forum subscription</param>
  235. void UpdateSubscription(ForumSubscription forumSubscription);
  236. /// <summary>
  237. /// Check whether customer is allowed to create new topics
  238. /// </summary>
  239. /// <param name="customer">Customer</param>
  240. /// <param name="forum">Forum</param>
  241. /// <returns>True if allowed, otherwise false</returns>
  242. bool IsCustomerAllowedToCreateTopic(Customer customer, Forum forum);
  243. /// <summary>
  244. /// Check whether customer is allowed to edit topic
  245. /// </summary>
  246. /// <param name="customer">Customer</param>
  247. /// <param name="topic">Topic</param>
  248. /// <returns>True if allowed, otherwise false</returns>
  249. bool IsCustomerAllowedToEditTopic(Customer customer, ForumTopic topic);
  250. /// <summary>
  251. /// Check whether customer is allowed to move topic
  252. /// </summary>
  253. /// <param name="customer">Customer</param>
  254. /// <param name="topic">Topic</param>
  255. /// <returns>True if allowed, otherwise false</returns>
  256. bool IsCustomerAllowedToMoveTopic(Customer customer, ForumTopic topic);
  257. /// <summary>
  258. /// Check whether customer is allowed to delete topic
  259. /// </summary>
  260. /// <param name="customer">Customer</param>
  261. /// <param name="topic">Topic</param>
  262. /// <returns>True if allowed, otherwise false</returns>
  263. bool IsCustomerAllowedToDeleteTopic(Customer customer, ForumTopic topic);
  264. /// <summary>
  265. /// Check whether customer is allowed to create new post
  266. /// </summary>
  267. /// <param name="customer">Customer</param>
  268. /// <param name="topic">Topic</param>
  269. /// <returns>True if allowed, otherwise false</returns>
  270. bool IsCustomerAllowedToCreatePost(Customer customer, ForumTopic topic);
  271. /// <summary>
  272. /// Check whether customer is allowed to edit post
  273. /// </summary>
  274. /// <param name="customer">Customer</param>
  275. /// <param name="post">Topic</param>
  276. /// <returns>True if allowed, otherwise false</returns>
  277. bool IsCustomerAllowedToEditPost(Customer customer, ForumPost post);
  278. /// <summary>
  279. /// Check whether customer is allowed to delete post
  280. /// </summary>
  281. /// <param name="customer">Customer</param>
  282. /// <param name="post">Topic</param>
  283. /// <returns>True if allowed, otherwise false</returns>
  284. bool IsCustomerAllowedToDeletePost(Customer customer, ForumPost post);
  285. /// <summary>
  286. /// Check whether customer is allowed to set topic priority
  287. /// </summary>
  288. /// <param name="customer">Customer</param>
  289. /// <returns>True if allowed, otherwise false</returns>
  290. bool IsCustomerAllowedToSetTopicPriority(Customer customer);
  291. /// <summary>
  292. /// Check whether customer is allowed to watch topics
  293. /// </summary>
  294. /// <param name="customer">Customer</param>
  295. /// <returns>True if allowed, otherwise false</returns>
  296. bool IsCustomerAllowedToSubscribe(Customer customer);
  297. /// <summary>
  298. /// Calculates topic page index by post identifier
  299. /// </summary>
  300. /// <param name="forumTopicId">Topic identifier</param>
  301. /// <param name="pageSize">Page size</param>
  302. /// <param name="postId">Post identifier</param>
  303. /// <returns>Page index</returns>
  304. int CalculateTopicPageIndex(int forumTopicId, int pageSize, int postId);
  305. }
  306. }