Exemple #1
0
 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName.Equals("czmm"))
     {
         int           UserID = Convert.ToInt32(e.CommandArgument);
         User_Managers user   = bll.GetModel(UserID);
         user.Password = DESEncrypt.EncryptDES("123456");
         if (bll.Update(user))
         {
             redatabind();
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsg('重置密码','重置密码成功!','',1)</script>");
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsg('重置密码','重置密码失败!','',2)</script>");
         }
     }
 }
Exemple #2
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            User_Managers user = null;

            if (Request.QueryString["UserID"] != null)
            {
                user = bll.GetModel(Convert.ToInt32(Request.QueryString["UserID"]));
            }
            else
            {
                user            = new User_Managers();
                user.CreateDate = DateTime.Now;
                user.Password   = DESEncrypt.EncryptDES("123456");
            }
            user.UserName = txtUserName.Text.Trim();
            user.RealName = txtRealName.Text.Trim();
            user.Email    = txtEmail.Text;
            user.RoleId   = Convert.ToInt32(ddlRole.SelectedValue);
            if (user.UserId == 0)
            {
                if (bll.Add(user) > 0)
                {
                    webHelper.addLog("新添加了用户“" + user.UserName + "”");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('新增用户','保存成功!','',1)</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('新增用户','保存失败','',2)</script>");
                }
            }
            else
            {
                if (bll.Update(user))
                {
                    webHelper.addLog("修改了用户“" + user.UserName + "”的个人信息");
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('编辑用户','保存成功!','',1)</script>");
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('编辑用户','保存失败','',2);</script>");
                }
            }
        }