Exemple #1
0
        private void EditUserButton_Click(object sender, System.EventArgs e)
        {
            var selectedUser = (User)this.userBindingSource.Current;

            if (selectedUser == null)
            {
                MessageBox.Show("Не е избран потребител за редакция!");
                return;
            }

            var editForm = new UserAddEditForm(selectedUser);

            editForm.ShowDialog();

            if (editForm.DialogResult == DialogResult.OK)
            {
                var user = editForm.User;

                if (user != null)
                {
                    this.userRepository.AddOrUpdateUser(user);
                    this.RefreshUsers();
                }
            }
        }
Exemple #2
0
        private void AddUserButton_Click(object sender, System.EventArgs e)
        {
            var editForm = new UserAddEditForm(null);

            editForm.ShowDialog();

            if (editForm.DialogResult == DialogResult.OK)
            {
                var user = editForm.User;

                if (user != null)
                {
                    this.userRepository.AddOrUpdateUser(user);
                    this.RefreshUsers();
                }
            }
        }