コード例 #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);
        }