protected void Page_Load(object sender, EventArgs e) { if (Session["_userid"] == null) { Common.MessageAlert.AlertLocation(Page, "alert('对不起,您没有登陆!');location.href='Login.aspx'"); } else { Label1.Text = Session["_username"].ToString(); Model.user mol = new Model.user(); mol.userid = Convert.ToInt32(Session["_userid"]); BLL.user bls = new BLL.user(); SqlDataReader dr = bls.checkById(mol); if (dr.Read()) { Label2.Text = dr["_logintime"].ToString(); } DateTime dt = DateTime.Now; Model.user mod = new Model.user(); mod.userid = Convert.ToInt32(Session["_userid"]); mod.time = dt; BLL.user blur = new BLL.user(); int i = blur.loginLastTime(mod); } //下载于www.mycodes.net }
protected void Button2_Click(object sender, EventArgs e) { if (Page.IsValid == true) { Model.user mos = new Model.user(); mos.userid = Convert.ToInt32(Session["_userid"]); mos.pwd = TextBox7.Text; BLL.userBLL blus = new BLL.userBLL(); MySqlDataReader dr = blus.drp(mos); if (dr.Read()) { Model.user mod = new Model.user(); mod.userid = Convert.ToInt32(Session["_userid"]); mod.pwd = Server.HtmlEncode(TextBox9.Text); BLL.userBLL bllu = new BLL.userBLL(); int i = bllu.upwd(mod); if (i > 0) { Common.MessageAlert.Alert(Page, "密码修改成功!"); } else { Common.MessageAlert.Alert(Page, "密码修改不成功!"); } dr.Close(); } else { Common.MessageAlert.Alert(Page, "原密码错误!"); } } }
protected void Button2_Click(object sender, EventArgs e) { if (Page.IsValid == true) { Model.user mos = new Model.user(); mos.userid = Convert.ToInt32(Session["_user_id"]); mos.pwd = TextBox7.Text; BLL.user blus = new BLL.user(); SqlDataReader dr = blus.drp(mos); if (dr.Read()) { Model.user mod = new Model.user(); mod.userid = Convert.ToInt32(Session["_user_id"]); mod.pwd = Server.HtmlEncode(TextBox9.Text); BLL.user bllu = new BLL.user(); int i = bllu.upwd(mod); if (i > 0) { Common.MessageAlert.Alert(Page, "密码修改成功!"); } else { Common.MessageAlert.Alert(Page, "密码修改不成功!"); } dr.Close(); } else { Common.MessageAlert.Alert(Page, "原密码错误!"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["_userid"] == null) { Common.MessageAlert.AlertLocation(Page, "alert('对不起,您没有登陆!');location.href='Login.aspx'"); } else { Label1.Text=Session["_username"].ToString(); Model.user mol = new Model.user (); mol.userid = Convert.ToInt32(Session["_userid"]); BLL.userBLL bls = new BLL.userBLL(); MySqlDataReader dr = bls.drti(mol); if (dr.Read()) { Label2.Text = dr["_logintime"].ToString(); } DateTime dt = DateTime.Now; Model.user mod = new Model.user(); mod.userid = Convert.ToInt32(Session["_userid"]); mod.time = dt; BLL.userBLL blur = new BLL.userBLL(); int i = blur.update(mod); } }
public void ss() { Model.user mod = new Model.user(); mod.username = TextBox3.Text; BLL.adminuser blls = new BLL.adminuser(); int i = blls.coun(mod); AspNetPager1.RecordCount = i; AspNetPager1.PageSize = 5; }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { int i = Convert.ToInt32(e.CommandArgument); Model.user mode = new Model.user(); mode.userid = i; BLL.adminuser bll = new BLL.adminuser(); int result = bll.dele(mode); if (result > 0) { Response.Write("<script>alert('删除成功!');location.href='userselect.aspx'</script>"); } GridView1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { Model.user mo = new Model.user(); mo.userid = Convert.ToInt32(Session["_userid"]); mo.msn = Server.HtmlEncode(TextBox5.Text); mo.qq =Server.HtmlEncode(TextBox6.Text); mo.safequestion =Server.HtmlEncode(TextBox1.Text); mo.safepwd =Server.HtmlEncode(TextBox2.Text); BLL.userBLL bllu = new BLL.userBLL(); int i = bllu.upus(mo); if (i > 0) { Common.MessageAlert.Alert(Page, "修改成功!"); } else { Common.MessageAlert.Alert(Page,"修改失败!"); } }
/// <summary> /// Queries the appointment table for all appointments from current day onward, order by appointment start. /// </summary> /// <param name="user">User whose appointments are desired.</param> /// <returns></returns> public List <appointment> GetUserAppointments(Model.user user) { // Return all appointments from current day onward, ordered by appointment start. This makes iterating in the reports easier. List <appointment> utcApps = dbcontext.appointments .Where(appointment => appointment.user.userName == user.userName && appointment.start.Month == DateTime.Now.Month && appointment.start.Day >= DateTime.Now.Day) .OrderBy(appointment => appointment.start) .ToList(); foreach (appointment app in utcApps) { app.start = app.start.ToLocalTime(); app.end = app.end.ToLocalTime(); } Console.WriteLine(utcApps.Count()); return(utcApps); }
private void login() { string attemptedUsername = usernameTextBox.Text; string attemptedPassword = passwordTextBox.Text; try { dbcontext.users.Load(); var query = from user in dbcontext.users.Local where user.userName == attemptedUsername select user; // Handle UserNotFound case. if (query.Count() == 0) { throw new UserNotFoundException(attemptedUsername); } foreach (var user in query) { if (user.password == attemptedPassword) { // Fire Succuessful Login Event. string success = Properties.Resources.LoginSuccess; MessageBox.Show(success); Logger.Log.LogEvent("Login_Log.txt", $"{success} for {attemptedUsername}"); CurrentLoggedInUser = user; Close(); CheckForEvents(); mainForm.ShowDataForm(); return; } } // Handle Credential Mismatch case. throw new MismatchingCredentialsException(Properties.Resources.MistmatchingCredentialsExceptionMessage); } catch (Exception e) { MessageBox.Show(e.Message, "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Logger.Log.LogEvent("Login_Log.txt", e.Message); } }
protected void Button1_Click(object sender, EventArgs e) { Model.user mo = new Model.user(); mo.userid = Convert.ToInt32(Session["_user_id"]); mo.msn = Server.HtmlEncode(TextBox5.Text); mo.qq = Server.HtmlEncode(TextBox6.Text); mo.safequestion = Server.HtmlEncode(TextBox1.Text); mo.safepwd = Server.HtmlEncode(TextBox2.Text); BLL.user bllu = new BLL.user(); int i = bllu.upus(mo); if (i > 0) { Common.MessageAlert.Alert(Page, "修改成功!"); } else { Common.MessageAlert.Alert(Page, "修改失败!"); } }
public void pp() { Model.user mod = new Model.user(); mod.userid = Convert.ToInt32(Session["_userid"]); BLL.userBLL bll = new BLL.userBLL(); MySqlDataReader dr = bll.drs(mod); if(dr!=null) { if (dr.Read()) { Label2.Text = dr["_email"].ToString(); Label1.Text = dr["_username"].ToString(); TextBox5.Text = dr["_msn"].ToString(); TextBox6.Text = dr["_qq"].ToString(); TextBox1.Text = dr["_safequestion"].ToString(); TextBox2.Text = dr["_safepwd"].ToString(); } dr.Close(); } }
public void pp() { Model.user mod = new Model.user(); mod.userid = Convert.ToInt32(Session["_user_id"]); BLL.user bll = new BLL.user(); SqlDataReader dr = bll.drs(mod); if (dr != null) { if (dr.Read()) { Label2.Text = dr["_email"].ToString(); Label1.Text = dr["_user_name"].ToString(); TextBox5.Text = dr["_msn"].ToString(); TextBox6.Text = dr["_qq"].ToString(); TextBox1.Text = dr["_safe_question"].ToString(); TextBox2.Text = dr["_safe_pwd"].ToString(); } dr.Close(); } }
public void pp() { int i=Convert.ToInt32(Request.QueryString["id"]); Model.user mo = new Model.user(); mo.userid = i; BLL.adminuser bll = new BLL.adminuser(); MySqlDataReader dr = bll.drus(mo); if (dr.Read()) { TextBox1.Text = dr["_userid"].ToString(); TextBox2.Text = dr["_username"].ToString(); TextBox3.Text = dr["_pwd"].ToString(); TextBox4.Text = dr["_email"].ToString(); TextBox5.Text = dr["_qq"].ToString(); TextBox6.Text = dr["_msn"].ToString(); TextBox7.Text = dr["_registtime"].ToString(); TextBox8.Text = dr["_safequestion"].ToString(); TextBox9.Text = dr["_safepwd"].ToString(); dr.Close(); } }
protected void Page_Load(object sender, EventArgs e) { Regex r = new Regex("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"); if (Request["email"] != null && Request["email"].Trim().Length > 0) { string email = Request["email"].ToString(); //判断邮箱格式是否正确 if (r.IsMatch(email)) { Model.user mod = new Model.user(); mod.email = email; BLL.user bk = new BLL.user(); SqlDataReader dr = bk.pp(mod); if (dr.Read()) { Response.Write("0"); Response.End(); } else { Response.Write("1"); Response.End(); } } else { Response.Write("2"); Response.End(); } } else { Response.Write("3"); Response.End(); } }
public void pp() { int i = Convert.ToInt32(Request.QueryString["id"]); Model.user mo = new Model.user(); mo.userid = i; BLL.adminuser bll = new BLL.adminuser(); SqlDataReader dr = bll.drus(mo); if (dr.Read()) { TextBox1.Text = dr["_user_id"].ToString(); TextBox2.Text = dr["_user_name"].ToString(); TextBox3.Text = dr["_pwd"].ToString(); TextBox4.Text = dr["_email"].ToString(); TextBox5.Text = dr["_qq"].ToString(); TextBox6.Text = dr["_msn"].ToString(); TextBox7.Text = dr["_regist_time"].ToString(); TextBox8.Text = dr["_safe_question"].ToString(); TextBox9.Text = dr["_safe_pwd"].ToString(); dr.Close(); } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox3.Text == "") { Label2.Visible = true; Label3.Visible = true; GridView1.Visible = false; AspNetPager1.Visible = false; } else { Label2.Visible = false; Label3.Visible = true; GridView1.Visible = true; AspNetPager1.Visible = true; Model.user mod = new Model.user(); mod.username = TextBox3.Text; BLL.adminuser blls = new BLL.adminuser(); int i = blls.coun(mod); AspNetPager1.RecordCount = i; AspNetPager1.PageSize = 5; Model.user mode = new Model.user(); mode.username = TextBox3.Text; DataSet ds = blls.seu(AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "user", mod); GridView1.DataSource = ds.Tables["user"]; GridView1.DataBind(); if (i == 0) { AspNetPager1.Visible = false; Label2.Visible = true; Label3.Visible = false; } } }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox3.Text == "") { Label2.Visible = true; Label3.Visible = true; GridView1.Visible = false; AspNetPager1.Visible = false; } else { Label2.Visible = false; Label3.Visible = true; GridView1.Visible = true; AspNetPager1.Visible = true; Model.user mod = new Model.user(); mod.username = TextBox3.Text; BLL.adminuser blls = new BLL.adminuser(); int i = blls.coun(mod); AspNetPager1.RecordCount = i; AspNetPager1.PageSize = 5; Model.user mode = new Model.user(); mode.username = TextBox3.Text; DataSet ds = blls.seu(AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "user",mod); GridView1.DataSource = ds.Tables["user"]; GridView1.DataBind(); if (i == 0) { AspNetPager1.Visible = false; Label2.Visible = true; Label3.Visible = false; } } }
public bool zhuce(Model.user u) { return(l.zhuce(u)); }
public bool userlogin(Model.user u) { return(l.select(u)); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (Page.IsValid == true) { Model.user mod = new Model.user(); mod.email = TextBox7.Text; BLL.user bk = new BLL.user(); SqlDataReader dr = bk.pp(mod); if (dr != null) { if (dr.Read()) { Common.MessageAlert.Alert(Page, "该邮箱号已存在!"); TextBox7.Text = " "; dr.Close(); } else { Model.user mo = new Model.user(); mo.email = Server.HtmlEncode(TextBox7.Text); mo.pwd = Server.HtmlEncode(TextBox6.Text); mo.username = Server.HtmlEncode(TextBox8.Text); mo.qq = Server.HtmlEncode(TextBox2.Text); mo.msn = Server.HtmlEncode(TextBox3.Text); mo.safequestion = Server.HtmlEncode(TextBox4.Text); mo.safepwd = Server.HtmlEncode(TextBox5.Text); BLL.user bll = new BLL.user(); int i = bll.insert(mo); if (i > 0) { Common.MessageAlert.AlertLocation(Page, "alert('注册成功');location.href='Login.aspx'"); Model.user mod1 = new Model.user(); mod1.email = TextBox7.Text; BLL.user blluser = new BLL.user(); SqlDataReader dr1 = blluser.findByMail(mod1); if (dr1.Read()) { Session["_userid"] = dr1["_userid"].ToString(); dr1.Close(); } dr1.Close(); Model.address moadd = new Model.address(); moadd.userid = Convert.ToInt32(Session["_userid"]); BLL.daladdress bld = new BLL.daladdress(); int f = bld.upada(moadd); TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; } else { Common.MessageAlert.Alert(Page, "注册失败!"); } } } } }
protected void ImageButton1_Click(object sender, EventArgs e) { string email = Server.HtmlEncode(Request["logname"]); string pwd = Server.HtmlEncode(Request["logpass"]); Model.user mod = new Model.user(); mod.email = email; mod.pwd = pwd; BLL.user bll = new BLL.user(); SqlDataReader dr = bll.login(mod); //ds.Tables[0].Rows[0]["_user_id"]; if (true) { SqlDataReader dr1 = bll.lo(mod); if (dr1.Read()) { Session["_user_name"] = dr1["_user_name"].ToString(); Session["_user_id"] = dr1["_user_id"].ToString(); dr1.Close(); } dr1.Close(); } else { Session["_user_name"] = ""; } if (true) { if (true) { if (dr.Read()) { Response.Redirect("index.aspx"); Model.user mol = new Model.user(); mol.userid = Convert.ToInt32(Session["_user_id"]); BLL.user bllu = new BLL.user(); int r = bllu.update(mol); SqlDataReader dr2 = bll.lo(mod); if (dr2.Read()) { Session["_user_name"] = dr2["_user_name"].ToString(); Session["_user_id"] = dr2["_user_id"].ToString(); dr2.Close(); } dr2.Close(); } else { Common.MessageAlert.Alert(Page, "登入失败!"); } } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string email = Server.HtmlEncode(TextBox3.Text); string pwd = Server.HtmlEncode(TextBox4.Text); Model.user mod = new Model.user(); mod.email = email; mod.pwd = pwd; BLL.user bll = new BLL.user(); SqlDataReader dr = bll.login(mod); if (CheckBox1.Checked) { SqlDataReader dr1 = bll.lo(mod); if (dr1.Read()) { Session["_username"] = dr1["_username"].ToString(); Session["_userid"] = dr1["_userid"].ToString(); dr1.Close(); } dr1.Close(); } else { Session["_username"] = ""; } if (Session["CheckCode"] != null) { if (TextBox1.Text.ToLower() == Session["CheckCode"].ToString().ToLower()) { if (dr.Read()) { Response.Redirect("ACIndex.aspx"); Model.user mol = new Model.user(); mol.userid = Convert.ToInt32(Session["_userid"]); BLL.user bllu = new BLL.user(); int r = bllu.loginLastTime(mol); SqlDataReader dr2 = bll.lo(mod); if (dr2.Read()) { Session["_username"] = dr2["_username"].ToString(); Session["_userid"] = dr2["_userid"].ToString(); dr2.Close(); } dr2.Close(); } else { Common.MessageAlert.Alert(Page, "账号或密码错误,登入失败!"); } } else { Common.MessageAlert.Alert(Page, "验证码错误!"); } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string email = Server.HtmlEncode(TextBox3.Text); string pwd = Server.HtmlEncode(TextBox4.Text); Model.user mod = new Model.user(); mod.email = email; mod.pwd = pwd; BLL.userBLL bll = new BLL.userBLL(); MySqlDataReader dr = bll.login(mod); //ds.Tables[0].Rows[0]["_userid"]; if (CheckBox1.Checked) { MySqlDataReader dr1 = bll.lo(mod); if (dr1.Read()) { Session["_username"] = dr1["_username"].ToString(); Session["_userid"]=dr1["_userid"].ToString(); dr1.Close(); } dr1.Close(); } else { Session["_username"] = ""; } if (Session["CheckCode"] != null) { if (TextBox1.Text.ToLower() == Session["CheckCode"].ToString().ToLower()) { if (dr.Read()) { Response.Redirect("ACIndex.aspx"); Model.user mol = new Model.user(); mol.userid = Convert.ToInt32(Session["_userid"]); BLL.userBLL bllu = new BLL.userBLL(); int r = bllu.update(mol); MySqlDataReader dr2 = bll.lo(mod); if (dr2.Read()) { Session["_username"] = dr2["_username"].ToString(); Session["_userid"] = dr2["_userid"].ToString(); dr2.Close(); } dr2.Close(); } else { Common.MessageAlert.Alert(Page, "登入失败!"); } } else { Common.MessageAlert.Alert(Page, "验证码错误!"); } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (Page.IsValid == true) { Model.user mod = new Model.user(); mod.email = TextBox7.Text; BLL.userBLL bk = new BLL.userBLL(); MySqlDataReader dr = bk.pp(mod); if (dr != null) { if (dr.Read()) { Common.MessageAlert.Alert(Page, "该邮箱号已存在!"); TextBox7.Text=" "; dr.Close(); } else { Model.user mo = new Model.user(); mo.email = Server.HtmlEncode(TextBox7.Text); mo.pwd = Server.HtmlEncode(TextBox6.Text); mo.username = Server.HtmlEncode(TextBox8.Text); mo.qq = Server.HtmlEncode(TextBox2.Text); mo.msn = Server.HtmlEncode(TextBox3.Text); mo.safequestion = Server.HtmlEncode(TextBox4.Text); mo.safepwd = Server.HtmlEncode(TextBox5.Text); BLL.userBLL bll = new BLL.userBLL(); int i = bll.insert(mo); if (i > 0) { Common.MessageAlert.AlertLocation(Page, "alert('注册成功');location.href='Login.aspx'"); Model.user mod1 = new Model.user(); mod1.email = TextBox7.Text; BLL.userBLL blluser = new BLL.userBLL(); MySqlDataReader dr1 = blluser.drid(mod1); if (dr1.Read()) { Session["_userid"] = dr1["_userid"].ToString(); dr1.Close(); } dr1.Close(); Model.address moadd = new Model.address (); moadd.userid = Convert.ToInt32(Session["_userid"]); BLL.daladdress bld = new BLL.daladdress (); int f = bld.upada(moadd); TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; TextBox6.Text = ""; TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; } else { Common.MessageAlert.Alert(Page, "注册失败!"); } } } } }
public bool update(Model.user u) { return(l.update(u)); }