Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Code_Error.Visibility  = Visibility.Hidden;
            Email_Error.Visibility = Visibility.Hidden;

            String email = EmailTextBox.Text;
            String code  = CodeTextBox.Password.ToString();

            User u = db.loadUser(email, code);

            if (u != null)
            {
                if (u != null)
                {
                    if (u.getCode().Substring(0, 2).Equals("99"))
                    {
                        Profissional next = new Profissional(u);
                        this.NavigationService.Navigate(next);
                    }
                    else
                    {
                        Pacient next = new Pacient(u);
                        this.NavigationService.Navigate(next);
                    }
                }
            }
            else
            {
                Code_Error.Visibility  = Visibility.Visible;
                Email_Error.Visibility = Visibility.Visible;
            }
        }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Email_Error.Visibility = Visibility.Hidden;
            Code_Error.Visibility  = Visibility.Hidden;

            DateTime?date = DataNascimento.SelectedDate;

            if (date == null)
            {
                return;
            }

            String Name     = NameTextBox.Text;
            String Code     = CodeTextBox.Text;
            String Email    = EmailTextBox.Text;
            String NIF      = NIFTextBox.Text;
            String password = PasswordTextBox.Password;

            try
            {
                String dateStr = date.Value.ToString("MM/dd/yyyy");

                User novo = new User(Name, Code, Email, dateStr, NIF);
                db.insertUser(novo, password);

                Pacient p = new Pacient(novo);
                this.NavigationService.Navigate(p);
            }
            catch (SqlException ex)
            {
                Console.WriteLine(ex.Message);
                Email_Error.Visibility = Visibility.Visible;
                Code_Error.Visibility  = Visibility.Visible;
            }
        }
Ejemplo n.º 3
0
        public void GoToPaciente(object sender, MouseButtonEventArgs e)
        {
            Pacient paciente = new Pacient(this.user);

            this.NavigationService.Navigate(paciente);
        }