Exemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            bool isValid = ValidateUsernameAndPassword(UsernameTextField.Text, PasswordField.Password);

            if (isValid)
            {
                LoginService login = new LoginService();
                login.Username = UsernameTextField.Text;
                login.Password = PasswordField.Password;
                AccountResponse response = login.ValidateLogin();
                bool            check    = response.IsValid;
                if (check)
                {
                    UIRemote     remote   = new UIRemote();
                    ViewMainMenu viewMenu = new ViewMainMenu(response);
                    remote.SetCommand(viewMenu);
                    remote.ExecuteCommand();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Account not valid! " + response.Message, "Alert", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Invalid username or password! ", "Alert", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            UIRemote     remote    = new UIRemote();
            ViewMainMenu viewMenu  = new ViewMainMenu(Response);
            ViewOrder    viewOrder = new ViewOrder(Response);
            ViewSales    sales     = new ViewSales(Response);
            ViewLogin    login     = new ViewLogin(Response);
            var          button    = sender as Button;

            if (button.Name.Equals("OrderBtn"))
            {
                remote.SetCommand(viewOrder);
                remote.ExecuteCommand();
                this.Close();
            }
            else if (button.Name.Equals("LogoutBtn"))
            {
                remote.SetCommand(login);
                remote.ExecuteCommand();
                this.Close();
            }
            else if (button.Name.Equals("SalesBtn"))
            {
                remote.SetCommand(sales);
                remote.ExecuteCommand();
                this.Close();
            }
        }
Exemplo n.º 3
0
 private void BackBtn_Click(object sender, RoutedEventArgs e)
 {
     remote   = new UIRemote();
     viewMenu = new ViewMainMenu(accountResponse);
     remote.SetCommand(viewMenu);
     remote.ExecuteCommand();
     this.Close();
 }
Exemplo n.º 4
0
        private void TransactionComplete(OrderResponse response, string accountName, string customerName)
        {
            Console.WriteLine("Order Valid");
            var    cost   = response.OrderEntity.TotalCost;
            string result = "Name:\t\t\t" + customerName + "\n\nEmployee Name:\t\t" + accountName + "\n\nProducts:";

            foreach (var item in Cart.Items)
            {
                string name = item.ToString();
                result += "\t\t\t" + name + "\n";
            }
            result += "\nTotal Cost:\t\t" + cost;
            MessageBox.Show(result, "Transaction Complete");
            remote   = new UIRemote();
            viewMenu = new ViewMainMenu(accountResponse);
            remote.SetCommand(viewMenu);
            remote.ExecuteCommand();
            this.Close();
        }