Exemplo n.º 1
0
        private void btb_Cadastro_Click(object sender, EventArgs e)
        {
            string email          = txt_Email.Text;
            string nome           = txt_Nome.Text;
            char   sexo           = Convert.ToChar(cb_sexo.Text);
            string senha          = txt_Senha.Text;
            string confirmarSenha = txt_ConfirmarSenha.Text;
            bool   dataNascimento = DateTime.TryParse(mask_dataNascimento.Text, out DateTime result);


            if (senha == confirmarSenha && senha != null)
            {
                if (sexo == 'M' || sexo == 'F')
                {
                    Usuario user = new Usuario()
                    {
                        Email          = email,
                        Nome           = nome,
                        Senha          = senha,
                        Sexo           = sexo,
                        DataNascimento = dataNascimento == true ? result : DateTime.Parse("01/01/0001")
                    };

                    Consultas app      = new Consultas();
                    var       cadastro = app.Cadastrar(user);

                    if (cadastro == true)
                    {
                        form_AppHome form = new form_AppHome();
                        form.Show();
                    }
                    //else
                    //{
                    //    MessageBox.Show("Login inválido, Revise os dados", "Cadastro");
                    //}
                }
                else
                {
                    MessageBox.Show("Selecione o seu Sexo", "Cadastro");
                }
            }
            else
            {
                MessageBox.Show("As senhas devem ser iguais", "Cadastro");
            }
        }
Exemplo n.º 2
0
        private void btn_Entrar_Click(object sender, EventArgs e)
        {
            Consultas app = new Consultas();

            string email = txt_email.Text;
            string senha = txt_senha.Text;

            if (app.Login(email, senha) == true)
            {
                MessageBox.Show("Login realizado com sucesso", "Login");
                form_AppHome form = new form_AppHome();
                form.Show();
            }
            else
            {
                MessageBox.Show("Não foi possível realizar o Login", "Erro Login");
            }
        }
Exemplo n.º 3
0
        private void btn_Home_Click(object sender, EventArgs e)
        {
            form_AppHome form = new form_AppHome();

            form.Show();
        }