protected void ListViewAll_ItemDataBound(object sender, ListViewItemEventArgs e)
 {
     if (e.Item.ItemType == ListViewItemType.DataItem)
     {
         var SenderId              = ((HtmlInputHidden)e.Item.FindControl("hiddenId")).Value;
         var btngroup              = ((HtmlGenericControl)e.Item.FindControl("btngroup"));
         var imgAvatarPost         = ((HtmlImage)e.Item.FindControl("imgAvatarPost"));
         var iconDateUpdate        = ((HtmlGenericControl)e.Item.FindControl("iconDateUpdate"));
         var lb_lst_dateupdatetext = ((Label)e.Item.FindControl("lb_lst_dateupdatetext"));
         var lb_lst_dateupdate     = ((Label)e.Item.FindControl("lb_lst_dateupdate"));
         var btnLike   = (Button)e.Item.FindControl("btnLike");
         var btnUnLike = (Button)e.Item.FindControl("btnUnLike");
         if (String.IsNullOrEmpty(imgAvatarPost.Src))
         {
             imgAvatarPost.Src = "../img/unnamed.png";
         }
         if (lb_lst_dateupdate.Text != string.Empty)
         {
             lb_lst_dateupdate.Visible     = true;
             iconDateUpdate.Visible        = true;
             lb_lst_dateupdatetext.Visible = true;
         }
         if (Session["login"] != null && Session["UserName"] != null && Session["AccountID"] != null)
         {
             btnLike.Visible   = true;
             btnUnLike.Visible = true;
             btngroup.Visible  = true;
         }
         else
         {
             btnLike.Visible   = false;
             btnUnLike.Visible = false;
             btngroup.Visible  = false;
         }
         if (Session["login"] != null && Session["AccountID"] != null)
         {
             if (!CheckLike(int.Parse(SenderId), int.Parse(Session["AccountID"].ToString())))
             {
                 btnLike.Visible   = true;
                 btnUnLike.Visible = false;
             }
             else
             {
                 btnLike.Visible   = false;
                 btnUnLike.Visible = true;
             }
         }
         //--------Get-Data---------
         var PanelComment       = ((HtmlGenericControl)e.Item.FindControl("PanelComment"));
         var ListViewComment    = (ListView)e.Item.FindControl("ListViewComment");
         var lbTotalComment     = (Label)e.Item.FindControl("lbTotalComment");
         var btnViewMoreComment = (Button)e.Item.FindControl("btnViewMoreComment");
         var _clsGetComment     = new BllWallComment();
         var _dtGetWallCount    = _clsGetComment.GetWallCommentCount(int.Parse(SenderId));
         var _dtGetComment      = _clsGetComment.GetWallComment(int.Parse(SenderId), int.Parse(WebConfigurationManager.AppSettings["pageSizeWallComment"]));
         if (_dtGetComment != null && _dtGetComment.Rows.Count > 0)
         {
             ListViewComment.DataSource = _dtGetComment;
             ListViewComment.DataBind();
             ListViewComment.Visible = true;
             PanelComment.Visible    = true;
             lbTotalComment.Text     = _dtGetComment.Rows.Count.ToString();
             if (_dtGetWallCount != null && _dtGetWallCount.Rows.Count > 0)
             {
                 if (int.Parse(lbTotalComment.Text) < int.Parse(WebConfigurationManager.AppSettings["pageSizeWallComment"]))
                 {
                     btnViewMoreComment.Visible = false;
                 }
                 else if (int.Parse(lbTotalComment.Text) == int.Parse(_dtGetWallCount.Rows[0]["Total"].ToString()))
                 {
                     btnViewMoreComment.Visible = false;
                 }
                 else
                 {
                     btnViewMoreComment.Visible = true;
                 }
             }
         }
         else
         {
             PanelComment.Visible       = false;
             ListViewComment.Visible    = false;
             btnViewMoreComment.Visible = false;
         }
     }
 }
        protected void ListViewAll_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            try
            {
                if (Session["login"] != null &&
                    Session["AccountID"] != null)
                {
                    #region [Edit]
                    //--------Edit-------
                    var txtWallComment    = (TextBox)e.Item.FindControl("txtWallComment");
                    var SenderId          = ((HtmlInputHidden)e.Item.FindControl("hiddenId")).Value;
                    var lb_lst_account_ID = ((Label)e.Item.FindControl("lb_lst_account_ID"));
                    if (e.CommandName == "_EditPost")
                    {
                        if (lb_lst_account_ID.Text == Session["AccountID"].ToString())
                        {
                            GetWallEdit(int.Parse(SenderId));
                            LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModalStatusEdit");
                        }
                        else
                        {
                            lbMsg.Text = "Bạn không được phép thay đổi trạng thái của người khác !";
                            LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModal");
                        }
                    }
                    #endregion

                    #region [DelPost]
                    if (e.CommandName == "_DelPost")
                    {
                        _flag = true;
                        btnDelStatus.InnerText = "Xoá bài viết";
                        if (lb_lst_account_ID.Text == Session["AccountID"].ToString())
                        {
                            GetWallEdit(int.Parse(SenderId));
                            lbMsgDel.Text = "Bạn có chắc chắn muốn xóa tin này không ?";
                            LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModalDel");
                        }
                        else
                        {
                            lbMsg.Text = "Bạn không được phép xoá trạng thái của người khác !";
                            LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModal");
                        }
                    }
                    #endregion

                    #region [Like]
                    //-------Like----------
                    var lb_lst_like = ((Label)e.Item.FindControl("lb_lst_like"));
                    if (e.CommandName == "Like_lst")
                    {
                        if (Session["login"] != null &&
                            Session["AccountID"] != null)
                        {
                            if (
                                !CheckInsert(int.Parse(SenderId), int.Parse(Session["AccountID"].ToString()),
                                             "Bạn không thể Like hai lần trên cùng một mẫu tin !"))
                            {
                                var obj = new DTOWall
                                {
                                    Wall_ID    = int.Parse(SenderId),
                                    LikeCount  = int.Parse(lb_lst_like.Text) + 1,
                                    AccountID1 = int.Parse(Session["AccountID"].ToString()),
                                    AccountID2 = int.Parse(lb_lst_account_ID.Text),
                                };
                                BllWall.Like(obj);
                                if (Request.Params["username"] != null)
                                {
                                    GetWall(Request.Params["username"], int.Parse(WebConfigurationManager.AppSettings["pageSizeWall"]));
                                }
                            }
                        }
                    }
                    #endregion

                    #region [Unlike]
                    if (e.CommandName == "Unlike_lst")
                    {
                        if (int.Parse(lb_lst_like.Text) == 0)
                        {
                            lbMsg.Text = "Số lượt thích hiện tại là 0.Bạn không thể bỏ thích";
                            LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModal");
                        }
                        else
                        {
                            if (CheckUnlike(int.Parse(SenderId), int.Parse(Session["AccountID"].ToString())))
                            {
                                var obj = new DTOWall
                                {
                                    Wall_ID    = int.Parse(SenderId),
                                    LikeCount  = int.Parse(lb_lst_like.Text) - 1,
                                    AccountID1 = int.Parse(Session["AccountID"].ToString()),
                                };
                                BllWall.UnLike(obj);
                                if (Request.Params["username"] != null)
                                {
                                    GetWall(Request.Params["username"], int.Parse(WebConfigurationManager.AppSettings["pageSizeWall"]));
                                }
                            }
                            else
                            {
                                lbMsg.Text = "Bạn không thể bỏ Like hai lần trên cùng một mẫu tin !";
                                LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModal");
                            }
                        }
                    }
                    #endregion

                    #region [PostComment]
                    if (e.CommandName == "_btnInsert")
                    {
                        if (String.IsNullOrEmpty(txtWallComment.Text))
                        {
                            lbMsg.Text = "Vui lòng điền vào nội dung Comment !";
                            LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModal");
                        }
                        else
                        {
                            InsertValueComment(int.Parse(SenderId), txtWallComment.Text);
                            txtWallComment.Text = string.Empty;
                        }
                        //--------Get-Data---------
                        var PanelComment       = ((HtmlGenericControl)e.Item.FindControl("PanelComment"));
                        var ListViewComment    = (ListView)e.Item.FindControl("ListViewComment");
                        var lbTotalComment     = (Label)e.Item.FindControl("lbTotalComment");
                        var btnViewMoreComment = (Button)e.Item.FindControl("btnViewMoreComment");
                        var _clsGetComment     = new BllWallComment();
                        var _dtGetWallCount    = _clsGetComment.GetWallCommentCount(int.Parse(SenderId));
                        var _dtGetComment      = _clsGetComment.GetWallComment(int.Parse(SenderId), int.Parse(WebConfigurationManager.AppSettings["pageSizeWallComment"]));
                        if (_dtGetComment != null && _dtGetComment.Rows.Count > 0)
                        {
                            ListViewComment.DataSource = _dtGetComment;
                            ListViewComment.DataBind();
                            ListViewComment.Visible = true;
                            PanelComment.Visible    = true;
                            lbTotalComment.Text     = _dtGetComment.Rows.Count.ToString();
                            if (_dtGetWallCount != null && _dtGetWallCount.Rows.Count > 0)
                            {
                                if (int.Parse(lbTotalComment.Text) < int.Parse(WebConfigurationManager.AppSettings["pageSizeWallComment"]))
                                {
                                    btnViewMoreComment.Visible = false;
                                }
                                else if (int.Parse(lbTotalComment.Text) == int.Parse(_dtGetWallCount.Rows[0]["Total"].ToString()))
                                {
                                    btnViewMoreComment.Visible = false;
                                }
                                else
                                {
                                    btnViewMoreComment.Visible = true;
                                }
                            }
                        }
                        else
                        {
                            PanelComment.Visible       = false;
                            ListViewComment.Visible    = false;
                            btnViewMoreComment.Visible = false;
                        }
                    }
                    #endregion

                    #region [ViewMore]
                    //------ViewMore---
                    if (e.CommandName == "_btnViewMoreComment")
                    {
                        //--------Get-Data---------
                        var PanelComment       = ((HtmlGenericControl)e.Item.FindControl("PanelComment"));
                        var ListViewComment    = (ListView)e.Item.FindControl("ListViewComment");
                        var lbTotalComment     = (Label)e.Item.FindControl("lbTotalComment");
                        var btnViewMoreComment = (Button)e.Item.FindControl("btnViewMoreComment");
                        var _clsGetComment     = new BllWallComment();
                        var _dtGetWallCount    = _clsGetComment.GetWallCommentCount(int.Parse(SenderId));
                        var _dtGetComment      = _clsGetComment.GetWallComment(int.Parse(SenderId), int.Parse(lbTotalComment.Text) + 10);
                        if (_dtGetComment != null && _dtGetComment.Rows.Count > 0)
                        {
                            ListViewComment.DataSource = _dtGetComment;
                            ListViewComment.DataBind();
                            ListViewComment.Visible = true;
                            PanelComment.Visible    = true;
                            lbTotalComment.Text     = _dtGetComment.Rows.Count.ToString();
                            if (_dtGetWallCount != null && _dtGetWallCount.Rows.Count > 0)
                            {
                                if (int.Parse(lbTotalComment.Text) < int.Parse(WebConfigurationManager.AppSettings["pageSizeWallComment"]))
                                {
                                    btnViewMoreComment.Visible = false;
                                }
                                else if (int.Parse(lbTotalComment.Text) == int.Parse(_dtGetWallCount.Rows[0]["Total"].ToString()))
                                {
                                    btnViewMoreComment.Visible = false;
                                }
                                else
                                {
                                    btnViewMoreComment.Visible = true;
                                }
                            }
                        }
                        else
                        {
                            PanelComment.Visible       = false;
                            ListViewComment.Visible    = false;
                            btnViewMoreComment.Visible = false;
                        }
                    }
                    #endregion
                }
                else
                {
                    lbMsg.Text = "<b>Chương trình bị ngắt quãng vì lý do an toàn</b><br/>Vui lòng thoát ra và đăng nhập lại !";
                    LibWindowUI.Window.OpenWindows(Page, GetType(), "#myModal");
                }
            }
            catch (Exception ex)
            {
                _Error = LibAlert.Alert.AlertError(ex.Message);
            }
        }