/// <summary>
        /// Method for deciding which View will open according to logged in Employee credentials
        /// </summary>
        private void LoginExecute(object o)
        {
            try
            {
                string password = (o as PasswordBox).Password;
                if (Username == "Mag2019" && password == "Mag2019")
                {
                    EmployeeView employee = new EmployeeView();
                    logInView.Close();
                    employee.ShowDialog();
                }
                else if (Username == "Man2019" && password == "Man2019")
                {
                    ManagerView manager = new ManagerView();
                    logInView.Close();
                    manager.ShowDialog();
                    return;
                }
                else
                {
                    MessageBox.Show("Username or password not correct.");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method for deciding which View will open according to logged in Employee credentials
        /// </summary>
        private void LoginExecute(object o)
        {
            try
            {
                string password = (o as PasswordBox).Password;
                if (Username == "Zaposleni" && password == "Zaposleni")
                {
                    EmployeeView employee = new EmployeeView();
                    logInView.Close();
                    employee.ShowDialog();
                }
                else if (Validations.Validation.IsValidJMBG(Username) && password == "Gost")
                {
                    GuestView guest = new GuestView(username);
                    logInView.Close();
                    guest.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Username or password not correct." +
                                    "Username must be valid JMBG.");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
 /// <summary>
 /// This method checks if username and password valid.
 /// </summary>
 /// <param name="password">User input for password.</param>
 public void LogInExecute(object password)
 {
     Password = (password as PasswordBox).Password;
     if (Username == OwnerUsername && Password == OwnerPassword)
     {
         OwnerView ownerView = new OwnerView();
         ownerView.ShowDialog();
     }
     else if (users.FindManager(Username, Password) != null)
     {
         Manager = users.FindManager(Username, Password);
         ManagerView managerView = new ManagerView(Manager);
         managerView.ShowDialog();
     }
     else if (users.FindEmployee(Username, Password) != null)
     {
         Employee = users.FindEmployee(Username, Password);
         EmployeeView employeeView = new EmployeeView(Employee);
         employeeView.ShowDialog();
     }
     else
     {
         MessageBox.Show("Wrong username or password. Please, try again.", "Notification");
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Logs the Employee or Guest
 /// </summary>
 private void LogInExecute()
 {
     if (Username == "2201996800109" && Password == "Gost")
     {
         try
         {
             using (PizzaRestourantEntities db = new PizzaRestourantEntities())
             {
                 if (db.tblOrders.Any(x => x.State == "Waiting"))
                 {
                     MessageBox.Show($"You Already Ordered. Order Status: Waiting");
                 }
                 else
                 {
                     GuestView view = new GuestView();
                     view.ShowDialog();
                 }
             }
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex.Message.ToString());
         }
     }
     else if (Username == "Zaposleni" && Password == "Zaposleni")
     {
         EmployeeView view = new EmployeeView();
         view.ShowDialog();
     }
     else
     {
         MessageBox.Show("Incorrect Username or Passwrod");
     }
 }
Exemplo n.º 5
0
        private void BtnOpenEpmloyeeView(object sender, RoutedEventArgs e)
        {
            EmployeeView view = new EmployeeView();

            view.Closing += EmployeeView_Closing;
            view.ShowDialog();
        }
Exemplo n.º 6
0
        private void LoginExecute(object o)
        {
            try
            {
                string password = (o as PasswordBox).Password;
                if (Username == "Zaposleni" && Password == "Zaposleni")
                {
                    EmployeeView employee = new EmployeeView();
                    employee.ShowDialog();
                }

                else if (JMBGisValid(Username) && Password == "Gost")
                {
                    GuestView guest = new GuestView();
                    guest.ShowDialog();
                }

                else
                {
                    MessageBox.Show("Invalid parametres.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 7
0
        public void OpenEmployee(object execute)
        {
            EmployeeView      view = new EmployeeView();
            EmployeeViewModel vm   = new EmployeeViewModel(SelectedEmployee, view);

            view.DataContext = vm;
            view.ShowDialog();
        }
Exemplo n.º 8
0
 /// <summary>
 /// This method checks if username and password valid.
 /// </summary>
 public void LogInExecute()
 {
     if (Username == "Zaposleni" && Password == "Zaposleni")
     {
         EmployeeView employee = new EmployeeView();
         employee.ShowDialog();
     }
     else if (validation.ValidationForJMBG(Username) == true && Password == "Gost")
     {
         GuestView guestView = new GuestView(Username);
         guestView.ShowDialog();
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Method for checking username and password
        /// </summary>
        /// <param name="o"></param>
        private void LoginExecute(object o)
        {
            try
            {
                StreamReader  sr    = new StreamReader(@"..\..\OwnerAccess.txt");
                string        line  = "";
                List <string> owner = new List <string>();

                while ((line = sr.ReadLine()) != null)
                {
                    owner.Add(line);
                }
                sr.Close();
                string password = (o as PasswordBox).Password;
                if (userName == owner[0] && password == owner[1])
                {
                    OwnerView ow = new OwnerView();
                    view.Close();
                    ow.ShowDialog();
                }

                else if (service.IsUser(UserName))
                {
                    Manager = service.FindManager(UserName);
                    ManagerView managerView = new ManagerView();
                    view.Close();
                    managerView.ShowDialog();
                }

                else if (service.IsUser(UserName))
                {
                    Employee = service.FindEmployee(UserName);
                    EmployeeView employeeView = new EmployeeView();
                    view.Close();
                    employeeView.ShowDialog();
                }


                else
                {
                    MessageBox.Show("Incorrect username or password");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// method for checking username and password and opening the windows
 /// </summary>
 private void SaveExecute()
 {
     if (JmbgValidation(username) && password == "Gost")
     {
         CustomerView customer = new CustomerView(username);
         customer.ShowDialog();
     }
     else if (username == "Zaposleni" && password == "Zaposleni")
     {
         EmployeeView employee = new EmployeeView();
         employee.ShowDialog();
     }
     else
     {
         MessageBox.Show("Wrong username or password, please try again.");
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// This method checks if username and password valid.
 /// </summary>
 /// <param name="password">User input for password.</param>
 public void LogInExecute(object password)
 {
     Password = (password as PasswordBox).Password;
     if (Username == "Zaposleni" && Password == "Zaposleni")
     {
         EmployeeView employee = new EmployeeView();
         employee.ShowDialog();
     }
     else if (validation.ValidationForJMBG(Username) == true && Password == "Gost")
     {
         GuestView guestView = new GuestView(Username);
         guestView.ShowDialog();
     }
     else
     {
         MessageBox.Show("Wrong username or password. Please try again.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Exemplo n.º 12
0
 public void LogInExecute()
 {
     if (Username == "WPFadmin" && Password == "WPFadmin")
     {
         AdminView admin = new AdminView();
         admin.ShowDialog();
     }
     else if (employees.FindEmployee(Username, Password) != null)
     {
         Employee = employees.FindEmployee(Username, Password);
         EmployeeView employeeView = new EmployeeView(Employee);
         employeeView.ShowDialog();
     }
     else
     {
         Manager = managers.FindManager(Username, Password);
         ManagerView managerView = new ManagerView(Manager);
         managerView.ShowDialog();
     }
 }
        /// <summary>
        /// Method for deciding which View will open according to logged in Employee credentials
        /// </summary>
        private void LoginExecute()
        {
            try
            {
                switch (loggedEmployee.Role)
                {
                case "Admin":
                    AdminView adminMenu = new AdminView();
                    adminMenu.ShowDialog();
                    loginView.Close();
                    break;

                case "Employee":
                    EmployeeView employeeView = new EmployeeView(loggedEmployee.ID);
                    employeeView.ShowDialog();
                    loginView.Close();
                    break;

                case "Manager":
                    tblManager manager = Services.LogInService.GetManagerById(loggedEmployee.ID);
                    if (manager.AccessLevel == "Modify")
                    {
                        ModifyView modify = new ModifyView();
                        modify.ShowDialog();
                        loginView.Close();
                    }
                    else
                    {
                        ReadOnlyView readOnly = new ReadOnlyView();
                        readOnly.ShowDialog();
                        loginView.Close();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Shows Employee View
        /// </summary>
        private void ShowEmployeeViewExecute()
        {
            EmployeeView view = new EmployeeView();

            view.ShowDialog();
        }