Exemplo n.º 1
0
        private void continue_btn_Click(object sender, EventArgs e)
        {
            user.regularAccount.Balance = Convert.ToInt32(deposit_value.Text);
            Shopping_screen form = new Shopping_screen(user);

            this.Hide();
            form.ShowDialog();
            this.Close();
            this.Dispose();
        }
Exemplo n.º 2
0
        private void startShopping_btn_Click(object sender, EventArgs e)
        {
            int  deposit;
            int  name;
            bool isDepositValid  = int.TryParse(deposit_value.Text, out deposit);
            bool isUsernameValid = int.TryParse(username_value.Text, out name);


            if (username_value.Text == "" || isUsernameValid)
            {
                displayError(true, "Incorrect username");
            }
            else if (!isDepositValid)
            {
                displayError(true, "enter valid deposit");
            }
            else
            {
                displayError(false, "");

                UserModel user = new UserModel()
                {
                    userName       = username_value.Text,
                    regularAccount = new AccountModel
                    {
                        Balance = Convert.ToInt32(deposit_value.Text)
                    }
                };


                Shopping_screen form = new Shopping_screen(user);


                this.Hide();
                form.ShowDialog();
                this.Close();
                this.Dispose();
            }
        }