예제 #1
0
        protected void lnkbtnSubmitProposal_Click(object sender, EventArgs e)
        {
            try
            {
                if (UserId > -1)
                {
                    int postId = -1;
                    string title = "";
                    GetThreadTitle(out title, out postId);
                    title = txtProposalTitle.Text;
                    string body = txtProposalDescription.Text;

                    Ourspace_Utilities.View util = new Ourspace_Utilities.View();

                    int newPostId = (int)SqlHelper.ExecuteScalar(CONNECTION_STRING, "Ourspace_Forum_Post_Add", postId, -1, UserId, "::1", title, body, false, DateTime.Now, false, PortalId, -1, false, 0, true);
                    int threadId = util.GetThreadId(newPostId);
                    int forumId = (int)SqlHelper.ExecuteScalar(CONNECTION_STRING, "Ourspace_Forum_Id_From_Thread_Id", threadId);

                    var added = SqlHelper.ExecuteScalar(CONNECTION_STRING, "Forum_Forum_PostAdded", forumId, threadId, newPostId, UserId, "approve");

                    //RegisterSolutionProposal(thre;

                    // Sending emails to Thread Trackers (Subscribers)

                    util.SendEmailToThreadTrackers(threadId, newPostId, CultureInfo.CurrentCulture.ToString());
                    //SendEmailToThreadTrackers(threadId, newPostId);
                    //lblShowProposalSubmitted.Text = "yes";
                    Session["showProposeSuccess"] = true;
                    if (Request.QueryString["threadId"] != null)
                    {
                        threadId = int.Parse(Request.QueryString["threadId"]);
                        RegisterSolutionProposal(threadId, newPostId);

                        Response.Redirect(Request.Url.ToString().Replace("threadid=" + threadId, "postId=" + newPostId) + "#" + newPostId);
                    }
                    else if (Request.QueryString["postId"] != null)
                    {
                        RegisterSolutionProposal(threadId, newPostId);
                        Response.Redirect(Request.Url.ToString().Replace("postid=" + postId, "postId=" + newPostId) + "#" + newPostId);
                    }
                }

                if (CultureInfo.CurrentCulture.Name == "en-GB")
                {

                    hprlnkTermsAndCons.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(216, "");

                }
                else if (CultureInfo.CurrentCulture.Name == "el-GR")
                {

                    hprlnkTermsAndCons.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(217, "");

                }
                else if (CultureInfo.CurrentCulture.Name == "cs-CZ")
                {

                    hprlnkTermsAndCons.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(218, "");
                }
                else if (CultureInfo.CurrentCulture.Name == "de-AT")
                {

                    hprlnkTermsAndCons.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(219, "");

                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }
예제 #2
0
        protected void lnkbtnSubmitReply_Click(object sender, EventArgs e)
        {
            try
            {
                if (UserId > -1)
                {
                    string test = ctlAttachment.lstAttachmentIDs;

                    string text = txtEditor.Text;

                    string title = "";
                    Random random = new Random();
                    //Session["ATTACHMENTS_SESSION"] =

                    int postId = -1;
                    GetThreadTitle(out title, out postId);

                    int newPostId = (int)SqlHelper.ExecuteScalar(CONNECTION_STRING, "Ourspace_Forum_Post_Add", postId, -1, UserId, "::1", title, txtEditor.Text, false, DateTime.Now, false, PortalId, -1, false, 0, false);
                    // http://localhost/ourspace/OpenDebates/tabid/62/forumid/1/postid/25/scope/posts/language/en-GB/Default.aspx#25
                    Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                    int threadId = util.GetThreadId(newPostId);
                    int forumId = (int)SqlHelper.ExecuteScalar(CONNECTION_STRING, "Ourspace_Forum_Id_From_Thread_Id", threadId);

                    var added = SqlHelper.ExecuteScalar(CONNECTION_STRING, "Forum_Forum_PostAdded", forumId, threadId, newPostId, UserId, "approve");

                    int attachmentsSession = (int)Session["ATTACHMENTS_SESSION"];
                    AssignAttachmentsToPost(attachmentsSession, newPostId);

                    util.SubscribeUserToThread(threadId, forumId, UserId);

                    //Forum.PostConnector postConnector = new Forum.PostConnector();

                   //List<Entities.Content.Taxonomy.Term> terms = new List<Entities.Content.Taxonomy.Term>();
                    //postConnector.SubmitExternalPost(TabId, 381, 0, UserId, title, txtEditor.Text, forumId, threadId, ctlAttachment.lstAttachmentIDs,  "Ourspace_Texteditor:reply",threadId,terms);
                  // ctlAttachment.

                    //Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                    util.SendEmailToThreadTrackers(threadId, newPostId, CultureInfo.CurrentCulture.ToString());
                    Session["showPostSuccess"] = true;

                    if (Request.QueryString["threadId"] != null)
                    {
                        threadId = int.Parse(Request.QueryString["threadId"]);

                        string[] parameters = new string[3] { "postId=" + newPostId, "forumId=" + forumId, "scope=posts" };
                        string url = DotNetNuke.Common.Globals.NavigateURL(TabId, "", parameters);

                        //Response.Redirect(Request.Url.ToString().Replace("threadid=" + threadId, "postId=" + newPostId) + "#" + newPostId,true);
                        Response.Redirect(url);
                    }
                    else if (Request.QueryString["postId"] != null)
                    {
                        //Response.Redirect(Request.Url.ToString().Replace("postid=" + postId, "postId=" + newPostId) + "#" + newPostId,true);
                        string[] parameters = new string[3] { "postId=" + newPostId, "forumId=" + forumId, "scope=posts" };
                        string url = DotNetNuke.Common.Globals.NavigateURL(TabId, "", parameters);

                        //Response.Redirect(Request.Url.ToString().Replace("threadid=" + threadId, "postId=" + newPostId) + "#" + newPostId,true);
                        Response.Redirect(url);
                    }
                }
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }