private void UpdateValue() { try { if (String.IsNullOrEmpty(lbIDUserEdit.Text)) { _ErrorPost = LibAlert.Alert.AlertError("Bạn không được phép thay đổi bài viết trên dòng thời gian của " + Session["FullName1"]); } else { var obj = new DTOWall { Wall_ID = int.Parse(lbWallID.Text), AccountID1 = int.Parse(lbIDUserEdit.Text), Wall_Titile = txtTitilePostEdit.Value, Wall_Content = txtContentPostEdit.Value, Wall_Img = null }; BllWall.Update(obj); _ErrorPostEdit = LibAlert.Alert.AlertSucess("Thay đổi trạng thái thành công !"); GetWall(Request.Params["username"], int.Parse(WebConfigurationManager.AppSettings["pageSizeWall"])); } } catch (Exception ex) { _ErrorPostEdit = LibAlert.Alert.AlertError("Có lỗi xảy ra trong quá trình đăng bài !<br/>" + ex.Message); } }
private void Delete() { try { var obj = new DTOWall { AccountID1 = int.Parse(lbUserIDDel.Text), Wall_ID = int.Parse(lbWallIDDel.Text) }; BllWall.Delete(obj); lbMsgDel.Text = string.Empty; GetWall(Request.Params["username"], int.Parse(WebConfigurationManager.AppSettings["pageSizeWall"])); LibWindowUI.Window.CloseWindows(Page, GetType(), "#myModalDel"); } catch (Exception ex) { lbMsgDel.Text = "Có lỗi xảy ra trong quá trình xoá bài viết.<br/>" + ex.Message; } }
public static bool UnLike(DTOWall obj) { return(DalWall.UnLike(obj)); }
public static bool Delete(DTOWall obj) { return(DalWall.Delete(obj)); }
public static bool Update(DTOWall obj) { return(DalWall.Update(obj)); }
public static bool Insert(DTOWall obj) { return(DalWall.Insert(obj)); }
protected void ListViewSubWallFollower_ItemCommand(object sender, ListViewCommandEventArgs e) { try { var SenderId = ((HtmlInputHidden)e.Item.FindControl("hiddenId")).Value; var lb_lst_account_ID = ((Label)e.Item.FindControl("lb_lst_account_ID")); if (Session["login"] != null && Session["AccountID"] != null) { #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); GetUserFollowerList(); } } } #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); GetUserFollowerList(); } 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 } } catch (Exception ex) { _Error = LibAlert.Alert.AlertError(ex.Message); } }
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); } }