示例#1
0
        private void LoginButton_Click(object sender, EventArgs e)
        {
            //connection.Open();
            AuthenticationPresenter authenticationPresenter = new AuthenticationPresenter(this, this);
            bool LoginSuccessfully = authenticationPresenter.Login();

            if (LoginSuccessfully)
            {
                int   userid   = authenticationPresenter.GetUserId();
                FMain objFMain = new FMain(userid);
                this.Hide();
                objFMain.Show();
            }
            else
            {
                WrongDataErrorLabel.Text = "*wrong login or password. If you have not registered yet, click Sign Up button.";
                LoginTextBox.Text        = String.Empty;
                PasswordTextBox.Text     = String.Empty;

                LoginPanel2.BackColor  = Color.WhiteSmoke;
                LoginPanel1.BackColor  = Color.WhiteSmoke;
                LoginTextBox.ForeColor = Color.WhiteSmoke;

                PasswordPanel1.BackColor  = Color.WhiteSmoke;
                PasswordPanel2.BackColor  = Color.WhiteSmoke;
                PasswordTextBox.ForeColor = Color.WhiteSmoke;
            }
            //connection.Close();
        }
 public bool RunAuthentication(string Imei)
 {
     using (var view = new VwAuthentication())
     {
         IAuthenticationPresenter presenter = new AuthenticationPresenter(view, this, _loggedInId, _username, Imei);
         presenter.Run();
         if (presenter.isCancelled())
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
    public void ApplicationMainPresenterSetUp()
    {
        Mock <IAuthenticationView> authView = new Mock <IAuthenticationView>(MockBehavior.Strict);

        authView.SetupProperty(v => v.ErrorMessage);
        authView.SetupGet(v => v.Instance).Returns(RandomValues.RandomString());
        authView.SetupGet(v => v.Login).Returns(RandomValues.RandomString());
        authView.SetupGet(v => v.Password).Returns(RandomValues.RandomString());
        authView.Setup(v => v.CloseView());
        authView.Setup(v => v.SetTitle(It.IsAny <string>()));
        authView.Setup(v => v.ShowView()).Raises(v => v.OnConnect += null).Verifiable();
        Mock <IMembershipService> authService = new Mock <IMembershipService>(MockBehavior.Loose);

        authService.Setup(s => s.AuthenticateUser(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true);
        IAuthenticationPresenter authPresenter = new AuthenticationPresenter(authView.Object, authService.Object);

        ApplicationView = new ApplicationForm();
        Presenter       = new ApplicationPresenter(ApplicationView, authPresenter);
    }
示例#4
0
        /// <summary>
        /// If ok send you to main Window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NextButton_Click(object sender, EventArgs e)
        {
            //bool DataIsOk = true;

            AuthenticationPresenter authenticationPresenter = new AuthenticationPresenter(this, this);
            ErrorLabelPresenter     errorLabelPresenter     = new ErrorLabelPresenter(this, this);
            bool result1 = errorLabelPresenter.CheckIsDataOk(this);
            bool result2 = errorLabelPresenter.CheckIsDuplicates(this);

            if (result1 && result2)
            {
                authenticationPresenter.Registration();
                int userid = authenticationPresenter.GetUserId();


                FMain fMain = new FMain(userid);
                this.Hide();
                fMain.Show();
            }
        }
示例#5
0
        internal static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var applicationContext = new ApplicationContext();

            var source              = new XMLService();
            var loginService        = new LoginService(source);
            var registrationService = new RegistrationService(loginService, source);
            var mainService         = new UserListService(source);

            var authenticationView = new AuthenticationView(applicationContext);
            var registrationView   = new RegistrationView(applicationContext);
            var mainView           = new MainView(applicationContext);

            var mainPresenter           = new MainPresenter(mainView, mainService);
            var registrationPresenter   = new RegistrationPresenter(registrationView, registrationService);
            var authenticationPresenter = new AuthenticationPresenter(loginService, authenticationView, mainPresenter, registrationPresenter);

            authenticationPresenter.Run();
        }
示例#6
0
        internal static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Database.Initialisation();
            ApplicationContext    applicationContext        = new ApplicationContext();
            Authentication        authentication            = new Authentication(applicationContext);
            AuthenticationService authenticationService     = new AuthenticationService();
            Registration          registration              = new Registration();
            RegisterService       registerService           = new RegisterService();
            UserList                userList                = new UserList(applicationContext, registration, authentication);
            UserPresenter           userPresenter           = new UserPresenter(userList);
            FactoryThePresenters    factoryThePresenters    = new FactoryThePresenters(registration, userList, registerService);
            AuthenticationPresenter authenticationPresenter = new AuthenticationPresenter(authentication, factoryThePresenters, authenticationService);

            authentication.PasswordPicture           = Resources.Incorrect;
            authentication.UsernamePicture           = Resources.Incorrect;
            registration.PasswordSetPicture          = Resources.Incorrect;
            registration.UsernameSetPicture          = Resources.Incorrect;
            registration.ConfirmedPasswordSetPicture = Resources.Incorrect;

            authenticationPresenter.Run();
        }
示例#7
0
        public void Run()
        {
            AuthenticationPresenter presenter = container.Value.Get <AuthenticationPresenter>();

            presenter.Run();
        }