Esempio n. 1
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            // Calls and returns DetSelectedCredential method and stores it into returnedCredential
            Credential returnedCredential = GetSelectedCredential();

            // Creates newUpdateForm and passes it returnedCredential and a true parameter
            UpdateForm newUpdateForm = new UpdateForm(returnedCredential, true);

            // Shows newUpdate in a ShowDialog window
            newUpdateForm.ShowDialog();

            // Opens a connection to the database
            connection.Open();

            // Updates the database based on the data in returnedCredential
            connection.Execute("UPDATE Credentials SET Website = @Website, Username = @Username, Password = @Password, Notes = @Notes WHERE CredentialID = @CredentialID", returnedCredential);

            // Assigns the returnedCredential to the credentialDbList's combo box selected index
            credentialDbList[this.selectionComboBox.SelectedIndex] = returnedCredential;

            // Closes the database
            connection.Close();

            // Calls the RefreshCombobox method
            RefreshCombobox();
        }
Esempio n. 2
0
        private void viewButton_Click(object sender, EventArgs e)
        {
            // Creates a newUpdateForm object and passes it the GetSelectedCredential method
            UpdateForm newUpdateForm = new UpdateForm(GetSelectedCredential());

            // Shows newUpdate in a ShowDialog window
            newUpdateForm.ShowDialog();
        }