/// <summary> /// Method for checking username and password /// </summary> /// <param name="o"></param> private void LoginExecute(object o) { try { string password = (o as PasswordBox).Password; if (userName == "Man2019" && password == "Man2019") { MainWindow mw = new MainWindow(); view.Close(); mw.ShowDialog(); } else if (userName == "Mag2019" && password == "Mag2019") { StorekeeperView storekeeper = new StorekeeperView(); view.Close(); storekeeper.Show(); return; } else { MessageBox.Show("Incorrect username or password"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void Submit(object obj) { string password = (obj as PasswordBox).Password; if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password)) { MessageBox.Show("Wrong user name or password"); return; } if (UserName.Equals(UserConstants.MANAGER_USER_NAME) && password.Equals(UserConstants.MANAGER_PASSWORD)) { ManagerMainView managerView = new ManagerMainView(); view.Close(); managerView.Show(); } else if (UserName.Equals(UserConstants.STOREKEEPER_USER_NAME) && password.Equals(UserConstants.STOREKEEPER_PASSWORD)) { StorekeeperMainView storekeeperView = new StorekeeperMainView(); view.Close(); storekeeperView.Show(); } else { MessageBox.Show("Wrong username or password"); } }
void Submit(object obj) { string password = (obj as PasswordBox).Password; if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password)) { MessageBox.Show("Wrong user name or password"); return; } string encryptedString = EncryptionHelper.Encrypt(password); tblUser user = userService.GetUserByUserNameAndPassword(UserName, encryptedString); if (user != null) { UserMain userMain = new UserMain(user); userMain.Show(); view.Close(); return; } else { MessageBox.Show("Wrong user name or password"); return; } }
public void Login(string username, string password, LoginView view) { List <Employee> employees = empmod.GetAllEmployees(); if (username == "Master" && password == "Master") { OwnerView ov = new OwnerView(); view.Close(); ov.Show(); } else if (employees.Contains((from e in employees where e.Username == username && e.Password == password select e).FirstOrDefault())) { Employee employee = (from e in employees where e.Username == username && e.Password == password select e).FirstOrDefault(); if (employee.Responsibility != null) { WorkerView wv = new WorkerView(); view.Close(); wv.Show(); } else { ManagerView mv = new ManagerView(); view.Close(); mv.Show(); } } else { MessageBox.Show("Username or Password was incorrect ", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <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> /// Method for checking username and password /// </summary> /// <param name="o"></param> private void LoginExecute(object o) { try { string password = (o as PasswordBox).Password; if (Username == "Zaposleni" && password == "Zaposleni") { MainWindow mw = new MainWindow(); view.Close(); mw.ShowDialog(); } else if (JMBGisValid(Username) == true && Password == "Gost") { GuestView guest = new GuestView(Username); view.Close(); guest.Show(); return; } else { MessageBox.Show("Incorrect username or password"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void Login(string username, string password, LoginView view) { List <AppUser> users = user.GetAllAppUsers(); if (users.Contains((from x in users where x.Username == username && x.Password == password select x).FirstOrDefault())) { UserView uv = new UserView(); view.Close(); uv.Show(); } else if (MessageBox.Show("This user doesn't exis. Would you like to create it?", "Create User", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes) { AppUser au = new AppUser(); au.Username = username; au.Password = password; user.AddAppUser(au); UserView uv = new UserView(); view.Close(); uv.Show(); } else { MessageBox.Show("Please try again", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
private void SubmitCommandExecute(object obj) { try { string password = (obj as PasswordBox).Password; if (ValidationClass.JMBGisValid(UserName) && password.Equals("Gost")) { GuestMainView guestMain = new GuestMainView(UserName); view.Close(); guestMain.Show(); return; } else if (UserName.Equals("Zaposleni") && password.Equals("Zaposleni")) { EmployeeView employeeView = new EmployeeView(); view.Close(); employeeView.Show(); } else { MessageBox.Show("Wrong usename or password"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void SubmitCommandExecute(object obj) { try { string password = (obj as PasswordBox).Password; user = databaseService.FindUserCredentials(UserName, password); if (UserName.Equals("Admin") && password.Equals("Admin123")) { if (databaseService.UserExists(UserName)) { UserView userView = new UserView(user); login.Close(); userView.Show(); return; } else { adminUser.UserName = UserName; string encryptPassword = EncryptionHelper.Encrypt(password); adminUser.Password = encryptPassword; databaseService.AddUser(adminUser); UserView userView = new UserView(adminUser); login.Close(); userView.Show(); return; } } else if (user != null) { UserView userView = new UserView(user); login.Close(); userView.Show(); return; } else { if (databaseService.UserExists(UserName)) { MessageBox.Show("User with same name already exists in database, please choose another username.", "Info"); return; } else { user = new tblUser(); user.UserName = UserName; string encryptPassword = EncryptionHelper.Encrypt(password); user.Password = encryptPassword; FirstTimeAccessView firstTimeView = new FirstTimeAccessView(user); login.Close(); firstTimeView.Show(); return; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void Submit(object obj) { string encryptedString = (obj as PasswordBox).Password; string password = EncryptionHelper.Encrypt(encryptedString); if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password)) { MessageBox.Show("Wrong user name or password"); return; } if (UserName.Equals(ownerData["username"]) && encryptedString.Equals(ownerData["password"])) { OwnerView ownerView = new OwnerView(); view.Close(); ownerView.Show(); return; } foreach (var user in users) { if (user.Username.Equals(UserName) || user.Passwd.Equals(password)) { tblEmployee employee = hotelService.GetEmloyeByUserId(user.ID); if (employee != null) { EmployeeView empView = new EmployeeView(); empView.Show(); view.Close(); } else { ManagerView manView = new ManagerView(); manView.Show(); view.Close(); } return; } } MessageBox.Show("Wrong user name or password"); //else if (UserName.Equals(UserConstants.STOREKEEPER_USER_NAME) && // password.Equals(UserConstants.STOREKEEPER_PASSWORD)) //{ // StorekeeperMainView storekeeperView = new StorekeeperMainView(); // view.Close(); // storekeeperView.Show(); //} }
private void RegisterExecute() { try { RegistrationView registerView = new RegistrationView(); login.Close(); registerView.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <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()); } }
/// <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 (users.FindUser(Username, Password) != null) { User = users.FindUser(Username, Password); UserView userView = new UserView(User); login.Close(); userView.ShowDialog(); } else { MessageBox.Show("Wrong username or password. Please, try again.", "Notification"); } }
protected override void OnStartup(StartupEventArgs e) { this.DispatcherUnhandledException += App_DispatcherUnhandledException; _bootstrapper.Initialize(); #region 主题颜色 // get the current app style (theme and accent) from the application // you can then use the current theme and custom accent instead set a new theme Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current); // now set the Green accent and dark theme ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Green"), ThemeManager.GetAppTheme("BaseLight")); // or appStyle.Item1 #endregion //将LoginView设为主窗体 LoginView loginView = _bootstrapper.IocManager.Resolve <LoginView>(); MainWindow = loginView; MainWindow.Show(); //注册消息,返回true为登录成功 Messenger.Default.Register <bool?>(this, "Login", m => { if (m.Value == true) { MainWindow = _bootstrapper.IocManager.Resolve <MainWindow>(); loginView.Close(); MainWindow.Show(); } }); }
public MainWindow() { InitializeComponent(); Title = Title + $" {typeof(MainWindow).Assembly.GetName().Version}"; DependencyContainer.ComposeParts(this); #if DEBUG Log.Info("Running in debug mode"); #else Logger.Visibility = Visibility.Collapsed; #endif var dispatcher = Dispatcher.CurrentDispatcher; Func <(Action <string> show, Action <string> updateText, Action close)> createProgressingViewFunc = () => { var view = new ProgressView(); view.Owner = this; return(text => { view.TextToShow.Text = text; view.ShowDialog(); }, txt => { if (dispatcher.CheckAccess()) { view.TextToShow.Text = txt; } else { dispatcher.BeginInvoke((Action)(() => { view.TextToShow.Text = txt; })); } }, () => view.Close()); }; Action <Action <string, string, string> > createLoginViewFunc = loginAction => { var view = new LoginView { Owner = this }; var loginVm = new LoginViewModel(() => view.Close(), loginAction); view.DataContext = loginVm; view.ShowDialog(); }; _vm = new MainWindowsViewModel(createLoginViewFunc, createProgressingViewFunc); _vm.SetParentWindow(this); DataContext = _vm; Closing += OnClosing; Loaded += MainWindow_Loaded; Height = SystemParameters.PrimaryScreenHeight * 0.70; Width = Height * 1.5; }
public void ExecuteLoginCommand(object obj) { var passwordBox = obj as PasswordBox; if (mViewModel.UserName != null && mViewModel.UserName != "" && passwordBox.Password != null && passwordBox.Password != "") { var loginResult = mUserService.Login(mViewModel.UserName, passwordBox.Password); if (loginResult.success) { mUser = loginResult.user; mView.DialogResult = true; mView.Close(); return; } else { ShowMessage("Username oder Passwort nicht gefunden, bitte erneut versuchen."); } } else { ShowMessage("Bitte Username und Passwort eingeben."); } }
public void Login(object obj) { var WR = (HttpWebRequest)WebRequest.Create(Path.Combine(url, "api/Account/Login")); WR.Method = "POST"; WR.ContentType = "application/json"; //Create trust ssl connection ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls; using (StreamWriter writeStream = new StreamWriter(WR.GetRequestStream())) { string json = new JavaScriptSerializer().Serialize(new { Username = Username, Password = Password }); writeStream.Write(json); } WebResponse response = WR.GetResponse(); UserProfile userProfile; using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { userProfile = JsonConvert.DeserializeObject <UserProfile>(reader.ReadToEnd()); } } using (FileStream fs = new FileStream("UserProfile.dat", FileMode.Create)){ BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, userProfile); } MainWindow mainWindow = new MainWindow(); mainWindow.Show(); _lv.Close(); }
void Submit(object obj) { string encryptedString = (obj as PasswordBox).Password; string password = EncryptionHelper.Encrypt(encryptedString); if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(password)) { MessageBox.Show("Wrong user name or password"); return; } tblUser userInDb = service.GetUserByUserNameAndPassword(UserName, password); if (userInDb == null) { MessageBox.Show("Wrong user name or password"); return; } else { MainMenu mainMenu = new MainMenu(UserName); mainMenu.Show(); view.Close(); } }
public void OnLaunchResultLogin(bool result) { if (result) { ManageUsersView manageUsers = new ManageUsersView(); // Create Main Window View Model ManageUsersViewModel viewModel = new ManageUsersViewModel(); // Associate DataContext manageUsers.DataContext = viewModel; Application.Current.MainWindow = manageUsers; //LoginView reportW = Application.Current.Windows.OfType<LoginView>().SingleOrDefault(); foreach (Window item in Application.Current.Windows) { try { LoginView loginView = (LoginView)item; loginView.Close(); } catch { } } manageUsers.Show(); } }
public void closeAll() { this.Close(); loginView?.Close(); mainView?.Close(); //Application.Current.Shutdown(0); }
private void SubmitCommandExecute(object obj) { try { List <string> strList = Utility.PasswordLoader.LoadPassword(); string password = (obj as PasswordBox).Password; if (UserName.Equals(strList.ElementAt(0)) && password.Equals(strList.ElementAt(1))) { OwnerView ownerView = new OwnerView(); login.Close(); ownerView.Show(); return; } //else if (UserName.Equals("aaa") && password.Equals("aaa")) //{ // ManagerView managerView = new ManagerView(); // login.Close(); // managerView.Show(); // return; //} else { MessageBox.Show("Wrong usename or password"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void Login(string username, string password) { User user = _model.GetUser(username, password); if (user != null) { new UserController(user); _view.Close(); } }
private void CancelExecute() { try { logIn.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
void Submit(object obj) { string password = (obj as PasswordBox).Password; string encryptedString = EncryptionHelper.Encrypt(password); tblUser user = service.GetUserByUserNameAndPassword(UserName, encryptedString); if (user != null) { InputDialogSample inputDialog = new InputDialogSample("Enter children or adults to choose cake list:" + "", ""); if (inputDialog.ShowDialog() == true) { if (inputDialog.Answer.ToLower().Equals("children")) { UserMainView mainView = new UserMainView("children", user); mainView.Show(); view.Close(); return; } else if (inputDialog.Answer.ToLower().Equals("adults")) { UserMainView mainView = new UserMainView("adults", user); mainView.Show(); view.Close(); return; } else { MessageBox.Show("Wrong input"); } } } else { MessageBox.Show("Wrong username or password"); } }
/// <summary> /// Method for checking username and password /// </summary> /// <param name="o"></param> private void LoginExecute(object o) { try { StreamReader sr = new StreamReader(@"..\..\ClinicAccess.txt"); string line = ""; List <string> clinic = new List <string>(); while ((line = sr.ReadLine()) != null) { clinic.Add(line); } sr.Close(); string password = (o as PasswordBox).Password; if (userName == clinic[0] && password == clinic[1]) { AddClinicAdministratorView cl = new AddClinicAdministratorView(); view.Close(); cl.ShowDialog(); } else if (service.IsUser(UserName)) { Administrator = service.FindAdmin(UserName); AdministratorView adminView = new AdministratorView(); view.Close(); adminView.ShowDialog(); } else { MessageBox.Show("Incorrect username or password. Please try again."); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void SubmitCommandExecute(object obj) { try { List <string> strList = Utility.PasswordLoader.LoadPassword(); string password = (obj as PasswordBox).Password; employee = dataBaseService.FindEmployeeCredentials(UserName, password); manager = dataBaseService.FindManagerCredentials(UserName, password); if (UserName.Equals(strList.ElementAt(0)) && password.Equals(strList.ElementAt(1))) { OwnerView ownerView = new OwnerView(); login.Close(); ownerView.Show(); return; } else if (manager != null) { ManagerView managerView = new ManagerView(manager); login.Close(); managerView.Show(); return; } else if (employee != null) { EmployeeView employeeView = new EmployeeView(employee); login.Close(); employeeView.Show(); return; } else { MessageBox.Show("Wrong usename or password"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void SignInCommandExecute(object obj) { try { string password = (obj as PasswordBox).Password; admin = dataBaseService.FindAdminCredentials(UserName, password); manager = dataBaseService.FindManagerCredentials(UserName, password); if (UserName.Equals("WPFMaster") && password.Equals("WPFAccess")) { MasterView masterView = new MasterView(); login.Close(); masterView.Show(); return; } if (admin != null) { AdminView adminView = new AdminView(admin); login.Close(); adminView.Show(); return; } else if (manager != null) { ManagerView managerView = new ManagerView(manager); login.Close(); managerView.Show(); return; } else { MessageBox.Show("Wrong usename or password"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void OnCmdLogin() { if (string.IsNullOrEmpty(Benutzername)) { MessageBox.Show("Bitte tragen Sie einen Benutzernamen ein..."); return; } var searchView = new MainView(Benutzername); searchView.Show(); _loginView.Close(); }
private void OnLoad(LoginView Window) { try { if (CurrentReader != null) { CurrentReader.Dispose(); CurrentReader = null; } CurrentReader = Readers[0]; if (CurrentReader == null) { return; } Window.Closed += (s, e) => { OnProgress.Abort(); CancelCaptureAndCloseReader(OnCaptured); }; if (!OpenReader()) { Window.Close(); } if (!StartCaptureAsync(OnCaptured)) { Window.Close(); } OnProgress = new Thread(() => InvokeDelegate(Window)); } catch { } }
public static void Main() { bool otherEPOSIsNotRunning = false; AppMutex = new Mutex(false, APPLICATION_NAME, out otherEPOSIsNotRunning); if (AppMutex.WaitOne(0, false)) { LoginView loginView = new LoginView(); loginView.ShowDialog(); if (loginView.DialogResult.Equals(true)) { loginView.Close(); App app = new App(); app.InitializeComponent(); app.Run(); } } }
private void OnCmdLogin() { if (string.IsNullOrEmpty(Benutzername)) { _messegaBoxService.Show("Bitte tragen Sie einen Benutzernamen ein..."); return; } if (_documentManagementService.RepositoryExists()) { _documentManagementService.ImportArchiv(); var searchView = new MainView(Benutzername, _documentManagementService, _messegaBoxService); searchView.Show(); _loginView.Close(); } }