Exemplo n.º 1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        string name = txtName.Text.Trim();

        string password = txtPassword.Text.Trim();

        ManagerUserAct act = new ManagerUserAct();
        if (act.GetByName(name) != null)
        {
            MessageBox("该账户名称已经存在!");
            return;
        }
        try
        {
            if (Request.QueryString["id"] != null)
            {
                ManagerUser user = act.GetByid(Request.QueryString["id"]);
                user.UserName = name;
                user.Password = password;
                act.Edit(user);
                RunScript("alert('修改成功!');window.opener.history.go(0);");
            }
            else
            {
                act.Add(name, password,(int)ManagerRole.普通管理员  );
                RunScript("alert('添加成功!');window.opener.history.go(0);");
            }

        }
        catch (Exception ex)
        {

            MessageBox(ex.Message);
        }
    }
Exemplo n.º 2
0
    protected void BTsubmit_Click(object sender, EventArgs e)
    {
        if (txtUsername.Text.Trim().Length == 0)
        {
            MessageBox("请输入用户名!");
            return;

        }

        if (txtPassword.Text.Length == 0)
        {
            MessageBox("请输入密码!");
        }
        string username=txtUsername .Text .Trim ();
        string password=txtPassword .Text;
        ManagerUserAct act = new ManagerUserAct();
        ManagerUser user=new ManagerUser ();
        if (act.Login(username, password,ref user))
        {
            HttpContext.Current.Session["mangerid"] = user.Id;
            if(user.RoleId ==(int)ManagerRole .超级管理员 )
               Response.Redirect("Page/Frameset/frame.htm");
            else
            {
                Response.Redirect("Page/Frameset/frame2.htm");
            }
        }
        else
        {
            MessageBox("用户名或密码错误!");
        }
    }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ManagerUserAct userAct = new ManagerUserAct();
         Ruserlist.DataSource = userAct.GetAll();
         Ruserlist.DataBind();
     }
 }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["id"] != null)
            {

                ManagerUserAct act = new ManagerUserAct();
                ManagerUser user = act.GetByid(Request.QueryString["id"]);
                txtName.Text = user.UserName;
                txtPassword.Text = user.Password;
            }
        }
    }