예제 #1
0
        private void btnModify_Click(object sender, RoutedEventArgs e)
        {
            user_details.Visibility = Visibility.Visible;
            btnSave.Visibility      = Visibility.Visible;
            btnCancel.Visibility    = Visibility.Visible;
            //this._department.IsEnabled = true;
            this._loginName.IsEnabled     = true;
            this._loginPassword.IsEnabled = true;
            this.txtUserName.IsEnabled    = true;
            this._user_manger.IsEnabled   = true;
            this._user_manger_2.IsEnabled = true;
            //this._dept_flag.Text = "(必填)";
            this._role_flag.Text     = "(必填)";
            this._user_flag.Text     = "(必填)";
            this._password_flag.Text = "(必填)";
            this._name_flag.Text     = "(必填)";
            this._manager_flag.Text  = "(必填)";
            string id = (sender as Button).Tag.ToString();

            DataRow dr = operationService.GetClientUserDept(id).Rows[0];

            this.txtUserName.Text = dr["userName"].ToString();
            this._loginName.Text  = dr["userId"].ToString();

            for (int i = 0; i < _department.Items.Count; i++)
            {
                if ((_department.Items[i] as Label).Tag.ToString() == dr["deptId"].ToString())
                {
                    _department.SelectedItem = _department.Items[i];
                    break;
                }
            }

            for (int i = 0; i < _cmbRoleType.Items.Count; i++)
            {
                if ((_cmbRoleType.Items[i] as Label).Tag.ToString() == dr["roleId"].ToString())
                {
                    _cmbRoleType.SelectedItem = _cmbRoleType.Items[i];
                    break;
                }
            }

            this._loginPassword.Password = dr["userPassword"].ToString();
            password_old = dr["userPassword"].ToString();
            if (dr["expired"].ToString() == "1")
            {
                this._user_manger.IsChecked = true;
            }
            else if (dr["expired"].ToString() == "0")
            {
                this._user_manger_2.IsChecked = true;
            }

            this.btnSave.Tag = id;
        }