Exemple #1
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());
            }
        }
Exemple #2
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");
     }
 }
Exemple #3
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());
            }
        }
Exemple #4
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();
     }
 }
Exemple #5
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);
     }
 }