Beispiel #1
0
        public User Login(IUserRepository UserRepository, ILoginView LoginView, IMainFormController MainController)
        {
            string Username = LoginView.GetUsername();
            string Password = LoginView.GetPassword();

            if (Username.Length == 0 || Password.Length == 0)
            {
                MessageBox.Show("Niste unijeli korisničko ime/lozinku");
                return(null);
            }
            var frm = (Form)LoginView;

            Walker Walker = UserRepository.GetWalker(Username, Password);

            if (Walker != null)
            {
                frm.Hide();
                frm.ShowInTaskbar = false;
                return(Walker);
            }

            Owner Owner = UserRepository.GetOwner(Username, Password);

            if (Owner != null)
            {
                frm.Hide();
                frm.ShowInTaskbar = false;
                return(Owner);
            }

            MessageBox.Show("Netočno korisničko ime ili lozinka");
            return(null);
        }
Beispiel #2
0
        public void LogIn(object sender, EventArgs e)
        {
            if (_view.GetLogin().Replace(" ", "").Length == 0 || _view.GetPassword().Replace(" ", "").Length == 0)
            {
                _view.ShowEmpty();
                return;
            }

            if (_model.Authorization(_view.GetLogin(), _view.GetPassword()))
            {
                Global.Login = _view.GetLogin();
                _view.Close();
            }
            else
            {
                _view.ShowError();
            }
        }
Beispiel #3
0
 public void Login()
 {
     userLoginView.ShowLoading();
     User.Login(userLoginView.GetUserName(), userLoginView.GetPassword(), this);
 }