forked from hard1code/hand_shaken-webfrom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SysUser.aspx.cs
72 lines (62 loc) · 2.15 KB
/
SysUser.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
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows;
namespace hand_shaken_webform
{
public partial class SysUser : System.Web.UI.Page
{
dbClass myDatabase = new dbClass();
DataTable orderTable = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
User_View(sender, e);
}
else
{
}
}
protected void User_View(object sender, EventArgs e)
{
string sqlStr = " select " +
" id,"+
" account, "+
" name," +
" mobile," +
" address," +
" email," +
" Format(post_time,'yyyy-MM-dd') post_time, " +
" position " +
" from " +
" sys_User "+
" order by name asc ";
orderTable = myDatabase.GetDataTable(sqlStr);
Sys_User_Grid.DataSource = orderTable;
Sys_User_Grid.DataBind();
}
protected void Edit_User(object sender, EventArgs e)
{
Button editButton = (Button)sender;
String user_id = (string)editButton.CommandArgument;
Session["edit_user_id"] = user_id;
Response.Redirect("~/SysUserCreateEdit");
}
protected void Create_User(object sender, EventArgs e)
{
Session["edit_user_id"] = "";
Response.Redirect("~/SysUserCreateEdit");
}
protected void Delete_User(object sender, EventArgs e)
{
Button delButton = (Button)sender;
String user_id = (string)delButton.CommandArgument;
string sqlStr = "delete sys_user where id = " + myDatabase.qo(user_id);
myDatabase.execSQL(sqlStr);
DialogClass.MessageSimple("刪除成功");
User_View(sender, e);
}
}
}