Beispiel #1
0
        /// <summary>
        /// Saves the Order in database
        /// </summary>
        private void SaveExecute()
        {
            try
            {
                tblOrder order = new tblOrder();
                order.Price = Price;
                order.State = "Waiting";
                using (PizzaRestourantEntities db = new PizzaRestourantEntities())
                {
                    if (db.tblOrders.Any(x => x.State == "Waiting"))
                    {
                        MessageBox.Show($"You already orderd.  Order Status: {order.State}");
                    }
                    else
                    {
                        DateTime dateTime = DateTime.Now;
                        order.CreatedDate = dateTime.Date;
                        order.CreatedTime = dateTime.TimeOfDay;
                        db.tblOrders.Add(order);
                        db.SaveChanges();

                        MessageBox.Show($"Ordered Successfully! Order Status: {order.State}");
                        main.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message.ToString());
            }
        }
        private void LogoutExecute()
        {
            LoginView logout = new LoginView();

            view.Close();
            logout.Show();
        }
        protected override void ExitExecute()
        {
            MainWindow loginWindow = new MainWindow();

            userView.Close();
            loginWindow.Show();
        }
        private void LogoutExecute()
        {
            LoginView loginView = new LoginView();

            userView.Close();
            loginView.Show();
        }
 private void CancelExecute()
 {
     try
     {
         MessageBoxResult result = MessageBox.Show("Are you sure you want to log out?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (result == MessageBoxResult.Yes)
         {
             LoginScreen login = new LoginScreen();
             userView.Close();
             login.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        public void LogOutExecute()
        {
            MessageBoxResult result = MessageBox.Show("Are you sure you want to log out?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                LoginView login = new LoginView();
                userView.Close();
                login.ShowDialog();
            }
        }
Beispiel #7
0
 /// <summary>
 /// Executes the logOut command
 /// </summary>
 private void LogOutExecute()
 {
     try
     {
         LoginView login = new LoginView();
         userView.Close();
         login.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 public void Close()
 {
     _view.Close();
 }