AddAdmin.aspx.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. public partial class Admin_AddAdmin : System.Web.UI.Page
  8. {
  9. LYS.UserData1 myud = new LYS.UserData1();
  10. protected void Page_Load(object sender, EventArgs e)
  11. {
  12. Session["UserType"] = "系管理员";
  13. //Session["UserType"] = "超级管理员";
  14. if (Session["UserType"].ToString() == "系管理员")
  15. {
  16. UserType.Items.Add("教师");
  17. UserType.Items.Add("督导员");
  18. }
  19. else if (Session["UserType"].ToString() == "超级管理员")
  20. {
  21. UserType.Items.Add("教师");
  22. UserType.Items.Add("督导员");
  23. UserType.Items.Add("系管理员");
  24. }
  25. else
  26. { Response.Write("<script>alert('你没有是权限添加数据!')</script>"); }
  27. }
  28. protected void Button1_Click(object sender, EventArgs e)
  29. {
  30. myud.AddUsersToDB("select * from Users", "UserS", UserName.Text, PassWord.Text, UserType.SelectedValue, DropDownList1.SelectedValue);
  31. }
  32. }