/// <summary> /// logout execute /// </summary> private void LogOutExecute() { LogInView log = new LogInView(); log.Show(); managerView.Close(); }
public ActionResult LogInView(LogInView korisnik) { if (ModelState.IsValid) { using (InformacioniSistemBanakaEntities db = new InformacioniSistemBanakaEntities()) { var obj = db.Korisnici.Where(a => a.NazivKorisnika.Equals(korisnik.NazivKorisnika) && a.Lozinka.Equals(korisnik.Lozinka)).FirstOrDefault();//kad ne nadje firstordefault vraca null if (obj == null) { korisnik.LoginError = "Uneti pogrešni podaci"; return(View("LogInView", korisnik)); } else { if (obj.UlogaID == 1) { Session["korisnik"] = obj.NazivKorisnika; return(RedirectToAction("AdminView", "Admin")); } else if (obj.UlogaID == 2) { Session["korisnik"] = obj.NazivKorisnika; Session["korisnikId"] = obj.KorisnikId; return(RedirectToAction("KorisnikView")); } else { Session["korisnik"] = obj.NazivKorisnika; return(RedirectToAction("About", "Home")); } } } } return(View()); }
/// <summary> /// logout execute /// </summary> private void LogOutExecute() { LogInView log = new LogInView(); log.Show(); employeeView.Close(); }
public void ExecuteLogOutCommand(object parameter) { LogInView logInView = new LogInView(); logInView.Show(); Close(); }
private void InitializeLoginView() { logInView = new LogInView(); logInView.AvailableUsers = query.GetAllUsers(); logInView.TryLogInCallback = query.TryLogIn; logInView.AddUserCallback = query.AddUser; logInView.IsUniqueCallback = query.IsUniqueId; logInView.SucessfulLoginCallback = GoToMainMenu; logInView.ParseInputValidation = logInView.ValidateInputParse; logInView.RefreshView = GoToLogIn; }
public IView GetView(string userName) { IView logInView = new LogInView(Error, Username, Password.Length); if (Error) { ResetLogin(); Error = false; } return(logInView); }
public MainWindow() { CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); culture.DateTimeFormat.ShortDatePattern = "dd.MM.yyyy"; culture.DateTimeFormat.LongTimePattern = "HH:mm:ss"; Thread.CurrentThread.CurrentCulture = culture; DataContext = new LogInView(); InitializeComponent(); }
/// <summary> /// Method for logging out admin from app /// </summary> private void LogOutExecute() { try { modify.Close(); LogInView newLogin = new LogInView(); newLogin.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void LogIn() { var loginForm = new LogInView(_appConfig); DialogResult result = loginForm.ShowDialog(); if (result == DialogResult.OK) { _appConfig = loginForm.AppConfig; _presenter = new ExcelPresenter(_application, new DatabaseConnectionFactory().CreateDbConnection(_appConfig.DatabaseType, _appConfig.ConnectionString), new SqlGeneratorFactory().CreateSqlGenerator(_appConfig.DatabaseType), _workbookPropertiesConfig); } }
public void GetLogInTest() { //Arrange var userType = "Administrator"; var Admin = new Administrator(); var expectedResult = new LogInView(Admin);// Expected result is the loginview for an Admin //Act var result = EntryController.GetLogIn(userType); // testing the method that replace the login view with admin login view //Assert Assert.AreEqual(expectedResult.MyUser.GetType().Name, result.MyUser.GetType().Name); // checking if both are the same type of loginView }
public static LogInView GetLogIn(String User) { var logIn = new LogInView(new Client()); switch (User) { case "Client": var myClient = new Client(); logIn = new LogInView(myClient); break; case "Developer": var myDeveloper = new Developer(); logIn = new LogInView(myDeveloper); break; case "Senior": var mySenior = new Senior(); logIn = new LogInView(mySenior); break; case "Administrator": var myAdmin = new Administrator(); logIn = new LogInView(myAdmin); break; default: throw new NullReferenceException(); } return(logIn); }
private void onNav(string destination) { switch (destination) { case "myBack": foreach (Window window in Application.Current.Windows) { if (window.Title == "Profile") { mainWindow = new MainWindow(); mainWindow.Show(); window.Close(); } } break; case "myKorisnici": CurrentViewModel = korisniciVIewModel; break; case "myProfil": CurrentViewModel = myProfileVIewModel; break; case "myLogOut": foreach (Window window in Application.Current.Windows) { if (window.Title == "Profile") { logInView = new LogInView(); logInView.Show(); window.Close(); } } break; } }
/// <summary> /// Creates as base window for additional Views. /// Method builds windows according to the button's command parameter /// </summary> /// <param name="choice"></param> /// <returns> /// Basewindow Type Window /// </returns> public Window CreateBaseWindow(string choice) { try { switch (choice) { case "loginView": var loginView = new LogInView(); loginView.DataContext = this.MainVm.LogInVm; _windowTitle = "Log in"; CurrentView = loginView; _windowHeight = 800; _windowWidth = 650; _windowState = WindowState.Normal; break; case "registerView": var registerView = new RegisterUserView(); registerView.DataContext = this.MainVm.RegisterVm; _windowTitle = "Log in"; CurrentView = registerView; _windowHeight = 1040; _windowWidth = 650; _windowState = WindowState.Normal; break; case "mechanicLoginView": var mechanicLoginView = new MechanicLoginView(); mechanicLoginView.DataContext = this.MainVm.MechanicLoginVm; _windowTitle = "Login"; CurrentView = mechanicLoginView; _windowHeight = 450; _windowWidth = 650; _windowState = WindowState.Normal; break; case "orderView": var orderView = new OrderView(); orderView.DataContext = this.MainVm.OrderVm; _windowTitle = " Order Material"; CurrentView = orderView; _windowHeight = 450; _windowWidth = 650; _windowState = WindowState.Maximized; break; case "partsView": var partsView = new PartsView(); partsView.DataContext = this.MainVm.PartsVm; _windowTitle = " Add new Part"; CurrentView = partsView; _windowHeight = 450; _windowWidth = 650; _windowState = WindowState.Maximized; break; //case "billView": // var billView = new BillView(); // billView.DataContext = this.MainVm.BillVm; // _windowTitle = "Bill"; // CurrentView = billView; // _windowHeight = 450; // _windowWidth = 650; // _windowState = WindowState.Normal; // break; //case "cartView": // var cartView = new CartView(); // cartView.DataContext = this.MainVm.CartVm; // _windowTitle = "Shopping Cart"; // CurrentView = cartView; // _windowHeight = 450; // _windowWidth = 650; // _windowState = WindowState.Normal; // break; //case "checkOutView": // var checkoutView = new CheckOutView(); // checkoutView.DataContext = this.MainVm.ChOutVm; // _windowTitle = "Check out"; // CurrentView = checkoutView; // _windowHeight = 300; // _windowWidth = 600; // _windowState = WindowState.Normal; // break; //case "storeVm": // var storeFrontView = new StoreFrontView(); // storeFrontView.DataContext = this.MainVm.SfVm; // _windowTitle = "Flowers"; // CurrentView = storeFrontView; // _windowHeight = 200; // _windowWidth = 250; // _windowState = WindowState.Normal; // break; //case "resultView": // var resultView = new ResultView(); // resultView.DataContext = this.MainVm.ResultVm; // _windowTitle = "Question Progress"; // CurrentView = resultView; // _windowHeight = 800; // _windowWidth = 850; // _windowState = WindowState.Maximized; // break; //case "examView": // var examView = new ExamView(); // examView.DataContext = this.MainVm.ExamVm; // _windowTitle = "Exam"; // CurrentView = examView; // _windowHeight = 200; // _windowWidth = 250; // _windowState = WindowState.Maximized; // break; //case "aboutView": // var aboutView = new AboutView(); // aboutView.DataContext = this.MainVm.AboutVm; // _windowTitle = "About Us"; // CurrentView = aboutView; // _windowHeight = 580; // _windowWidth = 900; // _windowState = WindowState.Normal; // break; //case "accountView": // var accountView = new AccountView(); // accountView.DataContext = this.MainVm.AccountVm; // _windowTitle = "Account"; // CurrentView = accountView; // _windowHeight = 800; // _windowWidth = 800; // _windowState = WindowState.Normal; // break; //case "fileImportView": // var fileimportView = new FileImportView(); // fileimportView.DataContext = this.MainVm.FileImportVm; // _windowTitle = "File Import"; // CurrentView = fileimportView; // _windowHeight = 600; // _windowWidth = 600; // _windowState = WindowState.Maximized; // break; //case "eulaView": // var eulaView = new EulaView(); // eulaView.DataContext = this.MainVm.EulaVm; // _windowTitle = "Eula"; // CurrentView = eulaView; // _windowHeight = 580; // _windowWidth = 900; // _windowState = WindowState.Maximized; // break; } ; if (CurrentView != null && _windowTitle != "") { BaseWindow = new Window { Title = _windowTitle, Content = CurrentView, Height = _windowHeight, Width = _windowWidth, WindowStyle = WindowStyle.None, ResizeMode = ResizeMode.NoResize, WindowStartupLocation = WindowStartupLocation.CenterScreen, WindowState = _windowState, }; } } catch (Exception ex) { Protocol.WriteToProtocol(0, "CreateBaseWindow() :" + ex.Message + ex.StackTrace, "Window Creation Error"); } return(BaseWindow); }
public LogInViewModel(LogInView logInOpen) { logInView = logInOpen; }
private void Grid_Loaded(object sender, RoutedEventArgs e) { DataContext = new LogInView(); }
public LogInViewModel(LogInView loginOpen) { loginView = loginOpen; loggedEmployee = new Employee(); }