private void InsertFollower(int AccountID2) { try { if (Session["login"] != null && Session["FullName1"] != null && Session["FullName"] != null && Session["AccountID"] != null) { if (!CheckInsert(AccountID2)) { } var obj = new DTOFollower { AccountID1 = int.Parse(Session["AccountID"].ToString()), AccountID2 = AccountID2, }; BllFollower.Insert(obj); GetUserFollower(); _ErrorFollower = LibAlert.Alert.AlertSucess("<b style='color:black'>" + Session["FullName"] + "</b> đã thêm <b style='color:black'>" + lbFullName.Text + "</b> vào danh sách theo dõi !"); } } catch (Exception ex) { _ErrorFollower = LibAlert.Alert.AlertError("Có lỗi xảy ra trong quá trình theo dõi <br/>" + ex.Message); } }
private void GetUserTopFollower() { if (Session["login"] == null && Session["UserName"] == null && Session["AccountID"] == null) { var _clsGetUserTopFollower = new BllFollower(); var _dtGetUserTopFollower = _clsGetUserTopFollower.GetTopUserFollower(); if (_dtGetUserTopFollower != null && _dtGetUserTopFollower.Rows.Count > 0) { ListViewAll.DataSource = _dtGetUserTopFollower; ListViewAll.DataBind(); ListViewAll.Visible = true; } else { ListViewAll.Visible = false; } } else { var _clsGetUserTopFollower = new BllFollower(); var _dtGetUserTopFollower = _clsGetUserTopFollower.GetTopUserFollowerWithLogin(int.Parse(Session["AccountID"].ToString())); if (_dtGetUserTopFollower != null && _dtGetUserTopFollower.Rows.Count > 0) { ListViewAll.DataSource = _dtGetUserTopFollower; ListViewAll.DataBind(); ListViewAll.Visible = true; } else { ListViewAll.Visible = false; } } }
private string GetUserFollow() { var _html = string.Empty; if (Session["login"] != null && Session["FullName1"] != null && Session["FullName"] != null && Session["AccountID"] != null) { var _clsGetUserFollower = new BllFollower(); var _dtGetCountUserFollower = _clsGetUserFollower.GetWallFollowCount(int.Parse(Session["AccountID"].ToString())); var _dtGetUserFollower = _clsGetUserFollower.GetWallFollow(int.Parse(Session["AccountID"].ToString())); if (_dtGetUserFollower != null && _dtGetUserFollower.Rows.Count > 0) { _html += "<div class='panel panel-danger'>"; _html += "<div class='panel-heading'>"; _html += "<h3 class='panel-title'>NHỮNG NGƯỜI BẠN THEO DÕI " + "(" + _dtGetCountUserFollower.Rows[0]["Follower"] + ")" + " </h3>"; _html += "</div>"; _html += "<div class='panel-body' style='margin: 0 0 0 0;padding: 11px 0 12px 0;text-align: center'>"; for (int i = 0; i < _dtGetUserFollower.Rows.Count; i++) { _html += " <div class='col-md-4' style='width: 103px'>"; if (String.IsNullOrEmpty(_dtGetUserFollower.Rows[i]["User_Image"].ToString()) || _dtGetUserFollower.Rows[i]["User_Image"] == DBNull.Value) { _html += _html += "<a href='/profice/" + _dtGetUserFollower.Rows[i]["UserName"] + "' data-popover='true' data-html=true data-content='" + _dtGetUserFollower.Rows[i]["FullName"] + "'>"; _html += "<img src='../img/unnamed.png' style='width: 103px;height: 103px;border: 2px solid #f2dede' class='img-rounded'/>"; _html += "</a>"; } else { _html += "<a href='/profice/" + _dtGetUserFollower.Rows[i]["UserName"] + "' data-popover='true' data-html=true data-content='" + _dtGetUserFollower.Rows[i]["FullName"] + "'>"; _html += "<img src='" + _dtGetUserFollower.Rows[i]["User_Image"] + "' style='width: 103px;height: 103px;border: 2px solid #f2dede' class='img-rounded'/>"; _html += "</a>"; } _html += "</div>"; } _html += "</div>"; _html += "</div>"; } } return(_html); }
private void GetUserFollowerList() { if (Session["login"] != null && Session["FullName1"] != null && Session["FullName"] != null && Session["AccountID"] != null) { var _clsGetUserFollower = new BllFollower(); var _dtGetUserFollower = _clsGetUserFollower.GetWallFollow(int.Parse(Session["AccountID"].ToString())); if (_dtGetUserFollower != null && _dtGetUserFollower.Rows.Count > 0) { ListViewWallFollwer.DataSource = _dtGetUserFollower; ListViewWallFollwer.DataBind(); } } }
private bool CheckInsert(int AccountID) { var check = false; var _clsCheck = new BllFollower(); var dtCheck = _clsCheck.GetUserFollower(); if (dtCheck != null && dtCheck.Rows.Count > 0) { foreach (DataRow dr in dtCheck.Rows) { if (AccountID == int.Parse(dr["AccountID2"].ToString()) && Session["AccountID"].ToString() == dr["AccountID1"].ToString()) { check = true; _ErrorFollower = LibAlert.Alert.AlertError("Người theo dõi này đã nằm trong danh sách của bạn"); } } } return(check); }
private void GetUserView(string UserName) { var _clsGetUserView = new BllUser(); var _clsGetFollowerSendMessage = new BllFollower(); var _dtGetUserView = _clsGetUserView.GetUserView(UserName); if (_dtGetUserView != null && _dtGetUserView.Rows.Count > 0) { Page.Title = _dtGetUserView.Rows[0]["FullName"].ToString(); lbUserMain.Text = _dtGetUserView.Rows[0]["AccountID"].ToString(); lbAccountID2.Text = _dtGetUserView.Rows[0]["AccountID"].ToString(); if (Session["login"] != null && Session["AccountID"] != null) { var _dtGetFollowerSendMessage = _clsGetFollowerSendMessage.GetFollowerSendMessage(int.Parse(Session["AccountID"].ToString()), int.Parse(lbUserMain.Text)); if (_dtGetFollowerSendMessage != null && _dtGetFollowerSendMessage.Rows.Count > 0) { btnSendMessageClick.Visible = true; } } } }