コード例 #1
0
        private void login_button_Click(object sender, EventArgs e)
        {
            User currentUser = FileManagement.GetUser(Constants.Links.UsersFilePath, cardNumberTextBox.Text, pinTextBox.Text);

            if (!(currentUser is null))
            {
                var atmForm = new ATM(currentUser);
                atmForm.Show();
                this.Dispose(false);
            }
コード例 #2
0
ファイル: ATM.cs プロジェクト: karol-bekieszczuk/ATMSimulator
 private void depositButton_Click(object sender, EventArgs e)
 {
     if (Security.CheckTextboxOnlyNumbers(depositTextBox))
     {
         currentUser.BalanceDeposit(float.Parse(depositTextBox.Text));
         if (FileManagement.UpdateUsersDataFile(Constants.Links.UsersFilePath, currentUser, float.Parse(depositTextBox.Text)))
         {
             SetEditableTextBoxesToZero();
             SetNotifyLabel("Money deposited", Color.Green);
             UpdateCurrentUserBalance();
         }
         else
         {
             SetNotifyLabel(Constants.Errors.FileError, Color.Red);
         }
     }
 }
コード例 #3
0
ファイル: ATM.cs プロジェクト: karol-bekieszczuk/ATMSimulator
 private void withdrawButton_Click(object sender, EventArgs e)
 {
     if (Security.CheckTextboxOnlyNumbers(withdrawTextBox))
     {
         if (currentUser.BalanceWithdraw(float.Parse(withdrawTextBox.Text)))
         {
             if (FileManagement.UpdateUsersDataFile(Constants.Links.UsersFilePath, currentUser,
                                                    currentUser.getBalance() - float.Parse(withdrawTextBox.Text)))
             {
                 SetNotifyLabel("Money withdrawed", Color.Green);
                 UpdateCurrentUserBalance();
             }
             else
             {
                 SetNotifyLabel(Constants.Errors.FileError, Color.Red);
             }
         }
         else
         {
             SetNotifyLabel("Cant withdraw, not enough funds", Color.Red);
         }
     }
     SetEditableTextBoxesToZero();
 }