Пример #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DataLayer dl = new DataLayer();

        if (Request.QueryString["post"] != null)
        {
            int iPostID  = Convert.ToInt32(Request.QueryString["post"]);
            int iTopicID = Convert.ToInt32(Request.QueryString["topic"]);
            dl.UpdateForumPost(iPostID, rteBody.Value);
            Response.Redirect("Topic.aspx?topic=" + iTopicID.ToString(), true);
        }
        else
        {
            int       iTopicID     = Convert.ToInt32(Request.QueryString["topic"]);
            DataTable dtTopic      = dl.GetForumTopicBy_TopicID(iTopicID);
            DateTime  dtPostedDate = DateTime.Now;
            dl.AddForumPost(iTopicID, User.Identity.Name, dtPostedDate, rteBody.Value);

            SmtpMail.SmtpServer = "relay-hosting.secureserver.net";
            MailMessage mm;
            mm            = new MailMessage();
            mm.BodyFormat = MailFormat.Html;
            mm.To         = "[email protected];[email protected]";
            mm.From       = "*****@*****.**";
            mm.Subject    = "Someone replied to a forum topic.";
            mm.Body       = dl.GetFullMemberNameBy_Email(User.Identity.Name) + " replied to the forum topic titled: " + dtTopic.Rows[0].ItemArray[4].ToString();
            mm.Body      += "<br /><a href=\"http://www.referralnetworx.com/Topic.aspx?topic=" + iTopicID.ToString() + "\">Click to view</a>";
            mm.Body      += "<br /><br />The post reply is below:<br /><br />" + rteBody.Value;
            SmtpMail.Send(mm);

            if (User.Identity.Name.ToLower() != dtTopic.Rows[0].ItemArray[2].ToString().ToLower())
            {
                mm            = new MailMessage();
                mm.BodyFormat = MailFormat.Html;
                mm.To         = dtTopic.Rows[0].ItemArray[2].ToString();
                mm.From       = "*****@*****.**";
                mm.Subject    = "Someone replied to your forum topic.";
                mm.Body       = dl.GetFullMemberNameBy_Email(User.Identity.Name) + " replied to your forum topic titled: " + dtTopic.Rows[0].ItemArray[4].ToString();
                mm.Body      += "<br /><a href=\"http://www.referralnetworx.com/Topic.aspx?topic=" + iTopicID.ToString() + "\">Click to view</a>";
                SmtpMail.Send(mm);
            }

            Response.Redirect("Topic.aspx?topic=" + iTopicID.ToString(), true);
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        DataLayer dl = new DataLayer();
        if (Request.QueryString["post"] != null)
        {
            int iPostID = Convert.ToInt32(Request.QueryString["post"]);
            int iTopicID = Convert.ToInt32(Request.QueryString["topic"]);
            dl.UpdateForumPost(iPostID, rteBody.Value);
            Response.Redirect("Topic.aspx?topic=" + iTopicID.ToString(), true);
        }
        else
        {
            int iTopicID = Convert.ToInt32(Request.QueryString["topic"]);
            DataTable dtTopic = dl.GetForumTopicBy_TopicID(iTopicID);
            DateTime dtPostedDate = DateTime.Now;
            dl.AddForumPost(iTopicID, User.Identity.Name, dtPostedDate, rteBody.Value);

            SmtpMail.SmtpServer = "relay-hosting.secureserver.net";
            MailMessage mm;
            mm = new MailMessage();
            mm.BodyFormat = MailFormat.Html;
            mm.To = "[email protected];[email protected]";
            mm.From = "*****@*****.**";
            mm.Subject = "Someone replied to a forum topic.";
            mm.Body = dl.GetFullMemberNameBy_Email(User.Identity.Name) + " replied to the forum topic titled: " + dtTopic.Rows[0].ItemArray[4].ToString();
            mm.Body += "<br /><a href=\"http://www.referralnetworx.com/Topic.aspx?topic=" + iTopicID.ToString() + "\">Click to view</a>";
            mm.Body += "<br /><br />The post reply is below:<br /><br />" + rteBody.Value;
            SmtpMail.Send(mm);

            if (User.Identity.Name.ToLower() != dtTopic.Rows[0].ItemArray[2].ToString().ToLower())
            {
                mm = new MailMessage();
                mm.BodyFormat = MailFormat.Html;
                mm.To = dtTopic.Rows[0].ItemArray[2].ToString();
                mm.From = "*****@*****.**";
                mm.Subject = "Someone replied to your forum topic.";
                mm.Body = dl.GetFullMemberNameBy_Email(User.Identity.Name) + " replied to your forum topic titled: " + dtTopic.Rows[0].ItemArray[4].ToString();
                mm.Body += "<br /><a href=\"http://www.referralnetworx.com/Topic.aspx?topic=" + iTopicID.ToString() + "\">Click to view</a>";
                SmtpMail.Send(mm);
            }

            Response.Redirect("Topic.aspx?topic=" + iTopicID.ToString(), true);
        }
    }