-
Notifications
You must be signed in to change notification settings - Fork 0
/
Backstage.aspx
349 lines (333 loc) · 27.7 KB
/
Backstage.aspx
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Backstage.aspx.cs" Inherits="_Backstage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/bootstrap-theme.min.css" rel="stylesheet" />
<link href="css/dashboard.css" rel="stylesheet" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script src="js/OpenModal.js"></script>
<script>
window.onfocus = GetFocus;
window.onclick = GetFocus;
function ShowHidden(sid, ev) {
ev = ev || window.event;
var target = ev.target || ev.srcElement;
var oDiv = document.getElementById("div" + sid);
oDiv.style.display = oDiv.style.display == "none" ? "block" : "none";
target.innerHTML = oDiv.style.display == "none" ? "展开列表" : "隐藏列表";
$.ajax({
url: 'BackstageDataLoad.ashx',
type: 'get',
data: {
type: 'GridRow',
row: sid
},
dataType: 'html',
timeout: 10000
})
}
function GetFocus() {
if (typeof (window.childWindow) != "undefined") {//如果子窗口存在,将焦点转到子窗口
window.childWindow.focus();
}
}
function ShowNew(sid, ev) {
ev = ev || window.event;
var target = ev.target || ev.srcElement;
var oDiv = document.getElementById("div" + sid);
var gv = document.getElementById("<%=CategoryGridView.ClientID %>");
var rowIndex = 1 + 2 * (sid - 1);
var category = gv.rows[rowIndex].cells[1].innerText;
var url = "AddBook.aspx";
var winName = "child";
var awidth = screen.availWidth / 6 * 2; //窗口宽度,需要设置
var aheight = screen.availHeight / 5 * 2; //窗口高度,需要设置
var atop = (screen.availHeight - aheight) / 2; //窗口顶部位置,一般不需要改
var aleft = (screen.availWidth - awidth) / 2; //窗口放中央,一般不需要改
var param0 = "scrollbars=0,status=0,menubar=0,resizable=no,location=0"; //新窗口的参数
var params = "top=" + atop + ",left=" + aleft + ",width=" + awidth + ",height=" + aheight + "," + param0;
EV_modeAlert();
window.childWindow = window.open(url, winName, params); //打开新窗口
window.childWindow.focus(); //新窗口获得焦点
$.ajax({
url: 'BackstageDataLoad.ashx',
type: 'get',
data: {
type: 'btnGridRowAdd',
categoryName: category
},
dataType: 'html',
timeout: 10000
})
}
function refresh() {
this.location = this.location;
}
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">后台管理系统</a>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active">
<asp:LinkButton ID="btn" runat="server" OnClick="btn_Click">菜单栏</asp:LinkButton></li>
<li>
<asp:LinkButton ID="CategoryManager" runat="server" OnClick="CategoryManager_Click">分类管理</asp:LinkButton></li>
<li>
<asp:LinkButton ID="UserManager" runat="server" OnClick="UserManager_Click">用户管理</asp:LinkButton></li>
<li>
<asp:LinkButton ID="OrderManager" runat="server" OnClick="OrderManager_Click">订单管理</asp:LinkButton></li>
<li>
<asp:LinkButton ID="Quit" runat="server" OnClick="Quit_Click">退出</asp:LinkButton></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">后台管理系统</h1>
<div class="table-responsive">
<asp:Panel ID="indexPanel" runat="server">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">首页</h3>
</div>
<div class="panel-body">
<div class="col-xs-6 col-md-2">用户名:<asp:Label class="label label-default" ID="txtUsername" runat="server"></asp:Label></div>
</div>
</div>
</asp:Panel>
<asp:ScriptManager ID="ScriptMgr1" runat="server" />
<asp:UpdatePanel ID="CategoryPanel" UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server">
<ContentTemplate>
<div class="panel panel-default">
<div class="panel-heading">
<h3 style="padding: 6px; float: left" class="panel-title">分类信息</h3>
<asp:Button class="btn btn-sm btn-primary" ID="btnRefreshCategory" runat="server" OnClick="btnRefreshCategory_Click" Text="刷新" />
</div>
<div class="panel-body" style="width: auto; height: auto">
<asp:GridView ID="CategoryGridView" runat="server" class="table table-striped"
AutoGenerateColumns="False" OnRowDataBound="CategoryGridView_RowCommand" AllowPaging="true" PageSize="10"
PagerSettings-Mode="Numeric" PagerStyle-HorizontalAlign="Center"
OnPageIndexChanging="CategoryGridView_PageIndexChanging">
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID" ReadOnly="True" />
<asp:BoundField DataField="CategoryName" HeaderText="分类名" />
<asp:TemplateField>
<ItemTemplate>
<!---点击用于列表展开,执行JS函数--->
<span id="btnShowHidden<%#Eval("ID") %>" onclick="ShowHidden('<%#Eval("ID") %>',event)" class="btn btn-primary">展开列表</span>
<tr>
<td colspan="100%">
<div id="div<%#Eval("ID") %>" style="display: none;">
<div style="float: left; font-size: small">
└
</div>
<div class="panel-body">
<asp:UpdatePanel ID="BookPanel" runat="server">
<ContentTemplate>
<!---绑定内层Gridview--->
<asp:GridView ID="BookGridView" class="table table-striped" runat="server"
AutoGenerateColumns="false" AllowPaging="true" PageSize="3"
OnRowEditing="BookGridView_RowEditing"
OnRowDeleting="BookGridView_RowDeleting"
OnRowCancelingEdit="BookGridView_RowCancelingEdit"
OnRowUpdating="BookGridView_RowUpdating"
OnPageIndexChanging="BookGridView_PageIndexChanging">
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID" ReadOnly="true" />
<asp:BoundField DataField="Name" HeaderText="书籍名称" />
<asp:BoundField DataField="Price" HeaderText="销售价格" />
<asp:BoundField DataField="Stock" HeaderText="库存数量" />
<asp:CommandField HeaderText="编辑" ShowEditButton="True" />
<asp:CommandField HeaderText="删除" ShowDeleteButton="True" />
</Columns>
<PagerTemplate>
<table align="center">
<tr>
<td align="center">第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandArgument="First" CommandName="Page" Text="首页" />
<asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandArgument="Prev" CommandName="Page" Text="上一页" />
<asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandArgument="Next" CommandName="Page" Text="下一页" />
<asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandArgument="Last" CommandName="Page" Text="尾页" />
</td>
</tr>
</table>
</PagerTemplate>
</asp:GridView>
<span style="margin-left: 45%" id="btnShowNew<%#Eval("ID") %>" onclick="ShowNew('<%#Eval("ID") %>', event)" class="btn btn-primary">添加书籍</span>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerTemplate>
<table align="center">
<tr>
<td align="center">第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandArgument="First" CommandName="Page" Text="首页" />
<asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandArgument="Prev" CommandName="Page" Text="上一页" />
<asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandArgument="Next" CommandName="Page" Text="下一页" />
<asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandArgument="Last" CommandName="Page" Text="尾页" />
</td>
</tr>
</table>
</PagerTemplate>
</asp:GridView>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRefreshCategory" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:Panel ID="UserPanel" runat="server">
<asp:UpdatePanel ID="updateUserPanel" ChildrenAsTriggers="false" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="panel panel-default">
<div class="panel-heading">
<h3 style="padding: 6px; float: left" class="panel-title">用户信息</h3>
<asp:Button class="btn btn-sm btn-primary" ID="refreshUser" runat="server" OnClick="refreshUser_Click" Text="刷新" />
</div>
<div class="panel-body">
<asp:GridView ID="UserGridView" runat="server" class="table table-striped"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID" />
<asp:BoundField DataField="UserName" HeaderText="用户名" ReadOnly="True" />
<asp:BoundField DataField="Telephone" HeaderText="联系电话" />
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="refreshUser" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
<asp:Panel ID="OrderPanel" runat="server">
<asp:UpdatePanel ID="UpdateOrderPanel" runat="server">
<ContentTemplate>
<div class="panel panel-default">
<div class="panel-heading">
<h3 style="padding: 6px; float: left" class="panel-title">订单信息</h3>
<asp:Button class="btn btn-sm btn-primary" ID="refreshOrder" runat="server" OnClick="refreshOrder_Click" Text="刷新" />
</div>
<div class="panel-body">
<asp:GridView ID="OrderGridView" runat="server" class="table table-striped"
AutoGenerateColumns="False"
AllowPaging="true" PageSize="10"
PagerSettings-Mode="Numeric" PagerStyle-HorizontalAlign="Center"
OnPageIndexChanging="OrderGridView_PageIndexChanging"
OnRowCommand="OrderGridView_RowCommand"
OnRowDataBound="OrderGridView_RowDataBound">
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID" />
<asp:BoundField DataField="CurState" HeaderText="状态" />
<asp:BoundField DataField="Cost" HeaderText="金额" />
<asp:BoundField DataField="UserName" HeaderText="买家名称" ReadOnly="True" />
<asp:BoundField DataField="Time" HeaderText="下单时间" />
<asp:BoundField DataField="Address" HeaderText="收货地址" />
<asp:BoundField DataField="Receiver" HeaderText="收货人" />
<asp:BoundField DataField="Phone" HeaderText="联系电话" />
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:Button ID="sendGoods" CommandName="sendGood" class="btn btn-primary" runat="server" Text="发货" Visible="false" />
<!---点击用于列表展开,执行JS函数--->
<span id="btnShowHidden<%#Eval("ID") %>" onclick="ShowHidden('<%#Eval("ID") %>',event)" class="btn btn-primary">展开列表</span>
<tr>
<td colspan="100%">
<div id="div<%#Eval("ID") %>" style="display: none;">
<div style="float: left; font-size: small">
└
</div>
<div class="panel-body">
<asp:UpdatePanel ID="BookPanel" runat="server">
<ContentTemplate>
<!---绑定内层Gridview--->
<asp:GridView ID="BookDetailGridView" class="table table-striped" runat="server"
AutoGenerateColumns="false" AllowPaging="true" PageSize="3"
OnPageIndexChanging="BookDetailGridView_PageIndexChanging">
<Columns>
<asp:BoundField DataField="Id" HeaderText="ID" ReadOnly="true" />
<asp:BoundField DataField="Name" HeaderText="书籍名称" />
<asp:BoundField DataField="Amount" HeaderText="数量" />
<asp:BoundField DataField="Stock" HeaderText="库存数量" />
</Columns>
<PagerTemplate>
<table align="center">
<tr>
<td align="center">第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandArgument="First" CommandName="Page" Text="首页" />
<asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandArgument="Prev" CommandName="Page" Text="上一页" />
<asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandArgument="Next" CommandName="Page" Text="下一页" />
<asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandArgument="Last" CommandName="Page" Text="尾页" />
</td>
</tr>
</table>
</PagerTemplate>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerTemplate>
<table align="center">
<tr>
<td align="center">第<asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>' />页
共/<asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>' />页
<asp:LinkButton ID="btnFirst" runat="server" CausesValidation="False" CommandArgument="First" CommandName="Page" Text="首页" />
<asp:LinkButton ID="btnPrev" runat="server" CausesValidation="False" CommandArgument="Prev" CommandName="Page" Text="上一页" />
<asp:LinkButton ID="btnNext" runat="server" CausesValidation="False" CommandArgument="Next" CommandName="Page" Text="下一页" />
<asp:LinkButton ID="btnLast" runat="server" CausesValidation="False" CommandArgument="Last" CommandName="Page" Text="尾页" />
</td>
</tr>
</table>
</PagerTemplate>
</asp:GridView>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="refreshOrder" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</asp:Panel>
</div>
</div>
</div>
</div>
</form>
</body>
</html>