Exemple #1
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (comboBoxUsers.SelectedIndex != -1)
     {
         var id             = ((int[])comboBoxUsers.Tag)[comboBoxUsers.SelectedIndex];
         var user           = usersql.GetSingleUser(id.ToString());
         var EditUserDialog = new EditUserForm(user, sql);
         var result         = EditUserDialog.ShowDialog();
         if (result == DialogResult.OK)
         {
             sql.EditClass(typeof(User), EditUserForm.globalUser);
             if (EditUserForm.globalUser.Password != null)
             {
                 BankDetails.UpdatePin(EditUserForm.globalUser.Password, EditUserForm.globalUser.UserId.ToString());
             }
         }
         if (result == DialogResult.Yes)
         {
             GetUserNames();
             comboBoxUsers.Text          = "";
             comboBoxUsers.SelectedIndex = -1;
         }
         else
         {
             GetUserNames();
         }
         GetDeletedUserNames();
     }
 }
Exemple #2
0
 private void btnRecover_Click(object sender, EventArgs e)
 {
     if (comboBoxDeletedUsers.SelectedIndex != -1)
     {
         BankDetails.ChangeAccountState(((int[])comboBoxDeletedUsers.Tag)[comboBoxDeletedUsers.SelectedIndex].ToString());
         comboBoxDeletedUsers.SelectedIndex = -1;
         GetDeletedUserNames();
         GetUserNames();
     }
 }
Exemple #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            var input = MessageBox.Show("Weet je zeker dat je deze gebruiker wilt blokkeeren?", "Gebruiker blokkeren", MessageBoxButtons.YesNo);

            if (input == DialogResult.Yes)
            {
                BankDetails.ChangeAccountState(globalUser.UserId.ToString());
                this.DialogResult = DialogResult.Yes;
                this.Close();
            }
        }
Exemple #4
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            var AddUserDialog = new AddUserForm(database);

            AddUserDialog.ShowDialog();
            sql.InsertClass(typeof(User), globalUser);
            var userId      = usersql.LastId();
            var bankdetails = new BankDetails()
            {
                BankAccountNumber = GenerateBankNumber(), BankAccountPin = globalUser.Password, BankBalance = 0, UserId = userId
            };

            sql.InsertClass(typeof(BankDetails), bankdetails);
            GetUserNames();
        }