public int login(string username, string password) { AccountDal login = new AccountDal(); var entity = login.GetEntities(i => i.Username == username); if (entity.Count <Account>() == 0) { //Response.Write("<script>alert('不存在该用户!')</script>"); return(0); } foreach (var p in entity) { if (p.Password.Equals(password)) { //Response.Write("<script>alert('密码正确!')</script>"); //Session["key"] = TextBox1.Text; //Server.Transfer("user.aspx"); return(1); } else { //Response.Write("<script>alert('密码错误!')</script>"); return(2); } } return(0); }
public void deleteMem(Guid pid) { var mems = _ecdal.GetEntities(m => m.PID == pid); XiaoYan xy = null; foreach (var mem in mems) { xy = mem; } var pers = _persondal.GetEntities(m => m.PID == pid); Person ps = null; foreach (var per in pers) { ps = per; } var accs = _account.GetEntities(m => m.Username == ps.Username); Account at = null; foreach (var acc in accs) { at = acc; } if (xy != null) { _memdal.Delete(xy); _persondal.Delete(ps); _account.Delete(at); } }
public void TestMethod2() { AccountDal login = new AccountDal(); var entity = login.GetEntities(i => i.Username == "echo"); using (StreamWriter writer = new StreamWriter(@"C:\Users\lenovo\Desktop\t.txt", true)) { foreach (var p in entity) { writer.WriteLine(p.Username); } } //account.Insert(new Account { Username = "******",Password = "******" }); }
protected void Button1_Click(object sender, EventArgs e) { AccountDal login = new AccountDal(); var entity = login.GetEntities(i => i.Username == TextBox1.Text); if (entity.Count <Account>() == 0) { Response.Write("<script>alert('不存在该用户!')</script>"); } foreach (var p in entity) { if (p.Password.Equals(TextBox2.Text)) { //Response.Write("<script>alert('密码正确!')</script>"); Session["key"] = TextBox1.Text; Server.Transfer("user.aspx"); } else { Response.Write("<script>alert('密码错误!')</script>"); } } }