public string GetDiscussUrl(string discussEntryId)
        {
            var forumParams = ForumDiscussParams.Parse(Params);

            return(Globals.NavigateURL(forumParams.TabId, string.Empty,
                                       "forumId", forumParams.ForumId.ToString(),
                                       "postId", discussEntryId));
        }
Exemple #2
0
        public string Discuss(INewsEntry newsEntry, int portalId, int userId)
        {
            try {
                if (IsAvailable)
                {
                    var connector  = ReflectionHelper.New(connectorType);
                    var postMethod = ReflectionHelper.TryGetMethod(connectorType, "SubmitExternalPost", BindingFlags.Instance | BindingFlags.Public, 13);

                    var forumParams = ForumDiscussParams.Parse(Params);

                    var result = postMethod.Invoke(connector, new object [] {
                        forumParams.TabId,
                        forumParams.ModuleId,
                        portalId,
                        userId,
                        newsEntry.Title,
                        FormatMessage(newsEntry, forumParams.TabId, forumParams.ModuleId),
                        forumParams.ForumId,
                        0,         // ParentPostID
                        null,      // string of attachments
                        "R7.News", // provider
                        -1,        // ParentThreadID
                        newsEntry.ContentItem.Terms,
                        false      // IsPinned
                    });

                    var postId = (int)submitResultType.GetField("PostId").GetValue(result);
                    // var postMessage = (DnnForumPostMessage) submitResultType.GetField ("Result").GetValue (result);

                    return(postId.ToString());
                }
            } catch (Exception ex) {
                var log = new LogInfo();
                log.Exception   = new ExceptionInfo(ex);
                log.LogPortalID = portalId;
                log.LogTypeKey  = EventLogController.EventLogType.HOST_ALERT.ToString();
                EventLogController.Instance.AddLog(log);
            }

            return(null);
        }
        public string Discuss(INewsEntry newsEntry, int portalId, int userId)
        {
            try {
                if (IsAvailable)
                {
                    var connector  = ReflectionHelper.New(connectorType);
                    var postMethod = ReflectionHelper.TryGetMethod(connectorType, "Topic_QuickCreate", BindingFlags.Instance | BindingFlags.Public);

                    var forumParams = ForumDiscussParams.Parse(Params);

                    var result = postMethod.Invoke(connector, new object [] {
                        portalId,
                        forumParams.ModuleId,
                        forumParams.ForumId,
                        newsEntry.Title,
                        FormatMessage(newsEntry, forumParams.TabId, forumParams.ModuleId),
                        userId,
                        UserController.Instance.GetUserById(portalId, userId).DisplayName,
                        true, // IsApproved
                        "0.0.0.0"
                    });

                    var postId = (int)result;

                    return(postId.ToString());
                }
            } catch (Exception ex) {
                var log = new LogInfo();
                log.Exception   = new ExceptionInfo(ex);
                log.LogPortalID = portalId;
                log.LogTypeKey  = EventLogController.EventLogType.HOST_ALERT.ToString();
                EventLogController.Instance.AddLog(log);
            }

            return(null);
        }