Example #1
0
File: Form1.cs Project: Neehols/ATM
 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();
     }
 }
Example #2
0
File: Form1.cs Project: Neehols/ATM
 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();
     }
 }
Example #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();
            }
        }
Example #4
0
File: Form1.cs Project: Neehols/ATM
        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();
        }