예제 #1
0
        private void MngStcBtn_Click(object sender, RoutedEventArgs e)
        {
            StockWindow stockWindow = new StockWindow(true);

            this.Hide();
            stockWindow.ShowDialog();
            this.Show();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (nameTextBox.Text != string.Empty && passTextBox.Password != string.Empty) //Empty Field Check
            {
                FacadeController f = FacadeController.GetFacade();

                User loginResult = f.Authenticate(nameTextBox.Text, passTextBox.Password.ToString());
                nameTextBox.Text     = "";
                passTextBox.Password = string.Empty;
                if (loginResult != null)
                {
                    if (loginResult.type == "Salesman")
                    {
                        MessageBox.Show(loginResult.type);
                    }
                    else if (loginResult.type == "Admin")
                    {
                        signedIn = true;
                        StockWindow stockWindow = new StockWindow(false);
                        this.Hide();
                        stockWindow.ShowDialog();
                        if (!signedIn)
                        {
                            this.Show();
                        }
                    }
                    else if (loginResult.type == "Root")
                    {
                        signedIn = true;
                        RootMenu rm = new RootMenu();
                        this.Hide();
                        rm.ShowDialog();
                        if (!signedIn)
                        {
                            this.Show();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Login failed");
                }
            }
        }