private void btnAvancar_Click(object sender, EventArgs e)
        {
            if (tabWizard.SelectedIndex == 2)
            {
                if (!Validacoes())
                    return;
                else
                {
                    try
                    {
                        UsuarioVO u = new UsuarioVO();

                        u.SetId(Metodos.GeraId("select top 1 idUserDev from UserDev order by idUserDev desc"));

                        if (rbUsuario.Checked)
                            u.SetTipoCadastro('U');
                        else
                            u.SetTipoCadastro('D');

                        u.SetNome(txtNome.Text.Trim() + " " + txtSobrenome.Text.Trim());
                        u.SetNascimento(Convert.ToDateTime(txtNascimento.Text.Trim()));
                        u.SetUsuario(txtUsuario.Text.Trim());
                        u.SetSenha(txtSenha.Text.Trim());
                        u.SetEmail(txtEmail.Text.Trim());

                        string extensao = "";

                        if (txtFoto.Text.Trim() != "padrão")
                        {
                            extensao = Metodos.CopiarFotoUser(u.GetId(), txtFoto.Text);
                            extensao = extensao.Substring(extensao.LastIndexOf('.'));
                        }
                        else
                            extensao = "padrão";

                        u.SetCaminhoDoArquivo(extensao);

                        UsuarioDAO.InserirUsuario(u);
                        tabWizard.SelectedIndex = 3;
                    }
                    catch (Exception erro)
                    {
                        string err = erro.Message.ToString();
                        Metodos.Mensagem("Ocorreu um erro ao adicionar os dados:" + Environment.NewLine + err, Metodos.TipoMensagem.erro);
                        tabWizard.SelectedIndex = 4;
                    }
                }
            }

            if (tabWizard.SelectedIndex != 3 && tabWizard.SelectedIndex != 4)
                tabWizard.SelectedIndex += 1;

            VerificaQualPagina();
        }
Пример #2
0
        public static UsuarioVO MontaUsuarioVO(DataRow linha)
        {
            UsuarioVO u = new UsuarioVO();
            u.SetId(Convert.ToInt32(linha["idUserDev"]));
            u.SetTipoCadastro(Convert.ToChar(linha["tipoCadastro"]));
            u.SetNome(linha["nomeUserDev"].ToString());
            u.SetNascimento(Convert.ToDateTime(linha["nascimento"]));
            u.SetUsuario(linha["username"].ToString());
            u.SetSenha(linha["senha"].ToString());
            u.SetEmail(linha["email"].ToString());
            u.SetCaminhoDoArquivo(linha["caminhoDaFoto"].ToString());

            return u;
        }