protected void BtnOk_Click(object sender, EventArgs e) { Business.users users = new Business.users(); Business.usersData usersdata = new Business.usersData(); usersdata.userid = userid.Text; usersdata.userpwrd = userpwrd.Text; usersdata.username = username.Text; usersdata.usertype = DropDownList1.SelectedValue; usersdata.userclass = userclass.Text; if (Request.QueryString["id"] != null) { usersdata.Id = Request.QueryString["id"]; users.Modify(usersdata); } else { users.Insert(usersdata); } Response.Redirect("userstb.aspx"); users = null; usersdata = null; }
protected void Button1_Click(object sender, EventArgs e) { if (TextBox2.Text != TextBox3.Text) { lblInfo.InnerHtml = "两次密码不一致!"; } else if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || TextBox4.Text == "") { lblInfo.InnerHtml = "请输入完整信息!"; } else { Business.users users = new Business.users(); Business.usersData usersdata = new Business.usersData(); usersdata.userid = TextBox1.Text; usersdata.userpwrd = TextBox2.Text; usersdata.username = TextBox4.Text; usersdata.usertype = "学生"; usersdata.userclass = "0"; users.Insert(usersdata); Response.Redirect("login.aspx"); users = null; usersdata = null; } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { string Id = e.CommandName; Business.users users = new Business.users(); users.Delete(Id); Repeater1.DataSource = users.Get(""); Repeater1.DataBind(); users = null; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Business.users users = new Business.users(); Repeater1.DataSource = users.Get(""); Repeater1.DataBind(); users = null; } }
protected void Button1_Click(object sender, EventArgs e) { Business.users us = new Business.users(); bool b = us.Login(TextBox1.Text, TextBox2.Text); if (b) { Session["UserId"] = TextBox1.Text; Session["UserName"] = us.UserName; Session["UserType"] = us.UserType; Response.Redirect("userinfo.aspx"); } else { lblInfo.InnerHtml = us.ErrMsg; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.QueryString["id"] != null) { Business.users users = new Business.users(); Business.usersData[] usersdata = users.Select(Request.QueryString["id"]); userid.Text = usersdata[0].userid; userpwrd.Text = usersdata[0].userpwrd; username.Text = usersdata[0].username; DropDownList1.SelectedValue = usersdata[0].usertype; userclass.Text = usersdata[0].userclass; users = null; usersdata = null; } } }
protected void Button1_Click(object sender, EventArgs e) { Business.users us = new Business.users(); bool b = us.Login(TextBox1.Text, TextBox2.Text); if (b) { Session["UserName"] = us.UserName; Session["UserId"] = TextBox1.Text; Session["UserClass"] = us.UserClass; if (us.UserType == "老师") { Response.Redirect("ter/index.html"); } else if (us.UserType == "管理员") { Response.Redirect("admin/index.html"); } } else { lblInfo.InnerHtml = us.ErrMsg; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if ((string)Session["UserId"] != null) { Business.users stu = new Business.users(); Business.usersData[] studata = stu.Put(string.Format(" and userid ='{0}'", (string)Session["UserId"])); Label1.Text = studata[0].userid; Label2.Text = studata[0].userpwrd; Label3.Text = studata[0].username; Label4.Text = studata[0].usertype; stu = null; studata = null; } else { Response.Redirect("login.aspx"); } } }