public void ProcessRequest(HttpContext context) { UsersDC get_user_name = new UsersDC(); List <string> list = new List <string>(); list = get_user_name.getAllEnabledUser_name(); string json = toJson(list); context.Response.ContentType = "text/plain"; context.Response.Write(json); }
protected void Button1_Click(object sender, EventArgs e) { string Username1 = user_name1.Value.Trim(); string department1 = department.Value.Trim(); string password1 = password.Value.Trim(); UsersDC userDC = new UsersDC(); string prompt = userDC.register(Username1, department1, password1);//传注册信息 if (prompt == "注册成功!") { Response.Write("<script>alert('" + prompt + "');window.location.href ='LoginPDA.aspx';</script>"); //输出注册结果并返回登录页面 } else { Response.Write("<script>alert('" + prompt + "');</script>"); user_name1.Value = String.Empty; department.Value = String.Empty; password.Value = String.Empty; } }
protected void submit_Click(object sender, EventArgs e) { string user_name = username.Value; string user_password = password.Value; string new_password = newpassword2.Value; UsersDC udc = new UsersDC(); if (udc.resetPassWord(user_name, user_password, new_password)) { PageUtil.showAlert(this, "密码修改成功!"); } else { PageUtil.showAlert(this, "帐号或密码错误!"); } username.Value = string.Empty; password.Value = string.Empty; newpassword1.Value = string.Empty; newpassword2.Value = string.Empty; }
protected void login_Click(object sender, EventArgs e) { string user_name = username.Value.Trim(); string user_password = password.Value.Trim(); UsersDC udc = new UsersDC(); if (udc.login(user_name, user_password)) { Model.ModelUsers user = udc.searchUsersByName(user_name); //如果登陆成功,设置session =>登陆者id和登录名 Session["LoginId"] = user.User_id; Session["LoginName"] = user_name; Session["Local"] = "welcome"; //Response.Write("<script>alert('');</script>"); Response.Redirect("Welcome.aspx"); } else { //弹出提示,帐号或密码错误 Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('帐号或密码错误,请重新输入!');</script>"); } }