Пример #1
0
        private void editUserButton_Click(object sender, RoutedEventArgs e)
        {
            Add_User add = new Add_User();

            add.Owner = this;
            editFlag  = true;

            try
            {
                using (UserContext db = new UserContext())
                {
                    add.firstNameTextbox.Text            = db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].FirstName;
                    add.secondNameTextbox.Text           = db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].SecondName;
                    add.middleNameTextbox.Text           = db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].MiddleName;
                    add.phoneNumberTextbox.Text          = db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].PhoneNumber;
                    add.dateOfBirthPicker.SelectedDate   = Convert.ToDateTime(db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].DateOfBirth);
                    add.passportSerialNumberTextbox.Text = db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].PassportSerialNumber;
                    add.emailTextbox.Text       = db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].Email;
                    add.adminCheckbox.IsChecked = db.UserProfiles.ToList()[usersDatagrid.SelectedIndex].Admin;
                }

                add.loginTextbox.IsEnabled   = false;
                add.loginTextbox.BorderBrush = new SolidColorBrush(Colors.Black);
                //add.loginTextbox.BorderThickness;
                add.passwordPasswordbox.IsEnabled = false;

                add.Show();
            }
            catch
            {
                MessageBox.Show("Выберите пользователя");
            }
        }
Пример #2
0
        //////////////////////////////////////////////USERS/////////////////////////////////////////////////


        private void addUserButton_Click(object sender, RoutedEventArgs e)
        {
            Add_User add = new Add_User();

            add.Owner = this;
            add.Show();
        }