-
Notifications
You must be signed in to change notification settings - Fork 1
/
myfriendslist.aspx.cs
103 lines (87 loc) · 4.07 KB
/
myfriendslist.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#region XD World Recipe V 3
// FileName: myfriendslist.cs
// Author: Dexter Zafra
// Date Created: 2/25/2009
// Website: www.ex-designz.net
#endregion
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using XDRecipe.BL.Providers.User;
using XDRecipe.UI;
using XDRecipe.BL;
using XDRecipe.Common;
using XDRecipe.Security;
using XDRecipe.Common.Utilities;
using XDRecipe.BL.Providers.CookBooks;
using XDRecipe.BL.Providers.FriendList;
public partial class myfriendslist : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (Authentication.IsUserAuthenticated)
{
HideContentIfNotLogin.Visible = true;
lblusernameheader.Text = UserIdentity.UserName + "'s Friends List";
Blogic.UpdateUserLastLogin(UserIdentity.UserID);
GetMetaTitleTagKeywords(UserIdentity.UserName);
GetCountUnApprovedNewFriendsLink();
LoadData();
}
else
{
GetMetaTitleTagKeywords("Denied View");
HideContentIfNotLogin.Visible = false;
lblyouarenotlogin.Visible = true;
lblusernameheader.Text = "Denied Friends List View";
lblyouarenotlogin.Text = "<div style='margin-top: 12px; margin-bottom: 7px;'><img src='images/lock.gif' align='absmiddle'> You are not authorize to view this Friends List. Please login to view your Friends List.</div>";
}
}
private void LoadData()
{
ProviderFriendsListMain MyFriends = new ProviderFriendsListMain(UserIdentity.UserID);
MyFriendsList.DataSource = MyFriends.GetFriendsList();
MyFriendsList.DataBind();
int NumRecordsAllowed = SiteConfiguration.GetConfiguration.NumberOfFriendsInFriendsList;
int Remaining = NumRecordsAllowed - MyFriends.TotalCount;
lblcounter.Text = "<img src='images/friendlisticon.gif' align='absmiddle'> You have (" + MyFriends.TotalCount + ") friends saved. The maximum allowed of friends is " + NumRecordsAllowed + ". You have a remaining " + Remaining + " friends to save.";
MyFriends = null;
}
private void GetCountUnApprovedNewFriendsLink()
{
int CountUnApprovedNewFriends = Blogic.GetCountUnApprovedFriends(UserIdentity.UserID);
if (CountUnApprovedNewFriends != 0)
{
PanelUnApprovedFriends.Visible = true;
lblcountunpprovednewfriends.Text = "You have <a href='viewunapprovedfriends.aspx'><b>" + CountUnApprovedNewFriends + "</b> users</a> added you as a friend and waiting for your approval.";
lblcountunpprovednewfriends.Attributes.Add("onmouseover", "Tip('Click the link to approved or declined users request.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
lblcountunpprovednewfriends.Attributes.Add("onmouseout", "UnTip()");
}
}
public void MyFriendsList_ItemDataBound(Object s, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Label lblDelete = (Label)(e.Item.FindControl("lblDelete"));
int ID = (int)DataBinder.Eval(e.Item.DataItem, "ID");
lblDelete.Text = "<a class='thickbox' href='#TB_inline?height=75&width=350&inlineId=confirmModal" + ID + "&modal=true'><img border='0' src='images/icon_delete.gif'></a>";
lblDelete.Attributes.Add("onmouseover", "Tip('Remove (<b>" + DataBinder.Eval(e.Item.DataItem, "Username") + "</b>) from my Friends List.', BGCOLOR, '#FFFBE1', BORDERCOLOR, '#acc6db')");
lblDelete.Attributes.Add("onmouseout", "UnTip()");
}
}
private void GetMetaTitleTagKeywords(string UserName)
{
Page.Header.Title = UserName + "'s Friends List";
HtmlMeta metaTag = new HtmlMeta();
metaTag.Name = "Keywords";
metaTag.Content = UserName + " Friends List.";
this.Header.Controls.Add(metaTag);
}
}