Esempio n. 1
0
        //修改用户
        private void ModefyBtn_Click(object sender, EventArgs e)
        {
            //判断是否修改了 再保存

            if (modefyUserNameTxt.Enabled)
            {
                if (!userAcount.ModefyUserName(AllUserCombo.Text, modefyUserNameTxt.Text))
                {
                    MessageBox.Show("用户名修改失败!");
                }
            }
            if (modefyPwdTxt.Enabled)
            {
                if (!userAcount.ModefyUserPwd(AllUserCombo.Text, modefyPwdTxt.Text))
                {
                    MessageBox.Show("密码修改失败!");
                }
            }
            if (modefyPrivilegeCombo.Enabled)
            {
                if (!userAcount.ModefyUserPriv(AllUserCombo.Text, Convert.ToInt32(modefyPrivilegeCombo.Text)))
                {
                    MessageBox.Show("用户权限修改失败!");
                }
            }
        }
Esempio n. 2
0
        ////检查是否可以修改密码,即密码正确,且新密码确认一致
        //private bool CanModifyPwd()
        //{
        //    oldpwdTxt.PasswordChar = '*';
        //    .PasswordChar = '*';
        //    .PasswordChar = '*';
        //}

        //保存功能
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            //确认是否执行密码修改
            if (!string.IsNullOrEmpty(oldpwdTxt.Text) && !string.IsNullOrEmpty(newpwdTxt.Text) &&
                !string.IsNullOrEmpty(confirmNewpwdTxt.Text) && newpwdTxt.Text.Trim() == confirmNewpwdTxt.Text.Trim())
            {
                userAcount.ModefyUserPwd(userAcount.UserName, oldpwdTxt.Text.Trim(), newpwdTxt.Text.Trim());
            }
            else
            {
                if (userNameHasChanged)
                {
                    userAcount.ModefyUserName(userAcount.UserName, userNameTxt.Text.Trim());
                }
                else
                {
                    MessageBox.Show("没有要保存的信息!");
                }
            }
        }