public AdministratorUpdateBasicUserPanel( AdministratorUpdateBasicUserPanelVM administratorUpdateBasicUserPanelVM) { InitializeComponent(); // Set basic user information this.basicUser = administratorUpdateBasicUserPanelVM.basicUser; // Fill basic user's labels this.BasicUserNameValueLabel.Text = basicUser._Name._Value; this.BasicUserSurnameValueLabel.Text = basicUser._Surname._Value; this.BasicUserPinValueLabel.Text = basicUser._Pin._Value; this.BasicUserAccountStateValueLabel.Text = basicUser._BankAccount.state._Value.ToString(new CultureInfo("en-US")); // Fill update basic user's text boxes this.NameValueTextBox.Text = basicUser._Name._Value; this.SurnameValueTextBox.Text = basicUser._Surname._Value; this.PinValueTextBox.Text = basicUser._Pin._Value; this.AccountStateValueTextBox.Text = basicUser._BankAccount.state._Value.ToString(new CultureInfo("en-US")); // Hide error label this.ErrorLabel.Visible = false; }
private void RemoveBasicUserButton_Click(object sender, System.EventArgs e) { AdministratorRemoveBasicUserPanelVM administratorRemoveBasicUserPanelVM = new AdministratorRemoveBasicUserPanelVM { basicUserToRemove = this.selectedBasicUsersDataGridViewRow }; // Redirect to remove basic user panel AdministratorRemoveBasicUserPanel administratorRemoveBasicUserPanel = new AdministratorRemoveBasicUserPanel(administratorRemoveBasicUserPanelVM); administratorRemoveBasicUserPanel.ShowDialog(); // Get checked basic user DataGridViewRow basicUsersDataGridViewRow = this.BasicUsersDataGridView.CurrentRow; // Redirect to change basic user panel AdministratorUpdateBasicUserPanelVM administratorUpdateBasicUserPanelVM = new AdministratorUpdateBasicUserPanelVM { basicUser = this.selectedBasicUsersDataGridViewRow }; // Update grid view information try { // Connect with database MockBasicUsersRepository mockBasicUsersRepository = new MockBasicUsersRepository(SystemSettings._PlatformType); // Get basic users var basicUsersDataGridViewModels = mockBasicUsersRepository.GetAll().Select((singleBasicUser) => { return(new BasicUsersDataGridViewModel { BasicUserId = singleBasicUser._Id, accountState = singleBasicUser._BankAccount.state._Value, pin = singleBasicUser._Pin._Value, name = singleBasicUser._Name._Value, surname = singleBasicUser._Surname._Value }); }).ToList(); this.BasicUsersDataGridView.DataSource = basicUsersDataGridViewModels; } catch (MockBasicUsersRepository_Exception mbur_e) { } }