Esempio n. 1
0
        //Saves username and password to the database
        //calls ProcessData method of class DatabaseHandle
        //Procedure prc_add_pwd and sql parameter is passed to ProcessData of class DatabaseHandle
        //password provided by the user is encrypted before saving to database
        //using Encrypt method of StringCipher class
        public void AddPasswordDb()
        {
            string accountName       = txtAccountName.Text.ToString();
            string userName          = txtUsrName.Text.ToString();
            string password          = txtPwd.Password.ToString();
            string encryptedPassword = StringCipher.Encrypt(password, LoginInfo.MasterPwd);
            string notes             = txtNote.Text.ToString();
            var    date = DateTime.Now.ToString("yyyy/MM/dd");

            string commandText = "prc_add_pwd";

            SqlParameter[] param =
            {
                new SqlParameter("@account_name", accountName),
                new SqlParameter("@user_ID",      LoginInfo.UserId),
                new SqlParameter("@username",     userName),
                new SqlParameter("@password",     encryptedPassword),
                new SqlParameter("@notes",        notes),
            };
            DatabaseHandle dbh = new DatabaseHandle();
            DataTable      dt  = new DataTable();

            dt = dbh.ProcessData(commandText, param);
        }
 private void copyEmailButton_Click(object sender, EventArgs e)
 {
     Clipboard.SetText(StringCipher.Decrypt(account.Email, password));
 }