예제 #1
0
        /* public static bool ExisteUsuario(Convert.ToString(IDUsuario))
         * {
         *   return adapter.ExisteUsuario((IDUsuario)) == 1;
         * }*/

        public static string NuevoCliente(string Nombre, string Apellido, string Correo, string Contrasena)
        {
            int aux = adapter.Insert(Nombre, Apellido, Correo, Contrasena);

            if (aux == 0)
            {
                return("No se pudo insertar el registro");
            }
            else
            {
                return("Registro Insertado Correctamente");
            }
        }
예제 #2
0
 private void btnCadastrar_Click(object sender, EventArgs e)
 {
     if (txtSenha.Text == txtRepitaSenha.Text)
     {
         UsuarioTableAdapter taPessoa = new UsuarioTableAdapter();
         taPessoa.Insert(txtUsuario.Text.ToLower(), txtEmail.Text.ToLower(), txtSenha.Text.ToLower());
         MessageBox.Show("Usuário Cadastrado com sucesso!");
         txtEmail.Text       = "";
         txtRepitaSenha.Text = "";
         txtSenha.Text       = "";
         txtUsuario.Text     = "";
     }
     else
     {
         MessageBox.Show("Senhas diferentes! /n Tente Novamente!");
     }
 }
예제 #3
0
        public static int InsertUser(Usuario obj)
        {
            int?idUsuario = 0;

            if (obj == null)
            {
                throw new ArgumentException("El usuario no debe ser nulo");
            }

            UsuarioTableAdapter adapter = new UsuarioTableAdapter();

            adapter.Insert(obj.NombreCompleto, obj.Email, obj.Password, obj.Telefono, obj.Direccion, ref idUsuario);
            if (idUsuario == 0)
            {
                throw new ArgumentException("Error al insertar un nuevo usuario");
            }

            return(idUsuario.Value);
        }