private void BtnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string          senha;
                bool            authen;
                var             listUsuario = new List <TblUsuarioModel>();
                string          senhabanco;
                Descrypt        descrypt     = new Descrypt();
                TblUsuarioModel usuarioModel = new TblUsuarioModel();
                listUsuario = usuarioModel.GetSelectUser(txtPassword.Text);
                senhabanco  = listUsuario[0].dePassword;
                senha       = Descrypt.RetornarMD5(txtPassword.Text);
                authen      = descrypt.ComparaMD5(senhabanco, senha);

                if (authen)
                {
                    Hide();
                    FrmMenu frm = new FrmMenu();
                    frm.ShowDialog();
                    Close();
                }
                else
                {
                    MessageBox.Show("Usuário ou senha inválida", "Sistema ABC");
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Sistema ABC");
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            string senha;

            if (txtUsuario.Text != string.Empty && txtNome.Text != string.Empty && txtCpf.Text != string.Empty && txtCnh.Text != string.Empty && txtRg.Text != string.Empty && txtSenha.Text != string.Empty && txtConfSenha.Text != string.Empty)
            {
                if (!ValidaDigitoCPF.ValidaCPF(txtCpf.Text))
                {
                    MessageBox.Show("Cpf digitado é invávlido!", "Sistema ABC");
                    return;
                }

                if (!ValidaCNH.ValidacaoCNH(txtCnh.Text))
                {
                    MessageBox.Show("CNH digitado é invávlido!", "Sistema ABC");
                    return;
                }

                if (txtSenha.Text != txtConfSenha.Text)
                {
                    MessageBox.Show("Senha digitadas estão incorretas!", "Sistema ABC");
                    return;
                }
                else
                {
                    senha = Descrypt.RetornarMD5(txtConfSenha.Text);
                }
            }
            else
            {
                MessageBox.Show("Todos os campos são obrigatorios, preencha de forma correta.", "Sistema ABC");
                return;
            }


            entityRole = (EntityRole)Enum.Parse(typeof(EntityRole), cmbRole.Text);

            string[] enderecoArray = cmbEndereco.Text.Split(',');
            string   endereco      = enderecoArray[0];

            TblUsuarioModel usuarioModel = new TblUsuarioModel(txtUsuario.Text, txtNome.Text, txtCpf.Text, txtRg.Text, txtCnh.Text, senha, txtEmail.Text, entityRole, int.Parse(endereco), true)
            {
                State = EntityState.Add
            };

            MessageBox.Show(usuarioModel.saveChange(), "Sistema ABC", MessageBoxButtons.OKCancel);
        }