This repository has been archived by the owner on Sep 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OrdersForSGD.aspx.cs
125 lines (121 loc) · 4.31 KB
/
OrdersForSGD.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WXShare
{
public partial class OrdersForSGD : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// 不是微信内置浏览器
if (!WXManage.IsWXBrowser(Request))
{
Response.Redirect("/RequireWX.aspx?url=" + Request.Url);
return;
}
if (Session["phone"] == null || Session["iden"].ToString() != "4")
{
Response.Redirect("/UserIndex.aspx");
return;
}
var statusList = new DataBase.Status().Gets();
statusSelect.Items.Clear();
statusSelect.Items.Add(new ListItem("所有订单", "-1"));
foreach (var status in statusList)
{
statusSelect.Items.Add(new ListItem(status.view, status.id));
}
}
protected void btn_Click(object sender, EventArgs e)
{
string item =
"<a class=\"weui-cell weui-cell_access\" href=\"/OrderDetailForSGD.aspx?oid=#id#\">" +
" <div class=\"weui-cell__bd\">" +
" <p>#content#</p>" +
" </div>" +
" <div class=\"weui-cell__ft\">#new#" +
" </div>" +
"</a>";
string newOrder = "<span class=\"weui-badge weui-badge_dot\" style=\"margin-left: 5px; margin-right: 5px; \"></span>";
string aid = Request.Form["statusSelect"];
var user = new Objects.User()
{
phone = Session["phone"].ToString(),
identity = Session["iden"].ToString()
};
user = DataBase.User.Get(user);
var team = DataBase.Team.Get(user);
List<Objects.Order> list = new List<Objects.Order>();
orderList.InnerHtml = "";
if (aid == "-1")
{
list = DataBase.Order.Gets(team);
}
else
{
var listTmp = DataBase.Order.Gets(team);
foreach (var order in listTmp)
{
if (order.status == int.Parse(aid))
{
list.Add(order);
}
}
}
foreach (var order in list)
{
orderList.InnerHtml += item
.Replace("#id#", order.id)
.Replace("#content#", order.name + " " + order.phone)
.Replace("#new#", order.status == 8 ? newOrder : "");
}
if (list.Count == 0)
{
orderList.InnerHtml = "<p style=\"text-align:center\">找不到任何订单</p>";
}
statusSelect.Value = aid;
}
protected void searchBtn_Click(Object sender, EventArgs e)
{
string item =
"<a class=\"weui-cell weui-cell_access\" href=\"/OrderDetailForSGD.aspx?oid=#id#\">" +
" <div class=\"weui-cell__bd\">" +
" <p>#content#</p>" +
" </div>" +
" <div class=\"weui-cell__ft\">#new#" +
" </div>" +
"</a>";
string newOrder = "<span class=\"weui-badge weui-badge_dot\" style=\"margin-left: 5px; margin-right: 5px; \"></span>";
string aid = statusSelect.Value;
string key = searchInput.Value;
var user = new Objects.User()
{
phone = Session["phone"].ToString(),
identity = Session["iden"].ToString()
};
var team = DataBase.Team.Get(user);
var list = DataBase.Order.Search(key);
orderList.InnerHtml = "";
int validCount = 0;
foreach (var order in list)
{
if (order.constructionTeam != team.id)
{
continue;
}
validCount++;
orderList.InnerHtml += item
.Replace("#id#", order.id)
.Replace("#content#", order.name + " " + order.phone)
.Replace("#new#", order.status == 8 ? newOrder : "");
}
if (validCount == 0)
{
orderList.InnerHtml = "<p style=\"text-align:center\">找不到任何订单</p>";
}
}
}
}