//修改密码
        private void button_save_Click(object sender, EventArgs e)
        {
            if (txtOldPwd.Text.Trim() != AdminHelper.pass)
            {
                MessageBox.Show("原始密码错误!", "错误提示");
                txtOldPwd.Focus();
                return;
            }
            if (txtNewPwd.Text.Trim() == "")
            {
                MessageBox.Show("新密码不能为空,请输入", "错误提示");
                txtNewPwd.Focus();
                return;
            }
            if (txtNewPwdAgain.Text.Trim() != txtNewPwd.Text.Trim())
            {
                MessageBox.Show("俩次输入的密码不一致,请重新输入!", "错误提示");
                txtNewPwdAgain.Focus();
                return;
            }
            Model.Admin model = new Model.Admin();
            model.Name = AdminHelper.name;
            model.Pass = txtNewPwd.Text.Trim();//新密码
            BLL.Admin bll = new BLL.Admin();

            if (bll.Update(model))
            {
                AdminHelper.pass = model.Pass;
                MessageBox.Show("密码更新成功!");
            }
            else
            {
                MessageBox.Show("密码修改失败!", "错误");
            }
        }
Ejemplo n.º 2
0
 private void btAdminConfirm_Click(object sender, EventArgs e)
 {
     if (tbAdminID.Text.Trim() == "" || tbAdminProPasswd.Text.Trim() == "" || (tbAdminName.Text.Trim() == "" & tbAdminNewPasswd.Text.Trim() == ""))
     {
         MessageBox.Show("输入信息不完整!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         Maticsoft.BLL.Admin adm = new BLL.Admin();
         string string1          = string.Format("userID = '{0}' and passwd = '{1}'", tbAdminID.Text.Trim(), tbAdminProPasswd.Text.Trim());
         if (adm.GetRecordCount(string1) == 1)
         {
             Model.Admin adminmodel = new Model.Admin();
             adminmodel.userID   = tbAdminID.Text.Trim();
             adminmodel.userName = tbAdminName.Text.Trim();
             adminmodel.passwd   = tbAdminNewPasswd.Text.Trim();
             if (adm.Update(adminmodel) == true)
             {
                 MessageBox.Show("修改成功!");
                 ((Main_Admin)this.Owner).dgvAdmin_Load();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("修改失败!");
             }
         }
         else
         {
             MessageBox.Show("身份验证错误!", "修改出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
Ejemplo n.º 3
0
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                int    id       = int.Parse(Request.QueryString["id"]);
                string username = txtUserName.Text.Trim();
                var    model    = bllAdmin.GetModel(p => p.ID != id && p.UserName.Equals(username));
                if (model != null)
                {
                    PageFunc.AjaxAlert(this.Page, "用户名已存在!");
                    return;
                }



                modelAdmin = bllAdmin.GetModel(int.Parse(Request.QueryString["id"]));

                modelAdmin.UserName = username;
                if (txtPwd.Text != "重新设置密码")
                {
                    modelAdmin.UserPwd = PageFunc.Encrypt(txtPwd.Text, 1);
                }
                modelAdmin.Enabled  = chbIsEnabled.Checked;
                modelAdmin.UserType = ddlUserType.SelectedValue;

                modelAdmin.Remark    = txtRemark.Text.Trim();
                modelAdmin.TbAccount = ddlAccount.SelectedValue;

                bllAdmin.Update(modelAdmin);
                Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "AdminList.aspx"));
            }
        }
Ejemplo n.º 4
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            var loginModel = Session[sessionAdminModel] as Model.AdminInfo;

            modelAdmin         = bllAdmin.GetModel(loginModel.ID);
            modelAdmin.UserPwd = PageFunc.Encrypt(txtPwd.Text, 1);

            bllAdmin.Update(modelAdmin);
            Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "ChangePwd.aspx"));
        }
Ejemplo n.º 5
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            string strPower = getPowerString();

            if (strPower != "super" && !IsAllowDelete(Request.QueryString["id"].ToString()))
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('必须存在一个超级管理员');", true);
            }
            else
            {
                model           = blladmin.GetModel(Convert.ToInt32(Request.QueryString["id"]));
                model.dbo_Power = strPower;
                blladmin.Update(model);
                Response.Redirect("adminList.aspx");
            }
        }
Ejemplo n.º 6
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string strUserName  = this.txtUserName.Text;
            string strPassword1 = this.txtPassword1.Text;
            string strPassword2 = this.txtPassword2.Text;

            if (strUserName != "" && strPassword1 != "" && strPassword1 == strPassword2)
            {
                if (editUserId == 0) //如果editId==0则为添加
                {
                    strPassword1 = sys.Encrypt(strPassword1);
                    int retval = blladmin.adminAdd(new Model.Admin {
                        dbo_UserName = strUserName, dbo_PassWord = strPassword1
                    });
                    if (retval == 0)
                    {
                        this.lblMessage.Text = "用户已经存在,请重新输入!";
                    }
                    else
                    {
                        //dal.dalObject.updateOneField("admin", "power", sys.getAdminPages(), "id=" + retval);
                        Response.Redirect("adminList.aspx");
                    }
                }
                else
                {
                    modeladmin = blladmin.GetModel(Convert.ToInt32(editUserId));
                    modeladmin.dbo_PassWord = sys.Encrypt(strPassword1);
                    blladmin.Update(modeladmin);
                    this.lblMessage.Text = "密码修改成功!";
                }
            }
            else
            {
                this.lblMessage.Text = "输入错误,请重新输入!";
            }
        }
Ejemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string json = "{'info':'增加数据失败'}";
            //获取动作的类型
            string action = context.Request.Form["Action"];

            if (action == "add")
            {
                //获取GET方法传递参数:Request.QueryString["参数名称"];
                //获取POST方法传递参数:Request.Form["参数名称"];
                string uid          = context.Request.Form["UserID"];
                string txtUserName  = context.Request.Form["Name"]; //保存文本框对象,提高效率
                string txtPassWord  = context.Request.Form["pwd"];
                string txtemail     = context.Request.Form["email"];
                string adminSex     = context.Request.Form["sex"];
                string txtbirthday  = context.Request.Form["birthday"];
                string txtstatement = context.Request.Form["Statement"];
                string ustate       = context.Request.Form["Ustate"];
                string uclass       = context.Request.Form["uclass"]; //等级
                string upoint       = context.Request.Form["upoint"]; //积分

                Model.Admin model = new Model.Admin();
                model.Uid       = int.Parse(uid);
                model.Uname     = txtUserName; //用户姓名
                model.UPassword = txtPassWord; //用户密码
                model.UEmail    = txtemail;    //用户邮箱
                model.UState    = int.Parse(ustate);
                //用户生日
                string y = txtbirthday.Substring(0, 4);
                string m = txtbirthday.Substring(4, 2);
                string d = txtbirthday.Substring(6, 2);
                txtbirthday     = y + "-" + m + "-" + d;
                model.UBirthday = txtbirthday;   //用户生日

                model.UStatement = txtstatement; //用户描述
                model.URegDate   = DateTime.Now; //用户注册时间
                model.Usex       = false;        //用户性别
                if (adminSex == "true")
                {
                    model.Usex = true;
                }
                model.UClass = int.Parse(uclass);
                model.UPoint = int.Parse(upoint);

                BLL.Admin bll = new BLL.Admin();
                bool      n   = bll.Update(model);
                //返回单个文字信息
                if (n == true)
                {
                    json = "{'info':'增加数据成功,编号是:" + n + "'}";
                }
            }
            //else if (action == "Load")
            //{
            //    if (context.Session["ID"] == null)
            //    {
            //        json = "{'info':'no'}";
            //    }
            //    else
            //        json = "{'info':'yes'}";

            //}
            context.Response.Write(json);
        }