Esempio n. 1
0
        private void btnNewCredential_Click(object sender, EventArgs e)
        {
            bool hasTheSaveButtonPressed;

            Credential credential = new Credential();

            frmAddOrUpdateCredential _frmAddOrUpdateCredential = new frmAddOrUpdateCredential(credential);

            _frmAddOrUpdateCredential.TopMost       = true;
            _frmAddOrUpdateCredential.StartPosition = FormStartPosition.CenterParent;
            _frmAddOrUpdateCredential.ShowDialog();

            hasTheSaveButtonPressed = _frmAddOrUpdateCredential.hasTheSaveButtonPressed;

            if (hasTheSaveButtonPressed == true)
            {
                Validation.LocalDatabaseConfig(true);
                //databaseViewModel = Services.GetDataFromDatabase();
                credentialList = loadCredentials();
            }

            dgvCredentials.ClearSelection();
            txtSearchCredential.Clear();
            btnEditCredential.Enabled   = false;
            btnDeleteCredential.Enabled = false;

            _frmAddOrUpdateCredential.Dispose();
        }
Esempio n. 2
0
        private void btnEditCredential_Click(object sender, EventArgs e)
        {
            if ((dgvCredentials.Rows.Count > 0))
            {
                Credential credential = new Credential();
                bool       hasTheSaveButtonPressed;

                credential.CredentialId          = Convert.ToInt32(dgvCredentials.CurrentRow.Cells[0].Value.ToString());
                credential.CredentialDescription = dgvCredentials.CurrentRow.Cells[1].Value.ToString();
                credential.Username = dgvCredentials.CurrentRow.Cells[2].Value.ToString();
                credential.Password = dgvCredentials.CurrentRow.Cells[3].Value.ToString();

                frmAddOrUpdateCredential _frmAddOrUpdateCredential = new frmAddOrUpdateCredential(credential);
                this.TopMost = false;
                _frmAddOrUpdateCredential.StartPosition = FormStartPosition.CenterParent;
                _frmAddOrUpdateCredential.ShowDialog();

                hasTheSaveButtonPressed = _frmAddOrUpdateCredential.hasTheSaveButtonPressed;

                if (hasTheSaveButtonPressed == true)
                {
                    Validation.LocalDatabaseConfig(true);
                    //databaseViewModel = Services.GetDataFromDatabase();
                    credentialList = loadCredentials();
                }

                dgvCredentials.ClearSelection();
                txtSearchCredential.Clear();
                btnEditCredential.Enabled   = false;
                btnDeleteCredential.Enabled = false;

                _frmAddOrUpdateCredential.Dispose();
            }
        }