예제 #1
0
        public void SignIn()
        {
            if (!EmailValidator.Validate())
            {
                return;
            }

            Guest guest;

            try {
                guest = Business.Guest(new Email(email.Text));
                EmailValidator.ResetError();
            } catch (InexistentEmailException ex) {
                EmailValidator.SetError(ex.Message);
                return;
            }

            if (!PasswordValidator.Validate())
            {
                return;
            }

            try {
                GuestSession.SignIn(guest, password.Password);
                PasswordValidator.ResetError();
                Frame.Navigate(new GuestPage(Business, GuestSession, Frame));
            } catch (WrongPasswordException ex) {
                PasswordValidator.SetError(ex.Message);
            }
        }
예제 #2
0
        public void SignIn()
        {
            if (!EmailValidator.Validate())
            {
                return;
            }

            Admin admin;

            try {
                admin = Business.Admin(new Email(email.Text));
                EmailValidator.ResetError();
            } catch (InexistentEmailException ex) {
                EmailValidator.SetError(ex.Message);
                return;
            }

            if (!PasswordValidator.Validate())
            {
                return;
            }

            try {
                AdminSession.SignIn(admin, password.Password);
                PasswordValidator.ResetError();
                Frame.Navigate(new AdminPage(Business, Frame));
            } catch (WrongPasswordException ex) {
                PasswordValidator.SetError(ex.Message);
            }
        }