Exemple #1
0
        private void Confirm_click(object sender, RoutedEventArgs e)
        {
            int current1 = this.acc.CheckingTotal;
            int current2 = this.acc.SavingsTotal;

            if (current1 - Int32.Parse(textbox_pin.Text) >= 0 && current2 + Int32.Parse(textbox_pin.Text) <= 5000)
            {
                this.acc.CheckingTotal = current1 - Int32.Parse(textbox_pin.Text);
                this.acc.changeBalance("Withdrawal (Transfer from) of " + textbox_pin.Text + "$CAD", "Checking");
                this.acc.SavingsTotal = current2 + Int32.Parse(textbox_pin.Text);
                this.acc.changeBalance("Deposit (Transfer to) of " + textbox_pin.Text + "$CAD", "Savings");
                Sucess p3 = new Sucess(this.type, this.acc);
                this.NavigationService.Navigate(p3);
            }
            else if (current1 - Int32.Parse(textbox_pin.Text) < 0)
            {
                InsuffFunds p4 = new InsuffFunds(this.type, this.acc);
                this.NavigationService.Navigate(p4);
            }
            else if (current2 + Int32.Parse(textbox_pin.Text) > 5000)
            {
                ExceedLimit p4 = new ExceedLimit(this.type, this.acc);
                this.NavigationService.Navigate(p4);
            }

            else if (Int32.Parse(textbox_pin.Text) > 5000)
            {
                ExceedLimit p2 = new ExceedLimit(this.type, this.acc);
                this.NavigationService.Navigate(p2);
            }
        }
Exemple #2
0
        private void fifty_Click(object sender, RoutedEventArgs e)
        {
            int current1 = this.acc.CheckingTotal;
            int current2 = this.acc.SavingsTotal;

            if (current1 - 50 >= 0 && current2 + 50 <= 5000)
            {
                this.acc.CheckingTotal = current1 - 50;
                this.acc.changeBalance("Withdrawal (Transfer from) of 50 $CAD", "Checking");
                this.acc.SavingsTotal = current2 + 50;
                this.acc.changeBalance("Deposit (Transfer to) of 50 $CAD", "Savings");
                Sucess p3 = new Sucess(this.type, this.acc);
                this.NavigationService.Navigate(p3);
            }
            else if (current1 - 50 < 0)
            {
                InsuffFunds p4 = new InsuffFunds(this.type, this.acc);
                this.NavigationService.Navigate(p4);
            }
            else if (current2 + 50 > 5000)
            {
                ExceedLimit p4 = new ExceedLimit(this.type, this.acc);
                this.NavigationService.Navigate(p4);
            }
        }
        private void Confirm_click(object sender, RoutedEventArgs e)
        {
            if (this.type.Equals("Checking") && this.acc.CheckingTotal + Int32.Parse(textbox_pin.Text) <= 5000)
            {
                int current = this.acc.CheckingTotal;

                this.acc.CheckingTotal = current + Int32.Parse(textbox_pin.Text);
                this.acc.changeBalance("Deposit of " + textbox_pin.Text + " $CAD", this.type);
                Sucess p3 = new Sucess(this.type, this.acc);
                this.NavigationService.Navigate(p3);
            }

            else if (this.type.Equals("Savings") && this.acc.SavingsTotal + Int32.Parse(textbox_pin.Text) <= 5000)
            {
                int current = this.acc.SavingsTotal;

                this.acc.SavingsTotal = current + Int32.Parse(textbox_pin.Text);
                this.acc.changeBalance("Deposit of " + textbox_pin.Text + " $CAD", this.type);
                Sucess p3 = new Sucess(this.type, this.acc);
                this.NavigationService.Navigate(p3);
            }

            else
            {
                ExceedLimit p2 = new ExceedLimit(this.type, this.acc);
                this.NavigationService.Navigate(p2);
            }
        }