示例#1
0
        private void button4_Click(object sender, EventArgs e)
        {
            FrmPerfilUsuario frmPerfil = new FrmPerfilUsuario();

            frmPerfil.Show();
            this.Hide();
        }
示例#2
0
        private void BTcadastrar_Click(object sender, EventArgs e)
        {
            Cadastro usuario = new Cadastro();

            usuario.Nome_Usuario = txtNome.Text;
            usuario.Idade        = txtIdade.Text;
            usuario.Senha        = txtSenha.Text;
            usuario.ConfSenha    = txtConfSenha.Text;


            if (radioBF.Checked == true)
            {
                usuario.Sexo = "F";
            }
            else if (radioBM.Checked == true)
            {
                usuario.Sexo = "M";
            }

            if (txtNome.Text == "" || txtIdade.Text == "" || txtSenha.Text == "" || txtConfSenha.Text == "" || radioBF.Checked == false & radioBM.Checked == false)
            {
                string erro = "Preencha o campo em branco!";
                MessageBox.Show(erro);
                txtIdade.Clear();
            }
            else
            {
                if (txtConfSenha.Text == txtSenha.Text)
                {
                    UsuarioNegocio usuarioNegocio = new UsuarioNegocio();

                    if (tipoDaAcaoGlobal == TipoDaAcao.Inserir)
                    {
                        string retorno = usuarioNegocio.CadastroInserir(usuario);

                        try
                        {
                            // int num = Convert.ToInt32(retorno);
                            MessageBox.Show("Registro inserido com sucesso!", "Inserir registro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                            this.DialogResult = System.Windows.Forms.DialogResult.Yes;

                            FrmPerfilUsuario frmPerfil = new FrmPerfilUsuario();
                            this.Hide();
                            frmPerfil.Show();
                        }
                        catch
                        {
                            MessageBox.Show("Erro ao inserir o registro! \n", "Inserir registro", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            this.DialogResult = System.Windows.Forms.DialogResult.No;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Senhas não correspondem, Digite Novamente");
                }
            }
        }
        private void btEntrar_Click(object sender, EventArgs e)
        {
            // CRIAR O LOGAR
            FrmPerfilUsuario frmPerfilUsuario = new FrmPerfilUsuario();

            this.Hide();
            frmPerfilUsuario.ShowDialog();
        }