Esempio n. 1
0
        private void button_Cadastrar_Click(object sender, EventArgs e)
        {
            string cad_Name  = textB_nome.Text;
            long   cad_CPF   = long.Parse(textB_cpf.Text);
            string cad_email = textB_email.Text;
            string cad_senha = textB_senha.Text;

            User user = new User();

            user.Nome  = cad_Name;
            user.Email = cad_email;
            user.Senha = cad_senha;
            user.Cpf   = cad_CPF;
            user.Ativo = true;
            UserList.userAdd(user);

            MessageBox.Show("Usuário Cadastrado com sucesso!");

            //this.Dispose();
            this.Close();
        }
Esempio n. 2
0
        static void Main()
        {
            //carregando o xml
            XmlLi xmlli = new XmlLi();
            User  user  = new User();

            //salvando os itens na lista
            foreach (var item in xmlli.select())
            {
                user.Nome  = item[1];
                user.Email = item[2];
                user.Senha = item[3];
                user.Cpf   = long.Parse(item[4]);
                user.Ativo = bool.Parse(item[5]);
                UserList.userAdd(user);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormPrincipal());
        }
Esempio n. 3
0
        private void button_Cadastrar_Click(object sender, EventArgs e)
        {
            string cad_Name  = textB_nome.Text;
            long   cad_CPF   = long.Parse(textB_cpf.Text);
            string cad_email = textB_email.Text;
            string cad_senha = textB_senha.Text;
            bool   vCpf      = true;
            bool   vEmail    = true;



            foreach (var item in UserList.selectAll())
            {
                if (item.Cpf == cad_CPF)
                {
                    vCpf = false;
                }

                if (item.Email == cad_email)
                {
                    vEmail = false;
                }
            }

            if (vCpf)
            {
                if (vEmail)
                {
                    if (Validation.Cpf(cad_CPF))
                    {
                        if (Validation.Email(cad_email))
                        {
                            User user = new User();
                            user.Nome  = cad_Name;
                            user.Email = cad_email;
                            user.Senha = cad_senha;
                            user.Cpf   = cad_CPF;
                            user.Ativo = true;
                            UserList.userAdd(user);
                            MessageBox.Show("Usuário Cadastrado com sucesso!");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Email inválido");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Cpf inválido");
                    }
                }
                else
                {
                    MessageBox.Show("Email já cadastrado no sistema!");
                }
            }
            else
            {
                MessageBox.Show("Cpf já cadastrado no sistema!");
            }
            //this.Dispose();
        }