Advertisement
Braber01

Untitled

Feb 8th, 2017
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.49 KB | None | 0 0
  1. //Ben Raber
  2. //simulates an Atm part 1
  3. //Created 2-1-2017
  4.  
  5.  
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15.  
  16. namespace Raber_assignment3 {
  17.     public partial class Form1 : Form {
  18.  
  19.         /*
  20.          * Program specifications (business requirements):  Customer bank account
  21.          * Create a Windows application that shows a customer account information.
  22.          * This will be the Windows stub for the next couple of programming assignments.
  23.          * Remember to think about the programming process when developing your solution:
  24.          * INPUT
  25.          * PROCESS/LOGIC/COMPUTATION/ALGORITHM
  26.          * OUTPUT
  27.          * Program requirements:
  28.          * The Show Balance button should display a message box with an
  29.          * Information icon, message box title “Customer Balance” and the OK button with the following message:
  30.          * “Customer <<value from text box>> has $500 in the <<account combo value>> “.
  31.          *  The hard coded dollar value in the message box will remain the same.
  32.          *  The Welcome, Deposit, Withdrawal and Print Payment buttons should display the appropriate message
  33.          *  based on these buttons design constraints below.
  34.          *  The program should populate the accounts combo box with the following values of
  35.          *  Checking, Savings, Money Market, Certificate of Deposit showing the default value of
  36.          *  “---Select an Account Type—“.
  37.          *  The program should check to see if an account has been selected from the accounts dropdown list
  38.          *  before attempting to show the customer balance info via the Show Balance button. If no account has been selected, the following error message “No account selected. Please select an account” should be displayed in a Message Box with the error icon, message box title “Error” and the OK button.
  39.          *  The Clear button clears all UI fields and resets the accounts combo box to the first item in the combo box.
  40.          *  The Exit button closes the application.
  41.  
  42.  
  43.  
  44.  
  45.  
  46. */
  47.         public Form1() {
  48.             InitializeComponent();
  49.  
  50.         }
  51.  
  52.         private void PopulateCombo() {
  53.             cboAccount.Items.Add("--Select an Account Type--");
  54.             cboAccount.Items.Add("Checking");
  55.             cboAccount.Items.Add("Savings");
  56.             cboAccount.Items.Add("Money Market");
  57.             cboAccount.Items.Add("Certificate of Deposit");
  58.         }
  59.  
  60.  
  61.         private void ClearUI() {
  62.             cboAccount.SelectedIndex = 0;
  63.             txtDeposit.Clear();
  64.             txtFisrtName.Clear();
  65.             txtLastName.Clear();
  66.             txtWithdrawl.Clear();
  67.         }
  68.  
  69.         private void MethodNotImplementedException() {
  70.             throw new NotImplementedException();
  71.         }
  72.         private void Form1_Load(object sender, EventArgs e) {
  73.             PopulateCombo();
  74.         }
  75.  
  76.         private void btnWelcome_Click(object sender, EventArgs e) {
  77.             try {
  78.                 MethodNotImplementedException();
  79.             }catch(NotImplementedException ex) {
  80.                 MessageBox.Show("Implementation is Pending", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information);
  81.             }
  82.  
  83.         }
  84.  
  85.         private void btnDeposit_Click(object sender, EventArgs e) {
  86.             try {
  87.                 MethodNotImplementedException();
  88.             } catch (NotImplementedException ex) {
  89.                 MessageBox.Show("Implementation is Pending", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information);
  90.             }
  91.         }
  92.  
  93.         private void btnWithdrawl_Click(object sender, EventArgs e) {
  94.             try {
  95.                 MethodNotImplementedException();
  96.             } catch (NotImplementedException ex) {
  97.                 MessageBox.Show("Implementation is Pending", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information);
  98.             }
  99.         }
  100.  
  101.  
  102.  
  103.         private void btnBalance_Click(object sender, EventArgs e) {
  104.             //bool allValidationPassed = false;
  105.  
  106.  
  107.  
  108.  
  109.             if (cboAccount.SelectedIndex == 0) {
  110.                 MessageBox.Show("Please Select an Account type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  111.                 return;
  112.             }
  113.  
  114.  
  115.  
  116.             if (mtxtAccountNumber.Text == String.Empty) {
  117.                 MessageBox.Show("Account number is Blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  118.                 return;
  119.             }
  120.             if (txtFisrtName.Text == String.Empty) {
  121.                 MessageBox.Show("Customer name is blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  122.                 return;
  123.             }
  124.  
  125.             MessageBox.Show($"{txtFisrtName.Text} {txtLastName.Text} has $500 in {cboAccount.SelectedItem.ToString()}");
  126.            
  127.         }
  128.  
  129.         private void btnPrintStatement_Click(object sender, EventArgs e) {
  130.             try {
  131.                 MethodNotImplementedException();
  132.             } catch (NotImplementedException ex) {
  133.                 MessageBox.Show("Implementation is Pending", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information);
  134.             }
  135.         }
  136.  
  137.         private void btnExit_Click(object sender, EventArgs e) {
  138.             this.Close();
  139.             Application.Exit();
  140.         }
  141.  
  142.         private void btnClear_Click(object sender, EventArgs e) {
  143.             ClearUI();
  144.         }
  145.     }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement