-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserDetail.aspx.cs
81 lines (73 loc) · 3.25 KB
/
UserDetail.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;
using Darili_api;
public partial class UserDetail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int uid = Darili_User.Get_Uid_Local(Page.User.Identity.Name);
XElement root = new XElement("User", new XElement("uid", Darili_User.Get_Uid_Local(Page.User.Identity.Name)));
int page = Request.QueryString["page"] != null ? int.Parse(Request.QueryString["page"]) : 0;
int perpage = Request.QueryString["perpage"]!=null ? int.Parse(Request.QueryString["perpage"]) : 5;
string type = Request.QueryString["type"];
if (type == "Liked")
{
//写入参加活动
//写入喜欢的活动
Event[] Liked_Events = Darili_Subsciption.GetLikedEvents(Darili_User.Get_Uid_Local(Page.User.Identity.Name), perpage, page);
foreach (var element in Liked_Events)
{
element.NeedSubscribe = Darili_Subsciption.NeedSubscribe(element.Id);
}
//写入本人添加的活动
int like_count = Darili_Subsciption.GetLikeCount(uid);
root.Add(new XElement("LikedEvents",
Event.Translte_Xml(Liked_Events),
new XElement("count", like_count)
));
}
if (type == "Subscribed")
{
int subscribe_count = Darili_Subsciption.GetSubscribeCount(uid);
Event[] Subscibed_Events = Darili_Subsciption.GetSubscribedEvents(Darili_User.Get_Uid_Local(Page.User.Identity.Name), perpage, page);
foreach (var element in Subscibed_Events)
{
element.NeedSubscribe = Darili_Subsciption.NeedSubscribe(element.Id);
}
root.Add(new XElement("SubscribedEvents",
new XElement("count", subscribe_count),
Event.Translte_Xml(Subscibed_Events)));
}
if (type == "Published")
{
//modified by aabb 2014.4.28
//add search the published by orgname
string searchname;
if (!String.IsNullOrEmpty((String)Session["OrgName"]))
{
searchname = (string)Session["OrgName"];
}
else
{
searchname = Page.User.Identity.Name;
}
int publishcount = Event.GetPublishCount(searchname);
//end of modified
Event[] Published_Events = Event.GetPublisherEntries(searchname, perpage, page);
foreach (var element in Published_Events)
{
element.NeedSubscribe = Darili_Subsciption.NeedSubscribe(element.Id);
}
root.Add(new XElement("PublishedEvents",new XElement("count",publishcount), Event.Translte_Xml(Published_Events)));
}
Response.Write(Newtonsoft.Json.JsonConvert.SerializeXNode(root));
}
}
}