public tblPost AddPost(tblPost post)
        {
            try
            {
                using (BetweenUsEntities context = new BetweenUsEntities())
                {
                    if (post.PostID == 0)
                    {
                        tblPost newPost = new tblPost
                        {
                            PostID       = post.PostID,
                            PostText     = post.PostText,
                            DateTimePost = post.DateTimePost,
                            VisiblePost  = post.VisiblePost,
                            UserPost     = post.UserPost
                        };

                        context.tblPosts.Add(newPost);
                        context.SaveChanges();
                        post.PostID = newPost.PostID;
                        return(post);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                System.Diagnostics.Debug.WriteLine("Exception: " + ex.Message.ToString());
                return(null);
            }
        }
Пример #2
0
 public MainWidnowViewModel(MainWindow mainWindow)
 {
     this.mainWindow = mainWindow;
     FriendListChat();
     PostPost();
     Post = new tblPost();
 }
Пример #3
0
        public void Insert(CPost post)
        {
            try
            {
                WorkWithMeDataContext oDC = new WorkWithMeDataContext();
                tblPost p = new tblPost();
                p.Id             = Id;
                p.OwnerUserId    = OwnerUserId;
                p.TargetGroupId  = TargetGroupId;
                p.Title          = Title;
                p.Content        = Content;
                p.IsSticky       = IsSticky;
                p.IsDeleted      = IsDeleted;
                p.TimeStamp      = TimeStamp;
                p.EventTimeStamp = EventTimeStamp;


                oDC.tblPosts.InsertOnSubmit(p);
                oDC.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        /// <summary>
        /// Checks if the user can see the button
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            UserData       userData = new UserData();
            PostData       postData = new PostData();
            List <tblPost> allPosts = postData.GetAllPosts();
            tblPost        post     = null;

            if (value != null)
            {
                for (int i = 0; i < allPosts.Count; i++)
                {
                    if (allPosts[i].PostID == (int)value)
                    {
                        post = allPosts[i];
                    }
                }

                // Return visible if the post belongs to the user
                if (post.UserID == LoggedInUser.CurrentUser.UserID)
                {
                    return(Visibility.Collapsed);
                }

                if (userData.CheckIfFriend(post.UserID, LoggedInUser.CurrentUser) == true)
                {
                    return(Visibility.Visible);
                }
                else
                {
                    return(Visibility.Collapsed);
                }
            }
            return(value);
        }
Пример #5
0
        public void btnKiemTra_Click(object sender, EventArgs e)
        {
            //lưu thông tin bài viết
            WebView.Navigate(urlfacebook + txtIDBaiViet.Text);
            tblPost p = ThuVienLamViecFacebook.LayThongTinPost(txtIDBaiViet.Text);

            p.TimePost = DateTime.Now;
            Post.Them(p);
            //kết thúc lưu luôn thông tin bài viết
            //kiểm tra xem bài viết có trong work không
            if (Work.LoadDuLieuLamViecCu(taikhoan, txtIDBaiViet.Text).Rows.Count != 0)
            {
                ttbl.ktblcu = 1;
                ttbl.idpost = txtIDBaiViet.Text;
                LoadBinhLuan();
                //load lại thông tin bài viết
                DataTable dt = Post.LoadDuLieuByID(txtIDBaiViet.Text);
                DatePost.Value = DateTime.Parse(dt.Rows[0]["TimePost"].ToString());
                if (dt.Rows[0]["Status"].ToString() == "Tiêu cực")
                {
                    radioTieuCuc.Checked = true;
                }
                else
                {
                    radioTichCuc.Checked = true;
                }
            }
            //kết thúc kiểm tra work
            ttbl.idpost = txtIDBaiViet.Text;
            ttcx.idpost = txtIDBaiViet.Text;
            ttkd.idpost = txtIDBaiViet.Text;
        }
        /// <summary>
        /// Checks if the user already liked the post
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            PostData       postData = new PostData();
            List <tblPost> allPosts = postData.GetAllPosts();
            tblPost        post     = null;

            if (value != null)
            {
                for (int i = 0; i < allPosts.Count; i++)
                {
                    if (allPosts[i].PostID == (int)value)
                    {
                        post = allPosts[i];
                    }
                }

                if (postData.IsPostLiked(post, LoggedInUser.CurrentUser) == true)
                {
                    return("Liked");
                }
                else
                {
                    return("Like Post");
                }
            }
            return(value);
        }
        public void LikePost(tblPost post, tblUser user)
        {
            try
            {
                using (SocialNetworkDbEntities context = new SocialNetworkDbEntities())
                {
                    tblPost postInDB = (from x in context.tblPosts
                                        where x.PostID == post.PostID

                                        select x).First();

                    tblUser userInDb = (from x in context.tblUsers
                                        where x.UserID == user.UserID

                                        select x).First();

                    if (postInDB.NumberOfLikes == null)
                    {
                        postInDB.NumberOfLikes = 1;
                    }
                    else
                    {
                        postInDB.NumberOfLikes += 1;
                    }
                    postInDB.tblUsers.Add(userInDb);

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
            }
        }
Пример #8
0
        // GET: Posts/Edit/5
        public ActionResult Edit(int?id)
        {
            HttpCookie member_cookie = Request.Cookies["member_id"];

            if (member_cookie == null)
            {
                return(Redirect("/User/Login"));
            }
            tblUser user = db.tblUsers.Find(int.Parse(member_cookie.Value.ToString()));

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblPost tblPost = db.tblPosts.Find(id);

            if (tblPost == null || tblPost.Post_User != user.User_ID)
            {
                return(HttpNotFound());
            }
            ViewBag.Post_Cat    = new SelectList(db.tblCategories, "Cat_ID", "Cat_Name", tblPost.Post_Cat);
            ViewBag.Post_User   = new SelectList(db.tblUsers, "User_ID", "User_DisplayName", tblPost.Post_User);
            ViewBag.Post_Group  = new SelectList(db.tblGroupCodes, "Group_ID", "Group_Name", tblPost.Post_Group);
            ViewBag.Post_Genres = new SelectList(db.tblGenres, "Genres_ID", "Genres_Name", tblPost.Post_Genres);
            return(View(tblPost));
        }
Пример #9
0
        public ActionResult OnePostPage(int?id)
        {
            tblPost tblPost = dbEntities.tblPosts.Find(id);

            // var model = dbEntities.tblPosts.Include("tblComments");
            return(View(tblPost));
        }
Пример #10
0
 internal UserViewModel(UserView userView, tblUser user)
 {
     userId        = user.UserID;
     this.userView = userView;
     Post          = new tblPost();
     Posts         = LoadPosts();
 }
Пример #11
0
    //protected void lbtnAddTag_Click(object sender, EventArgs e)
    //{
    //    //---for multiple move----
    //    if (lstboxAddTag.SelectedIndex >= 0)
    //    {
    //        for (int i = 0; i < lstboxAddTag.Items.Count; i++)
    //        {
    //            if (lstboxAddTag.Items[i].Selected)
    //            {
    //                if (!array1.Contains(lstboxAddTag.Items[i]))
    //                {
    //                    array1.Add(lstboxAddTag.Items[i]);
    //                }
    //            }
    //        }
    //        for (int i = 0; i < array1.Count; i++)
    //        {
    //            if (!lstboxRemoveTag.Items.Contains(((ListItem)array1[i])))
    //            {
    //                lstboxRemoveTag.Items.Add(((ListItem)array1[i]));
    //            }
    //            lstboxAddTag.Items.Remove(((ListItem)array1[i]));
    //        }
    //        lstboxRemoveTag.SelectedIndex = -1;
    //    }
    //    else
    //    {
    //        Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('" + "Select a tag to add!" + "');", true);
    //    }
    //    //---for multiple move----

    //    //---for single move----

    //    //if (lstboxAddTag.SelectedIndex != -1)
    //    //{
    //    //    lstboxRemoveTag.Items.Add(lstboxAddTag.SelectedItem);
    //    //    lstboxAddTag.Items.RemoveAt(lstboxAddTag.SelectedIndex);
    //    //}
    //    //else
    //    //{
    //    //    Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('" + "Select a tag to add!" + "');", true);
    //    //}
    //    //---for single move----

    //}
    //protected void lstboxAddTag_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    if (lstboxAddTag.SelectedIndex > -1)
    //    {
    //        if (lstboxRemoveTag.Items.Count > lstboxAddTag.SelectedIndex) //checking if listBox2 has enough items to select
    //        {
    //            lstboxRemoveTag.SelectedIndex = lstboxAddTag.SelectedIndex;
    //        }
    //    }
    //}
    //protected void lbtnRemoveTag_Click(object sender, EventArgs e)
    //{
    //    if (lstboxRemoveTag.SelectedIndex >= 0)
    //    {
    //        for (int i = 0; i < lstboxRemoveTag.Items.Count; i++)
    //        {
    //            if (lstboxRemoveTag.Items[i].Selected)
    //            {
    //                if (!array2.Contains(lstboxRemoveTag.Items[i]))
    //                {
    //                    array2.Add(lstboxRemoveTag.Items[i]);
    //                }
    //            }
    //        }
    //        for (int i = 0; i < array2.Count; i++)
    //        {
    //            if (!lstboxAddTag.Items.Contains(((ListItem)array2[i])))
    //            {
    //                lstboxAddTag.Items.Add(((ListItem)array2[i]));
    //            }
    //            lstboxRemoveTag.Items.Remove(((ListItem)array2[i]));
    //        }
    //        lstboxAddTag.SelectedIndex = -1;
    //    }
    //    else
    //    {
    //        Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('" + "Select a tag to remove!" + "');", true);
    //    }

    //}
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        tblPost             post             = new tblPost();
        tblTag              tag              = new tblTag();
        tblPostNotification postnotification = new tblPostNotification();

        var    timeZone = TimeZoneInfo.FindSystemTimeZoneById("Bangladesh Standard Time");
        var    now      = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, timeZone);
        string date     = now.ToString("yyyy-MM-dd hh:mm:ss tt");

        post.Description = txtDescription.Text;
        post.PostDate    = Convert.ToDateTime(date);
        post.Status      = "Active";
        if (fupSpecification.HasFile)
        {
            string fileNameSpecification = fupSpecification.FileName.Replace(",", "");
            post.Specification = fileNameSpecification;
            fupSpecification.SaveAs(Server.MapPath("../UploadedFiles/" + fileNameSpecification));
        }
        post.UserId = Convert.ToInt32(Session["userid"].ToString());
        db.tblPosts.Add(post);
        db.SaveChanges();

        string[] tagsArray = new string[ddlTags.Items.Count];
        int      index     = 0;

        foreach (ListItem li in ddlTags.Items)
        {
            if (li.Selected)
            {
                tagsArray[index] = li.Value;
                index            = index + 1;
                tag.Tag          = li.Text;
                tag.PostId       = Convert.ToInt32(post.Id);
                db.tblTags.Add(tag);
                db.SaveChanges();
                Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('" + "Post created successfully!" + "');", true);
            }
        }
        //for (int i = 0; i < lstboxRemoveTag.Items.Count; i++)
        //{
        //    if (!lstboxRemoveTag.Items[i].Selected || lstboxRemoveTag.Items[i].Selected)
        //    {
        //        tag.Tag = lstboxRemoveTag.Items[i].Text;
        //        tag.PostId = post.Id;
        //        db.tblTags.Add(tag);
        //        db.SaveChanges();
        //        Page.ClientScript.RegisterStartupScript(GetType(), "msgbox", "alert('" + "Post created successfully!" + "');", true);
        //    }
        //}
        //lstboxRemoveTag.Items.Clear();
        txtDescription.Text = "";
        populateTags();

        postnotification.PostId           = post.Id;
        postnotification.NotificationDate = post.PostDate;
        db.tblPostNotifications.Add(postnotification);
        db.SaveChanges();
    }
Пример #12
0
        public ActionResult Edit([Bind(Include = "Post_ID,Post_Title,Post_Avata,Post_ViewMoreImage,Post_Description,Post_View,Post_Vote,Post_Rate,Post_CountDownLoad,Post_LinkDown,Post_DateCreate,Post_Cat,Post_User,Post_Favorite,Post_TutorialSetup,Post_Price,Post_Genres,Post_Group,Post_Active,Post_Trash,Post_Code")] tblPost tblPost, HttpPostedFileBase file_img, int[] lan_id)
        {
            if (ModelState.IsValid)
            {
                // update avata
                if (file_img != null)
                {
                    // delete old image
                    if (tblPost.Post_Avata != null)
                    {
                        string fullPath = Request.MapPath("~/Content/Layout/img/post/" + tblPost.Post_Avata);
                        System.IO.File.Delete(fullPath);
                    }
                    // update new image
                    var img     = Guid.NewGuid().ToString() + Path.GetExtension(file_img.FileName);
                    var pathimg = Path.Combine(Server.MapPath("~/Content/Layout/img/post"), img);
                    file_img.SaveAs(pathimg);
                    tblPost.Post_Avata = img;
                }
                if (tblPost.Post_Price == 0)
                {
                    tblPost.Post_Group = 3;
                }
                else if (tblPost.Post_Price > 0 && tblPost.Post_Price < 100)
                {
                    tblPost.Post_Group = 2;
                }
                else
                {
                    tblPost.Post_Group = 1;
                }
                db.Entry(tblPost).State = EntityState.Modified;
                db.SaveChanges();

                List <tblPostLang> removeItem = db.tblPostLangs.Where(t => t.Post_ID == tblPost.Post_ID).ToList();
                foreach (var item in removeItem)
                {
                    db.tblPostLangs.Remove(item);
                    db.SaveChanges();
                }
                foreach (var item in lan_id)
                {
                    tblPostLang addItem = new tblPostLang()
                    {
                        Post_ID          = tblPost.Post_ID,
                        Lang_ID          = item,
                        PostLang_DateAdd = DateTime.Now
                    };
                    db.tblPostLangs.Add(addItem);
                    db.SaveChanges();
                }
                return(RedirectToAction("MyPosts"));
            }
            ViewBag.Post_Cat    = new SelectList(db.tblCategories, "Cat_ID", "Cat_Name", tblPost.Post_Cat);
            ViewBag.Post_User   = new SelectList(db.tblUsers, "User_ID", "User_DisplayName", tblPost.Post_User);
            ViewBag.Post_Group  = new SelectList(db.tblGroupCodes, "Group_ID", "Group_Name", tblPost.Post_Group);
            ViewBag.Post_Genres = new SelectList(db.tblGenres, "Genres_ID", "Genres_Name", tblPost.Post_Genres);
            return(View(tblPost));
        }
Пример #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblPost tblPost = db.tblPosts.Find(id);

            db.tblPosts.Remove(tblPost);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #14
0
        public void Delete()
        {
            WorkWithMeDataContext oDC = new WorkWithMeDataContext();

            tblPost post = (from p in oDC.tblPosts where p.Id == Id select p).FirstOrDefault();

            oDC.tblPosts.DeleteOnSubmit(post);
            oDC.SubmitChanges();
        }
Пример #15
0
        public AddPostViewModel(AddPost addPost, tblUser userLogedIn)
        {
            view = addPost;


            postService = new PostService();

            Post = new tblPost();
            User = userLogedIn;
        }
Пример #16
0
 public ActionResult Edit([Bind(Include = "PostId,PostTitle,PostBody,PostDate,IsVisible")] tblPost tblPost)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblPost).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblPost));
 }
Пример #17
0
        public ActionResult Create([Bind(Include = "PostId,PostTitle,PostBody,PostDate,IsVisible")] tblPost tblPost)
        {
            if (ModelState.IsValid)
            {
                db.tblPosts.Add(tblPost);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblPost));
        }
Пример #18
0
 public ActionResult Edit([Bind(Include = "GebruikerId,AgendaItemId,PostDatumTijd,Post")] tblPost tblPost)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblPost).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AgendaItemId = new SelectList(db.TblAgendaItem, "Id", "Omschrijving", tblPost.AgendaItemId);
     return(View(tblPost));
 }
Пример #19
0
        /// <summary>
        /// Check if post was liked by user
        /// </summary>
        /// <param name="post">the post we are checking</param>
        /// <param name="user">the user</param>
        /// <returns>bool if already liked the post</returns>
        public bool IsPostLiked(tblPost post, tblUser user)
        {
            List <tblPostLike> allPostLikesForPost = GetAllPostLikesFromPost(post).ToList();

            for (int i = 0; i < allPostLikesForPost.Count; i++)
            {
                if (allPostLikesForPost[i].UserID == user.UserID)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #20
0
        public void setkiemduyet(string idpost)
        {
            txtIDBaiViet.Text = idpost;
            WebView.Navigate(urlfacebook + idpost);
            tblPost p = ThuVienLamViecFacebook.LayThongTinPost(idpost);

            p.TimePost = DateTime.Now;
            Post.Them(p);
            //kết thúc lưu luôn thông tin bài viết
            ttbl.idpost = idpost;
            ttcx.idpost = idpost;
            ttkd.idpost = idpost;
        }
Пример #21
0
        /// <summary>
        /// Get all post likes from a specific post
        /// </summary>
        /// <returns>The list of all post likes</returns>
        public List <tblPostLike> GetAllPostLikesFromPost(tblPost post)
        {
            List <tblPostLike> allPostLikes = GetAllPostLikes().ToList();
            List <tblPostLike> list         = new List <tblPostLike>();

            for (int i = 0; i < allPostLikes.Count; i++)
            {
                if (allPostLikes[i].PostID == post.PostID)
                {
                    list.Add(allPostLikes[i]);
                }
            }
            return(list);
        }
Пример #22
0
        public void Delete()
        {
            WorkWithMeDataContext oDC = new WorkWithMeDataContext();

            tblPost post = (from p in oDC.tblPosts where p.Id == Id select p).FirstOrDefault();

            oDC.tblPosts.DeleteOnSubmit(post);

            List <tblPost> replies = (from p in oDC.tblPosts where p.ReplyPostId == Id select p).ToList();

            oDC.tblPosts.DeleteAllOnSubmit(replies);

            oDC.SubmitChanges();
        }
        // GET: Admin/tblPostsAdmin/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblPost tblPost = db.tblPosts.Find(id);

            if (tblPost == null)
            {
                return(HttpNotFound());
            }
            return(View(tblPost));
        }
Пример #24
0
 /// <summary>
 /// Adds new post to tblPost in database.
 /// </summary>
 /// <param name="account"></param>
 /// <param name="text"></param>
 public void Post(tblAccount account, string text)
 {
     using (BetweenUsEntities context = new BetweenUsEntities())
     {
         tblPost post = new tblPost
         {
             AccountID   = account.AccountID,
             Content     = text,
             PostTime    = DateTime.Now,
             LikesNumber = 0
         };
         context.tblPosts.Add(post);
         context.SaveChanges();
     }
 }
Пример #25
0
        // GET: Post/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblPost tblPost = db.tblPost.Find(id);

            if (tblPost == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AgendaItemId = new SelectList(db.TblAgendaItem, "Id", "Omschrijving", tblPost.AgendaItemId);
            return(View(tblPost));
        }
Пример #26
0
 public static bool Them(tblPost p)
 {
     try
     {
         string sTruyVan = string.Format("Insert into tblPost(IDPost,Status,Description,IDRoot,NameRoot,CountLike,CountComment,TimePost) values('{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}',N'{6}',N'{7}')", p.IDPost, p.Status, p.Description, p.IDRoot, p.NameRoot, p.CountLike, p.CountComment, p.TimePost);
         con = DataProvider.KetNoi();
         DataProvider.ThucThiTruyVanNonQuery(sTruyVan, con);
         DataProvider.DongKetNoi(con);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #27
0
 public static bool Sua(tblPost p)
 {
     try
     {
         con = DataProvider.KetNoi();
         string sTruyVan = string.Format("Update tblPost set Status=N'{0}', CountLike='{1}', CountComment+='{2}' ,TimePost='{3}'where IDPost = '{4}'", p.Status, p.CountLike, p.CountComment, p.TimePost, p.IDPost);
         DataProvider.ThucThiTruyVanNonQuery(sTruyVan, con);
         DataProvider.DongKetNoi(con);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #28
0
 public static bool Xoa(tblPost p)
 {
     try
     {
         con = DataProvider.KetNoi();
         string sTruyVan = string.Format("Delete From tblPost where IDPost = '{0}'", p.IDPost);
         DataProvider.ThucThiTruyVanNonQuery(sTruyVan, con);
         DataProvider.DongKetNoi(con);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #29
0
        private void LikeExecute()
        {
            try
            {
                tblPost postInDb = postService.GetPostById(selectedPost.PostID);
                MessageBox.Show("You liked this post");
                postService.LikePost(postInDb, User);

                PostList = postService.GetPosts();
                ListDto  = ConvertListToDtoList(PostList);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        //kết thúc duyệt người thích
        //lấy thông tin bài viết
        public static tblPost LayThongTinPost(string idpost)
        {
            tblPost    p    = new tblPost();
            WebBrowser web1 = new WebBrowser();

            web1.Navigate("https://mobile.facebook.com/" + idpost);
            while (web1.ReadyState != WebBrowserReadyState.Complete)
            {
                Application.DoEvents();
            }
            string htmlcontent = web1.DocumentText;

            htmlcontent = htmlcontent.Replace("amp;", "");
            string desciption;

            try
            {
                desciption = htmlcontent.Substring(htmlcontent.IndexOf("TITLE") + 6);
                desciption = desciption.Remove(desciption.IndexOf("</TITLE>"));
            }
            catch
            {
                desciption = htmlcontent.Substring(htmlcontent.IndexOf("title") + 6);
                desciption = desciption.Remove(desciption.IndexOf("</title>"));
            }
            htmlcontent = htmlcontent.Substring(htmlcontent.IndexOf("STRONG") + 10);
            string name = htmlcontent.Substring(htmlcontent.IndexOf(">") + 1);

            name = name.Remove(name.IndexOf("<"));
            name = name.Replace("\r\n      ", "");
            string iduser = web1.Url.ToString();

            iduser        = iduser.Substring(iduser.IndexOf("&id=") + 4);
            iduser        = iduser.Remove(iduser.IndexOf("&"));
            p.IDRoot      = iduser;
            p.IDPost      = idpost;
            p.NameRoot    = name;
            p.Description = desciption;
            string timepost = htmlcontent.Substring(htmlcontent.IndexOf("ABBR") + 5);

            timepost = timepost.Remove(timepost.IndexOf("<"));
            if (!timepost.Contains("Tháng"))
            {
                timepost += DateTime.Now.ToShortDateString();
            }
            return(p);
        }