Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strCommentId = Request.QueryString["commentId"];
        strCommentId = Server.UrlDecode(strCommentId);
        strCommentId = strCommentId.Replace('$', '+');
        strCommentId = Tools.Decrypt(strCommentId, true);
        strCommentId = strCommentId.Split('.')[0];

        int commentId = 0;
        int.TryParse(strCommentId, out commentId);

        string mapPathHtmls = System.Configuration.ConfigurationManager.AppSettings["PhysicalPath"] + @"\htmls";
        string template = mapPathHtmls + "\\MailReply.htm";
        MailData data = new MailData();

        PostAroundServiceClient client = new PostAroundServiceClient();

        Comment currComment = client.GetCommentByID(commentId);
        MyMessage mainMessage = client.GetMessageById(currComment.messageID, "", "", 0, 0, 0);
        User senderUser = client.GetUserByID(currComment.userID);
        client.Close();

        postHeader = mainMessage.title;
        postId = currComment.messageID;
        date = DateTime.Now.ToString("d MMMM, yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));
        message = currComment.body;
        senderFName = senderUser.firstName;
        senderFullName = senderUser.firstName + " " + senderUser.lastName;
        senderImage = senderUser.avatarImageUrl;
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {

            this.MorePosts1.numberOfItems = 10;

            // for Facebook Login
            //if (!string.IsNullOrWhiteSpace(Request.QueryString["code"]))
            //{
            //    string id = Request.QueryString["id"];
            //    string title = Request.QueryString["title"];
            //    Response.Redirect(siteUrl + "post/" + id + "/" + title);
            //}

            if (!IsPostBack)
            {
                string id = Request.QueryString["id"];
                int msgId = 0;
                if (!Int32.TryParse(id, out msgId))
                    return;

                string passedSlug = Request.QueryString["title"];
                //get the original slug from database / dymanic method

                PostAroundServiceClient client = new PostAroundServiceClient();
                MyMessage message = client.GetMessageById(msgId, "", "", -1, 0, -1);
                if (message == null)
                    return;

                string originalSlug = message.title.Slugify();
                client.Close();

                if (!originalSlug.Equals(HttpUtility.UrlDecode(passedSlug)))
                {
                    var url = String.Format(siteUrl + "post/{0}/{1}", id, originalSlug);
                    Response.RedirectPermanent(url, true);
                }

            }
        } catch (Exception ex) {
            //Response.Write(ex.Message);
            //Response.End();
           // Response.Redirect(siteUrl);
        }
    }
Пример #3
0
    private PostAround.Entities.MyMessage GetMessageByID(int msgId)
    {
        string currLon = "", currLat = "";
        int regionId = 0;
        int timeZone = 0;
        int userId = 0;

        userId = Tools.GetUserIdFromCookie(Context);
        //if (userId <= 0)
        //{
        //    AddCommentPanel.Visible = false;
        //}

        PostAroundServiceClient client = new PostAroundServiceClient();

        PostAround.Entities.MyMessage message = client.GetMessageById(msgId, currLon, currLat, regionId, timeZone, userId);
        if (message != null)
        {
            message.comments = client.GetCommentsByMessageID(message.msgId, userId, timeZone, 0);
        }

        client.Close();

        return message;
    }
Пример #4
0
    private PostAround.Entities.MyMessage GetMessageByID(int msgId)
    {
        string currLon = "", currLat = "";
        int regionId = 0;
        int timeZone = 0;
        int userId = 0;

        userId = Tools.GetUserIdFromCookie(Context);

        PostAroundServiceClient client = new PostAroundServiceClient();

        PostAround.Entities.MyMessage message = client.GetMessageById(msgId, currLon, currLat, regionId, timeZone, userId);

        client.Close();

        return message;
    }
Пример #5
0
    private MyMessage GetMessageByID(int msgId)
    {
        string currLon = "", currLat = "";
        int regionId = 0;
        int timeZone = 0;
        int userId = 0;

        userId = 0;

        PostAroundServiceClient client = new PostAroundServiceClient();

        PostAround.Entities.MyMessage message = client.GetMessageById(msgId, currLon, currLat, regionId, timeZone, userId);
        if (message != null)
        {
            message.comments = client.GetCommentsByMessageID(message.msgId, userId, timeZone, 0);
        }

        client.Close();

        return message;
    }