private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            UserInfo user        = userInfoController.GetUserByName(SessionInfo.LoginName);
            string   prePassword = txtPrePassword.Password.Trim();
            string   password    = txtPassword.Password.Trim();
            string   passwordTwo = txtPasswordTwo.Password.Trim();

            if (password == string.Empty)
            {
                MessageBox.Show("密码不能为空!", "系统提示");
                return;
            }
            if (prePassword != user.LoginPassWord)
            {
                MessageBox.Show("旧密码输入错误。", "系统提示");
                return;
            }

            if (password != passwordTwo)
            {
                MessageBox.Show("确认密码错误。", "系统提示");
                return;
            }
            user.LoginPassWord = password;
            user.UpdateTime    = DateTime.Now;
            string message;

            userInfoController.Update(user, out message);
            LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "修改密码 " + message, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
            MessageBox.Show(message, "系统提示");
            this.Close();
        }
Beispiel #2
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            string      message;
            DataRowView rowView = (DataRowView)dgUsers.SelectedItem;
            UserInfo    user    = usersList.FirstOrDefault(P => P.UserID == (Guid)rowView["UserID"]);

            user.LoginPassWord = rowView["LoginPassWord"].ToString();
            if (user.LoginPassWord == string.Empty)
            {
                MessageBox.Show("密码不允许为空!", "系统提示");
                return;
            }
            user.RoleName   = ((ComboBox)dgUsers.Columns[3].GetCellContent(rowView)).SelectedValue.ToString();
            user.UpdateTime = DateTime.Now;
            userInfoController.Update(user, out message);
            LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "修改用户 " + message, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
            MessageBox.Show(message, "系统提示");
        }