コード例 #1
0
        private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            var user = db.users.FirstOrDefault(x => x.login == txtUsername.Text && x.password == txtPassword.Password);

            if (user != null && user.login == "manager")
            {
                ProviderWindow prWindow = new ProviderWindow();
                prWindow.Show();
                this.Close();
            }
            else if (user != null && user.login == "admin")
            {
                AdminWindow adWindow = new AdminWindow();
                adWindow.Show();
                this.Close();
            }
            else if (user != null && user.login == "waiter")
            {
                WaiterWindow waWindow = new WaiterWindow();
                waWindow.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("The user doesn't exist");
            }
        }
コード例 #2
0
        public new void Loaded(BussinnesEntity.Type type)
        {
            Dispatcher.Invoke(new Action(delegate
            {
                Hide();
                Window window;
                switch (type)
                {
                case BussinnesEntity.Type.chef:
                    window = new KitchenWindow();
                    window.Show();
                    break;

                case BussinnesEntity.Type.manager:
                    window = new ManagerWindow();
                    window.Show();
                    break;

                case BussinnesEntity.Type.waiter:
                    window = new WaiterWindow();
                    window.Show();
                    break;

                default:
                    break;
                }
            }));
        }
コード例 #3
0
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ProjectRestaurantEntities _db = new ProjectRestaurantEntities();
         var user = _db.users.FirstOrDefault(x =>
                                             x.login == txtUsername.Text && x.password == txtPassword.Password);
         if (user != null && user.login == "admin")
         {
             AdminWindow dashboard = new AdminWindow();
             dashboard.Show();
             this.Close();
         }
         else if (user != null && user.login == "chef")
         {
             ChefWindow forChef = new ChefWindow();
             forChef.Show();
             this.Close();
         }
         else if (user != null && user.login == "accountant")
         {
             AccountantWindow forAccountant = new AccountantWindow();
             forAccountant.Show();
             this.Close();
         }
         else if (user != null && user.login == "manager")
         {
             ProviderWindow forProvider = new ProviderWindow();
             forProvider.Show();
             this.Close();
         }
         else if (user != null && user.login == "waiter")
         {
             WaiterWindow forWaiter = new WaiterWindow();
             forWaiter.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Користувача з такими даними не існує");
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(Convert.ToString(ex));
     }
 }