internal NewGuestViewModel(NewGuestView view, string ordererPersonalNo) { this.view = view; Meals = LoadMeals(); selectedMeal = new tblMeal(); Meal = new tblMeal(); newOrder = new tblOrder(); orderedMeals = new List <tblMealOrder>(); this.ordererPersonalNo = ordererPersonalNo; }
void Submit(object obj) { string password = (obj as PasswordBox).Password; var validate = new Validations.Validations(); var constants = new Constants(); if (UserName == "Zaposleni" && SecurePasswordHasher.Verify(password, constants.passwordEmployeeHashed)) { EmployeeView employeeView = new EmployeeView(UserName); loginView.Close(); employeeView.Show(); return; } else if (validate.IsValidPersonalNoFormat(UserName) && SecurePasswordHasher.Verify(password, constants.passwordGuestHashed)) { DataAccess dataAccess = new DataAccess(); if (validate.IsPersonalNoInDb(UserName, dataAccess.LoadPersonalNumbers())) { OrderStatusView oldQuestView = new OrderStatusView(UserName); //loginView.Close(); oldQuestView.Show(); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(2) }; timer.Start(); timer.Tick += (sender, args) => { timer.Stop(); NewGuestView guestView = new NewGuestView(UserName); loginView.Close(); oldQuestView.Close(); guestView.Show(); }; return; } NewGuestView newGuestView = new NewGuestView(UserName); loginView.Close(); newGuestView.Show(); return; } else { WarningView warning = new WarningView(loginView); warning.Show("User name or password are not correct!"); return; } }