Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (lblError.Text != string.Empty)
            {
                lblError.Text = string.Empty;
            }

            if (Convert.ToInt64(getIDNumberInput()) == IDNum)
            {
                isDeleteAll = true;
                int counter = dataGridViewRows().Count;

                foreach (var index in dataGridViewRows().ToList())
                {
                    AccountVaultEntity listItem = gridList.FirstOrDefault(x => x.Id == index);
                    if (listItem != null)
                    {
                        gridList.Remove(listItem);
                    }
                }

                this.iApplicationAccount.deleteAllAccounts();
                frmMainPMSVaultForm_Load(null, null);
            }
            else
            {
                text = "The ID Number you have entered does not \n match with the one stored on record.";
                Utility.showLabel(lblError, text, Color.Red);
            }
        }
Пример #2
0
        public List <AccountVaultEntity> decipheredListOfVaultAccounts(PMS_DBEntities db)
        {
            byte[] decryptedDBData = new byte[] { };
            List <AccountsVault>      listOfDBAccountsVault = db.AccountsVaults.ToList();
            List <AccountVaultEntity> decryptedData         = new List <AccountVaultEntity>();
            List <int> IDs = new List <int>();

            foreach (AccountsVault index in listOfDBAccountsVault)
            {
                byte[] encryptedDBData = index.Application;
                Utility.encryptedAccountVaultArray = encryptedDBData;
                int recID = index.Id;

                if (listOfDBAccountsVault.Count > 1)
                {
                    Utility.accountVaultID = index.Id;
                    IDs.Add(Utility.accountVaultID);
                }
                else
                {
                    Utility.accountVaultID = index.Id;
                }


                decryptedDBData = cryptoObj.decrypt(encryptedDBData, Utility.storedApplicationPrivateKey);

                string   strResult = Utility.stringManipulation(decryptedDBData);
                string[] stringArr = strResult.Split(new string[] { "  " },
                                                     StringSplitOptions.None);
                string[] cleanStrArray = stringArr.Where(x => !string.IsNullOrEmpty(x)).ToArray();

                if (cleanStrArray != null && cleanStrArray.Count() > 0)
                {
                    if (Utility.allFieldsEntered == true)
                    {
                        AccountVaultEntity accountVaultObj = new AccountVaultEntity();
                        accountVaultObj.Id = recID;
                        accountVaultObj.applicationName = cleanStrArray[0];
                        accountVaultObj.username        = cleanStrArray[1].TrimStart();
                        accountVaultObj.password        = cleanStrArray[2].TrimStart();
                        accountVaultObj.applicationUrl  = cleanStrArray[3];
                        accountVaultObj.notes           = cleanStrArray[4];

                        decryptedData.Add(accountVaultObj);
                    }
                }
                else
                {
                    Utility.getText = "Something went wrong \n with the decryption!";
                }
            }

            Utility.listOfIDs = IDs;

            return(decryptedData);
        }
Пример #3
0
        private void btnRefreshData_Click(object sender, EventArgs e)
        {
            lblError.Text     = string.Empty;
            Utility.isRefresh = true;
            foreach (var index in dataGridViewRows().ToList())
            {
                AccountVaultEntity listItem = gridList.FirstOrDefault(x => x.Id == index);
                if (listItem != null)
                {
                    gridList.Remove(listItem);
                }
            }

            populateGrid();
        }
Пример #4
0
        private void btnUpdateSelected_Click(object sender, EventArgs e)
        {
            AccountVaultEntity itemToEdit = new AccountVaultEntity();

            if (gridRow != 0)
            {
                itemToEdit = gridList.FirstOrDefault(x => x.Id == gridRow);
                if (itemToEdit != null)
                {
                    Utility.updateRec = itemToEdit;
                }

                frmUpdateAppVaultAccount updateForm = new frmUpdateAppVaultAccount(new ApplicationAccounts());
                updateForm.Show();
            }
        }
Пример #5
0
        private void frmUpdateForm_Load(object sender, EventArgs e)
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MinimizeBox     = true;
            this.MaximizeBox     = false;
            this.HelpButton      = true;
            this.AutoSize        = true;

            AccountVaultEntity updateRec = Utility.updateRec;

            if (updateRec != null)
            {
                txtApplicationUpdate.Text    = updateRec.applicationName;
                txtUsernameUpdate.Text       = updateRec.username;
                txtPasswordUpdate.Text       = updateRec.password;
                txtNotesUpdate.Text          = updateRec.notes;
                txtApplicationUrlUpdate.Text = updateRec.applicationUrl;
            }
        }