Ejemplo n.º 1
0
        private void add_Click(object sender, RoutedEventArgs e)
        {
            stringPanel.Visibility = System.Windows.Visibility.Collapsed;
            rangePanel.Visibility  = System.Windows.Visibility.Collapsed;
            AddEmployee addEmployee = new AddEmployee(itsBL, user);

            tableShow.Children.Clear();
            tableShow.Children.Add(addEmployee);
        }
Ejemplo n.º 2
0
        private void LogIn_Click(object sender, RoutedEventArgs e)
        {
            string passwordTmp = password.Password;
            string usernameTmp = userName.Text;
            bool   ans;

            try
            {
                User tempUser = new User(usernameTmp, passwordTmp);
                User user;


                ans = itsBL.doesFileExist();

                if (ans)
                {
                    itsBL.loadDataFromFile();
                    user = itsBL.isUserOk(tempUser);

                    if (user == null)
                    {
                        user = itsBL.isUserAdmin(tempUser);
                        if (usernameTmp == "Admin")
                        {
                            user.Hierarchy = Hierarchy.Adminstor;
                        }
                    }

                    if (user != null)
                    {
                        MainMenu enter = new MainMenu(itsBL, user);
                        if (usernameTmp == "Admin")
                        {
                            user.Hierarchy = Hierarchy.Adminstor;
                            AddEmployee addFirstEmployee = new AddEmployee(itsBL, user);
                            enter.chengeScreen.Children.Add(addFirstEmployee);
                        }
                        this.Close();
                        enter.Show();
                    }
                    else
                    {
                        throw new Exception("Username or password are incorrect");
                    }
                }
                else
                {
                    user = itsBL.isUserAdmin(tempUser);

                    if (user != null)
                    {
                        if (usernameTmp == "Admin")
                        {
                            user.Hierarchy = Hierarchy.Adminstor;
                        }
                        MainMenu    enter            = new MainMenu(itsBL, user);
                        AddEmployee addFirstEmployee = new AddEmployee(itsBL, user);
                        this.Close();
                        enter.chengeScreen.Children.Add(addFirstEmployee);
                        enter.Show();
                    }
                }
                // להוסיף פונקציה שמבחינה בין רמות שונות
            }
            catch (Exception b)
            {
                MessageBox.Show(b.Message);
            }
        }