-
Notifications
You must be signed in to change notification settings - Fork 0
/
RegInfo.aspx.cs
65 lines (58 loc) · 2.84 KB
/
RegInfo.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Maticsoft.DBUtility;
public partial class RegInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
wxuserid.Text = WeiXin.GetCookie("userid");
}
}
protected void workcode_TextChanged(object sender, EventArgs e)
{
SQLHelper helper = new SQLHelper();
string P1 = workcode.Text;
var sql = string.Format(" select a.* from [172.16.5.6].ehr_db.dbo.view_hr_emp a where a.EMPLOYEEID='{0}' ", P1);
var dt = DbHelperSQL.Query(sql).Tables[0];
if (dt.Rows.Count == 0)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "alertinfo", "$(\"input[id*=workcode]\").val('');alert('暂未发现您提供工号【" + P1 + "】对应姓名或此人已离职,请确认工号是否正确(工号为5位数字如:02067)。如多次输入仍不行,请及时联系 IT 帮忙确认.')", true);
return;
}
else
{
name.Text = dt.Rows[0]["truename"].ToString();
ScriptManager.RegisterStartupScript(Page, this.GetType(), "alertinfo", "alert('你输入的人员为【" + P1 + " " + name.Text + "】.请确认是否你本人,无误再点确定保存.')", true);
}
}
protected void registerBtn_Click(object sender, EventArgs e)
{
if (Request["code"].ToString() == "1") //完善信息
{
var sql = string.Format("update dbo.WX_User set workcode = '{0}' where wxuserid = '{1}' ", workcode.Text,wxuserid.Text);
bool i = SQLHelper.ExSql(sql);
if (i == false)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "alertinfo", "alert('保存数据失败,请再试试。如果多次不行,请及时联系 IT 帮忙确认.')", true);
}
else
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "alertinfo", "alert('保存数据成功,请退出程序,重新进入。如仍有问题,请及时联系 IT 帮忙确认.')", true);
}
}
else if (Request["code"].ToString() == "0") //临时手动cookie
{
WeiXin.SetCookie("workcode", workcode.Text,1);
string json = "{\"WorkCode\":\""+ workcode.Text + "\",\"UserName\":\""+name.Text+"\"}";
WeiXin.SetCookie("usermodel", HttpUtility.UrlEncode(json, System.Text.Encoding.GetEncoding("UTF-8")), 1);
WeiXin.SetCookie("cookiedate", DateTime.Now.ToString(), 1);
ScriptManager.RegisterStartupScript(Page, this.GetType(), "alertinfo", "alert('成功,请退出程序,重新进入。')", true);
}
}
}