protected void save_Click(object sender, EventArgs e) { try { _key = new publicClass.key(Convert.ToInt32(KEY_list.SelectedValue), 1); _key.State = state.SelectedValue == "0" ? false : true; _key.Uer_id = Convert.ToInt32(this.u_list.SelectedValue); _key.save(); startup(); } catch { } }
protected void KEY_list_SelectedIndexChanged(object sender, EventArgs e) { _key = new publicClass.key(Convert.ToInt32(KEY_list.SelectedValue), 1); if (_key.State) { this.state.SelectedIndex = 0; } else { this.state.SelectedIndex = 1; } u_list.ClearSelection(); foreach (ListItem it in u_list.Items) { if (it.Value == _key.Uer_id.ToString()) { it.Selected = true; } } }
protected void ok_Click(object sender, EventArgs e) { string usbstr = this.usb_sn.Value; string[] usbs = usbstr.Length > 0? usbstr.Substring(1, usbstr.Length - 1).Split(','):new string[] { }; Boolean hasusb = false; try { if (this.valcode_input.Text != Session["valcode"].ToString()) { this.warning.Text = "验证码输入错误,请重试!"; } else { this.warning.Text = ""; DataTable temp = new DataTable(); string cmdstr = "select uer_id from uer where 1=1 and uer_no like '" + this.uer_no.Text + "'"; try { publicClass.Dosql ds = new publicClass.Dosql(); ds.DoRe(cmdstr); if (ds.Sqled) { temp = ds.DtOut; publicClass.Uer _uer = new publicClass.Uer(Convert.ToInt32(temp.Rows[0][0])); publicClass.key _key = new publicClass.key(_uer.Uid); foreach (string str in usbs) { if (_key.Key_word == publicClass.str2base64.to64(str) && _key.State) { hasusb = true; } } //if (!hasusb) { throw new Exception("USBKEY"); } if (this.uer_psw.Text.Equals(_uer.Upsw)) { Session["uer_id"] = _uer.Uid; Session["login"] = "******"; Response.Redirect("index.aspx"); } else { throw new Exception("PSSWORD"); } } else { throw new Exception("USER"); } } catch (Exception ex) { this.warning.Text = "登录信息有误,请核对!——" + ex.Message; } } } catch { } }