-
Notifications
You must be signed in to change notification settings - Fork 1
/
Adm_EditUserInfo.aspx.cs
66 lines (62 loc) · 2.22 KB
/
Adm_EditUserInfo.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Adm_EditUserInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Txt_UserName.Enabled = false;
Txt_tt.Enabled = false;
Lbl_UserNam.Enabled = false;
Lbl_UserPWA3.Enabled = false;
Lsc_EVotingDataContext db = new Lsc_EVotingDataContext();
var query = from Row in db.tblUsers
where Row.UsersName.Trim() == Session["UserName"].ToString().Trim()
select Row;
foreach (var r in query)
{
Txt_Name.Text = r.NameOfUser;
Txt_PassWord.Text = r.UsersPwa;
Txt_Phone.Text = r.UserMobilePhone;
Txt_SName.Text = r.SnameOfUser;
Txt_tt.Text = r.UserEmail;
Txt_UserName.Text = r.UsersName;
}
}
}
protected void Btn_Update_Click(object sender, EventArgs e)
{
Lbl_Massage.Visible = false;
try
{
Lsc_EVotingDataContext db = new Lsc_EVotingDataContext();
tblUser add = db.tblUsers.Single(n => n.UsersName == Session["UserName"].ToString());
add.NameOfUser = Txt_Name.Text;
add.SnameOfUser = Txt_SName.Text;
add.UserEmail = Txt_tt.Text;
add.UserMobilePhone = Txt_Phone.Text;
add.UsersName = Txt_UserName.Text;
add.UsersPwa = Txt_PassWord.Text;
add.UserTypeID = 2;
db.SubmitChanges();
Lbl_Massage.Visible = true;
Lbl_Massage.Text = "عملیات ویرایش انجام شد!";
Txt_Name.Text = "";
Txt_SName.Text = "";
Txt_tt.Text = "";
Txt_Phone.Text = "";
Txt_UserName.Text = "";
Txt_PassWord.Text = "";
}
catch
{
Lbl_Massage.Visible = true;
Lbl_Massage.Text = "عملیات ویرایش انجام نشد!";
}
}
}