protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["id"] = ""; if (Request.QueryString["id"] != null && Request.QueryString["vc"] != null && Request.QueryString["ne"] != null) { Model.tab_customers modelCu = new Model.tab_customers(); Bll.CustomerBll Cb = new Bll.CustomerBll(); modelCu.customerID = int.Parse(Request.QueryString["id"]); modelCu = Cb.getCustomer(modelCu); if (modelCu == null || modelCu.customerValidateCode != Request.QueryString["vc"]) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('" + (string)GetGlobalResourceObject("GResource", "alertlinkcannotrec") + "');window.location.href = 'login.aspx';</script>"); //Response.Redirect("login.aspx", true); } else { modelCu.customerPrivateEmail = Request.QueryString["ne"]; Cb.update(modelCu); Session["id"] = modelCu.customerID; Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('" + (string)GetGlobalResourceObject("GResource", "alertnewemailok") + "');window.location.href = 'index.aspx';</script>"); //Response.Redirect("default.aspx"); } } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('" + (string)GetGlobalResourceObject("GResource", "alertlinkcannotrec") + "');window.location.href = 'login.aspx';</script>"); //Response.Redirect("login.aspx", true); } } }
protected void Button2_Click(object sender, EventArgs e) { Model.tab_customers modelCu = new Model.tab_customers(); Bll.CustomerBll Cb = new Bll.CustomerBll(); modelCu.customerID = int.Parse(Session["id"].ToString()); modelCu = Cb.getCustomer(modelCu); modelCu.customerMsg = "agreed"; Cb.update(modelCu); //Bll.messageBll mb = new Bll.messageBll(); //mb.sendmsg(1003, modelCu); //Session["firstlogin"] = ""; Response.Redirect("reserveexam.aspx"); }
protected void Button3_Click(object sender, EventArgs e) { string s = ""; int sus = 0, err = 0; string errid = ""; if (this.TextBox2.Text == "") { if (this.TextBox1.Text.Contains('-') || this.TextBox1.Text.Contains(',')) { string[] oid = this.TextBox1.Text.Split('-'); if (this.TextBox1.Text.Contains('-')) { s = "select customerID, customerCode,customerIDcard from tab_customers where customerID>=" + oid[0] + " and customerID<=" + oid[1]; } else { s = "select customerID, customerCode,customerIDcard from tab_customers where customerID in (" + oid[0] + ")"; } Model.tab_customers cus = new Model.tab_customers(); Bll.CustomerBll cusb = new Bll.CustomerBll(); DataTable dt = dbsql.ExecuteDataSet(s).Tables[0]; string pw = "123456"; string idcard; for (int i = 0; i < dt.Rows.Count; i++) { cus.customerID = Convert.ToInt32(dt.Rows[i]["customerID"]); cus = cusb.getCustomer(cus); cus.customerPwd = ""; idcard = dt.Rows[i]["customerIDcard"].ToString(); if (idcard.Length < 6) { idcard = "123456"; } else { idcard = idcard.Substring(idcard.Length - 6, 6); } pw = idcard; cus.customerPwd = pc.md5(pw); cusb.update(cus); } Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('修改成功。');</script>"); } } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('请输入密码!');</script>"); } }
protected void Button3_Click(object sender, EventArgs e) { if (this.RadioButton3.Checked && this.TextBox10.Text == "") { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "message", " <script>alert('请填写初始化密码!');</script>"); return; } Model.tab_customers cus = new Model.tab_customers(); Bll.CustomerBll cusb = new Bll.CustomerBll(); string s = "select customerID, customerCode,customerIDcard from tab_customers where customerCompanycode='" + modelcp.Companycode + "'"; DataTable dt = dbsql.ExecuteDataSet(s).Tables[0]; string pw = "123456"; string idcard; for (int i = 0; i < dt.Rows.Count; i++) { cus.customerID = Convert.ToInt32(dt.Rows[i]["customerID"]); cus = cusb.getCustomer(cus); cus.customerPwd = ""; if (this.RadioButton1.Checked) { pw = dt.Rows[i]["customerCode"].ToString(); } else if (this.RadioButton2.Checked) { idcard = dt.Rows[i]["customerIDcard"].ToString(); if (idcard.Length < 6) { idcard = "123456"; } else { idcard = idcard.Substring(idcard.Length - 6, 6); } pw = idcard; } else if (this.RadioButton3.Checked) { pw = this.TextBox10.Text; } cus.customerPwd = pc.md5(pw); cusb.update(cus); } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "message", " <script>alert('初始化密码完成!');</script>"); }