//Username Nvarchar 会员用户名 //Password Nvarchar 会员密码 //Phone Nvarchar 会员移动电话 //Address Nvarchar 用户名 //Mail Nvarchar 邮箱地址 //Usertype Int 会员类型 protected void Button1_Click(object sender, EventArgs e) { string name = this.TextUsername.Text; string pwd = this.TextPassword.Text; string phone = this.TextPhone.Text; string address = this.TextAddress.Text; string mail = this.TextMail.Text; string type = this.TextUsertype.Text; QPS.NEW.Model.Users us = new QPS.NEW.Model.Users(); us.Username = name; us.Password = pwd; us.Phone = phone; us.Address = address; us.Mail = mail; us.Usertype = int.Parse(type); QPS.NEW.BLL.Users user = new QPS.NEW.BLL.Users(); user.Add(us); int i = user.Add(us); if (i > 0) { Response.Write("<script>alert('添加成功!!');</script>"); } else { Response.Write("<script>alert('添加失败!!');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { QPS.NEW.BLL.Users Buser = new QPS.NEW.BLL.Users(); QPS.NEW.Model.Users Uuser = new QPS.NEW.Model.Users(); QPS.NEW.BLL.Enterprise Euser = new QPS.NEW.BLL.Enterprise(); QPS.NEW.Model.Enterprise Muser = new QPS.NEW.Model.Enterprise(); int result = -1; string userType = Request.QueryString["type"].ToString(); string username = Request.QueryString["username"].ToString(); string address = Request.QueryString["add"].ToString(); string mail = Request.QueryString["mail"].ToString(); string pwd = Request.QueryString["pwd"].ToString(); string phone = Request.QueryString["phone"].ToString(); string nickname = Request.QueryString["nickname"].ToString(); if (userType == "user") { Uuser.Username = username; Uuser.Address = address; Uuser.Mail = mail; Uuser.Password = pwd; Uuser.Phone = phone; Uuser.Nickname = nickname; Uuser.Action = "regist"; Uuser.Sign = "48c93e18ffbe4878b344cc1749ff6dc8"; Uuser.Usertype = 0; result = Buser.Add(Uuser); if (result == 1) { Response.Write("1"); } else if (result == -1) { Response.Write("0"); } else { Response.Write("-1"); } } if (userType == "enterprise") { Muser.Username = username; Muser.Address = address; Muser.Mail = mail; Muser.Password = pwd; Muser.Phone = phone; Muser.Nickname = nickname; Muser.IfChecked = 0; result = Euser.Add(Muser); if (result == 1) { Response.Write("1"); } else if (result == -1) { Response.Write("0"); } else { Response.Write("-1"); } } }
protected void Page_Load(object sender, EventArgs e) { QPS.NEW.BLL.Users Buser = new QPS.NEW.BLL.Users(); QPS.NEW.Model.Users Uuser = new QPS.NEW.Model.Users(); QPS.NEW.BLL.Enterprise Euser = new QPS.NEW.BLL.Enterprise(); QPS.NEW.Model.Enterprise Muser = new QPS.NEW.Model.Enterprise(); int result = -1; string userType=Request.QueryString["type"].ToString(); string username = Request.QueryString["username"].ToString(); string address = Request.QueryString["add"].ToString(); string mail = Request.QueryString["mail"].ToString(); string pwd=Request.QueryString["pwd"].ToString(); string phone = Request.QueryString["phone"].ToString(); string nickname = Request.QueryString["nickname"].ToString(); if (userType == "user") { Uuser.Username = username; Uuser.Address = address; Uuser.Mail = mail; Uuser.Password = pwd; Uuser.Phone = phone; Uuser.Nickname = nickname; Uuser.Action = "regist"; Uuser.Sign = "48c93e18ffbe4878b344cc1749ff6dc8"; Uuser.Usertype = 0; result = Buser.Add(Uuser); if (result == 1) { Response.Write("1"); } else if (result == -1) { Response.Write("0"); } else { Response.Write("-1"); } } if (userType == "enterprise") { Muser.Username = username; Muser.Address = address; Muser.Mail = mail; Muser.Password = pwd; Muser.Phone = phone; Muser.Nickname = nickname; Muser.IfChecked = 0; result = Euser.Add(Muser); if (result == 1) { Response.Write("1"); } else if (result == -1) { Response.Write("0"); } else { Response.Write("-1"); } } }
public string getResult(string action) { switch (action) { case "register": if (validate("register")) { Muser.Username = ht["username"].ToString(); Muser.Nickname = ht["nickname"].ToString(); Muser.Password = ht["password"].ToString(); Muser.Sign = ""; Muser.Usertype = 0; if (Buser.Add(Muser) > 0) { return("true"); } else { return("false"); } } else { return("false"); } case "login": if (validate("login")) { if (Buser.Denglu(ht["username"].ToString(), ht["password"].ToString())) { Session["username"] = ht["username"].ToString(); return("true"); } else { return("false"); } } else { return("false"); } case "score": if (validate("score")) { string uname = ht["username"].ToString(); DataSet dsUser = Buser.GetList("Username='******'"); userid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); QPS.NEW.Model.Integral u = BInt.GetModel(userid); if (u.TotalMoney == (int)ht["originalscore"]) { u.TotalMoney = +(int)ht["score"]; if (BInt.Update(u)) { return("true"); } else { return("fales"); } } else { return("false"); } } else { return("false"); } case "editpwd": if (validate("editpwd")) { string uname = ht["username"].ToString(); DataSet dsUser = Buser.GetList("Username='******'"); userid = Convert.ToInt32(dsUser.Tables[0].Rows[0]["Id"]); QPS.NEW.Model.Users u = Buser.GetModel(userid); u.Password = ht["newpassword"].ToString(); if (Buser.Update(u)) { return("true"); } else { return("false"); } } else { return("false"); } case "logout": if (validate("logout")) { if (Session["username"] != null) { Session.Remove("username"); return("true"); } else { return("false"); } } else { return("false"); } default: return("false"); } }