-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUsers.aspx.cs
73 lines (67 loc) · 2.24 KB
/
Users.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class Users : System.Web.UI.Page
{
public static string kode;
protected void Page_Load(object sender, EventArgs e)
{
kode = Request.QueryString["code"];
}
protected void btnReturn_Click(object sender, EventArgs e)
{
Response.Redirect("Home.aspx?code=" + kode);
}
protected void btnReturn2_Click(object sender, EventArgs e)
{
Response.Redirect("Home.aspx?code=" + kode);
}
protected void btnUsrInsert_Click(object sender, EventArgs e)
{
string t1, t2, t3, c;
t1 = t2 = t3 = c = " ";
//---------------------------------
SqlDataReader drUser;
drUser = DB.ExecuteReader("SELECT max(Code) as id FROM [Shoora].[dbo].[TblUser]");
if (drUser.Read())
c = drUser["id"].ToString();
//---------------------------------
Dictionary<string, object> param = new Dictionary<string, object>();
param.Add("@Code", int.Parse(c) + 1);
param.Add("@Name", txtName.Text);
param.Add("@Password", txtPassword.Text);
param.Add("@Markaz", ddlMarkaz.SelectedValue);
switch (rblAccess.SelectedValue)
{
case "1":
{
t1 = "1";
t2 = t3 = "0"; break;
}
case "2":
{
t2 = "1";
t1 = t3 = "0"; break;
}
case "3":
{
t3 = "1";
t1 = t2 = "0"; break;
}
default: break;
}
param.Add("@tag51", t1);
param.Add("@tag52", t2);
param.Add("@tag53", t3);
DB.ExecuteNonQuery("INSERT INTO TblUser (Code,name,password,markaz,tag51,tag52,tag53) values (@Code,@Name,@Password,@Markaz,@tag51,@tag52,@tag53)", param);
Response.Redirect("Users.aspx");
}
protected void btnUsrCancel_Click(object sender, EventArgs e)
{
Response.Redirect("Users.aspx");
}
}