public void initWith(Person p, float amount, int accntFrom, int accntTo)
        {
            user = p;
            transferAmount = amount;
            accountFrom = accntFrom;
            accountTo = accntTo;

            try
            {
                p.transferBetween(amount, accntFrom, accntTo);

                this.lbl_msg.Text = String.Format("You are about to transfer ${0} from your {1} account to your {2} account.",
                                            transferAmount.ToString("0.00"),
                                            user.Accounts[accntFrom].Type,
                                            user.Accounts[accntTo].Type);

                isErr = false;

            } catch (Exception e)
            {
                this.lbl_msg.Text = String.Format("You are unable to transfer ${0} from your {1} account to your {2} account because {3}.",
                                            transferAmount.ToString("0.00"),
                                            user.Accounts[accntFrom].Type,
                                            user.Accounts[accntTo].Type,
                                            e.Message);
                isErr = true;
            }

            this.btn_confirm.Enabled = !isErr;
            this.chk_receipt.Enabled = !isErr;
            this.lbl_err.Visible = isErr;
            this.Show();
        }
        public void initWith(Person p, int amount, int accntFrom)
        {
            user = p;
            withdrawlAmount = amount;
            accountFrom = accntFrom;

            try
            {
                bool evenBills = Util.countBills(withdrawlAmount, ref n20, ref n50);
                if (!evenBills)
                { throw new Exception("the machine can only dispense $20 and $50 bills");  }

                p.withdrawFrom(amount,accntFrom,"TestDate");
                this.lbl_msg.Text = String.Format("You are about to withdraw ${0}.00 from your {1} account.",
                                            withdrawlAmount,
                                            user.Accounts[accntFrom].Type);
                this.btn_confirm.Enabled = true;
                this.chk_receipt.Enabled = true;
                this.lbl_err.Visible = false;
            } catch (Exception e)
            {
                this.lbl_msg.Text = String.Format("You are unable to withdraw ${0}.00 from your {1} account because {2}.",
                                            withdrawlAmount,
                                            user.Accounts[accntFrom].Type,
                                            e.Message);
                this.btn_confirm.Enabled = false;
                this.chk_receipt.Enabled = false;
                this.lbl_err.Visible = true;
            }

            this.Show();
        }
        public void initDefault()
        {
            var a0 = new Account(2345234, AccountType.Chequings);
            a0.deposit(400.00f, "June 8th 2015");

            var a1 = new Account(9954, AccountType.Savings);
            a1.deposit(63.32f, "July 4th 2015");

            var p0 = new Person("Yuriy", 0, "0");
            p0.addAccount(a0); p0.addAccount(a1);
            People.Add(p0);
        }
Exemple #4
0
 public void initWith(Person p)
 {
     if (p != null)
     {
         user = p;
         this.lbl_welcome.Text = String.Format("Welcome {0}", p.Name);
         this.Show();
     }
     else
     {
         throw new Exception("Got to main menu without actually logging in...");
     }
 }
        public void initDefault()
        {
            var a0 = new Account(2345234, AccountType.Chequings);
            a0.deposit(400.00f, DateTime.Parse("June 8 2015"));
            a0.withdraw(20f, DateTime.Parse("June 12 2015"));

            var a1 = new Account(9954, AccountType.Savings);
            a1.deposit(63.32f, DateTime.Parse("July 4 2015"));
            a1.deposit(600.00f, DateTime.Parse("Oct 9 2015"));

            var p0 = new Person("Yuriy", "1234", "5678");
            p0.addAccount(a0); p0.addAccount(a1);
            People.Add(p0);
        }
 public void addPerson(Person a)
 {
     People.Add(a);
 }
Exemple #7
0
 private bool try_lookup_accnt_num(string str)
 {
     int i;
     // Try to parse input number
     if (!Int32.TryParse(str, out i))
     {
         return false;
     }
     // Try to find that person
     whosTryingToLogIn = Program.db.lookupAccntNum(i);
     return (whosTryingToLogIn != null);
 }
Exemple #8
0
 private void trans_mainSplash()
 {
     this.main_accnt_num.Location = new System.Drawing.Point(191, 456);
     this.main_landing.Visible = true;
     this.main_enter_accnt.Visible = false;
     //this.main_errorLabel.Visible = false;
     //this.pinAttempt = "";
     this.mainLabel.Text = "Enter your account:";
     if (whosTryingToLogIn != null)
     {
         main_accnt_num.Text = "";
         this.main_accnt_num.PasswordChar = (char)0;
     }
     this.whosTryingToLogIn = null;
 }
Exemple #9
0
 private void trans_enterAccntNum()
 {
     // Position the account number box in the middle and show the number pad
     this.main_accnt_num.Location = new System.Drawing.Point(191, 185);
     this.main_landing.Visible = false;
     this.main_enter_accnt.Visible = true;
     this.main_errorLabel.Visible = false;
     //this.pinAttempt = "";
     this.whosTryingToLogIn = null;
 }
Exemple #10
0
 private void btn_quit_Click(object sender, EventArgs e)
 {
     this.user = null;
     this.Hide();
     Program.mainScreen.init();
 }
Exemple #11
0
 public void initWith(Person p)
 {
     user = p;
     init();
 }
Exemple #12
0
 public void initWith(Person p)
 {
     person = p;
     init();
 }
Exemple #13
0
 private bool try_lookup_accnt_num(string str)
 {
     // Try to find that person
     whosTryingToLogIn = Program.db.lookupAccntNum(str);
     return (whosTryingToLogIn != null);
 }