Exemplo n.º 1
0
        /// <summary>
        /// José Oñate::
        /// Separación del método registrar para generar mayor orden visual
        /// </summary>
        private void registrar()
        {
            String[] separadorRut = txtRut.Text.Split('-');

            UsuarioBEL usuBEL = new UsuarioBEL();

            usuBEL.Rut          = Int32.Parse(separadorRut[0]);
            usuBEL.Contrasena   = txtContrasena.Text;
            usuBEL.IdTipoPerfil = 1;

            PerfilBLL perBLL = new PerfilBLL();

            perBLL.agregarUsuario(usuBEL);

            DireccionBEL direccionBEL = new DireccionBEL();

            direccionBEL.Nombre    = txtDireccion.Text;
            direccionBEL.Numero    = Int32.Parse(txtnumero.Text);
            direccionBEL.Id_comuna = Int32.Parse(ddlComuna.SelectedItem.Value);

            DireccionBLL direccionBLL = new DireccionBLL();
            int          id_direccion = direccionBLL.agregarDireccion(direccionBEL);

            ClienteBEL clienteBEL = new ClienteBEL();

            clienteBEL.Rut      = Int32.Parse(separadorRut[0]);
            clienteBEL.Dv       = Char.Parse(separadorRut[1]);
            clienteBEL.Nombre   = txtNombre.Text;
            clienteBEL.Apellido = txtApellidos.Text;
            if (rblSexo.SelectedItem.Text == "Masculino")
            {
                clienteBEL.Sexo = Char.Parse(rblSexo.SelectedItem.Value);
            }
            else
            {
                clienteBEL.Sexo = Char.Parse(rblSexo.SelectedItem.Value);
            }
            clienteBEL.Correo = txtCorreo.Text;
            if (chbCell.Checked)
            {
                clienteBEL.Celular = Int32.Parse(txtCell.Text);
            }
            else
            {
                clienteBEL.Celular = Int32.Parse(txtTelefono.Text);
            }
            clienteBEL.Bloqueado = 0;

            ClienteBLL clienteBLL = new ClienteBLL();

            clienteBLL.registroCliente(clienteBEL);

            UsuarioPerfilesBEL usuperBEL = new UsuarioPerfilesBEL();

            usuperBEL.Rut            = Int32.Parse(separadorRut[0]);
            usuperBEL.Id_tipo_perfil = 1;

            UsuarioPerfilesBLL usuperBLL = new UsuarioPerfilesBLL();

            usuperBLL.agregarUsuarioPerfiles(usuperBEL);

            ClienteDireccionesBEL clidirBEL = new ClienteDireccionesBEL();

            clidirBEL.Rut_cliente  = Int32.Parse(separadorRut[0]);;
            clidirBEL.Id_direccion = id_direccion;
            clidirBEL.Primaria     = 'S';

            ClienteDireccionesBLL clidirBLL = new ClienteDireccionesBLL();

            clidirBLL.agregarUsuarioDirecciones(clidirBEL);
        }
Exemplo n.º 2
0
        /// <summary>
        /// José Oñate::
        /// Método para validar selección de al menos 1 interés.
        /// </summary>
        /// <returns></returns>

        /*private bool selInteres()
         * {
         *  bool selecciona = false;
         *  int contador = 0;
         *
         *  foreach (ListItem item in chkIntereses.Items)
         *  {
         *      if (item.Selected) contador++;
         *  }
         *
         *  if (contador != 0) selecciona = true;
         *
         *  return selecciona;
         * }*/

        /// <summary>
        /// José Oñate::
        /// Separación del método registrar para generar mayor orden visual
        /// </summary>
        private void registrar()
        {
            String[] separadorRut = txtRut.Text.Split('-');

            /*ProductorHabilitadoBLL prohabBLL = new ProductorHabilitadoBLL();
            *  ProductorHabilitadoBEL prohab = prohabBLL.Productor_Habilitados_Sel(Int32.Parse(separadorRut[0]));
            *
            *  if (prohab.Rut != -1)
            *  {
            *   txtApellidos.Text = prohab.Apellido;
            *   txtNombre.Text = prohab.Nombre;
            *
            *  }
            *
            *
            *  ProductorHabilitadoBEL prohabBEL = new ProductorHabilitadoBEL();*/



            UsuarioBEL usuBEL = new UsuarioBEL();

            usuBEL.Rut          = Int32.Parse(separadorRut[0]);
            usuBEL.Contrasena   = txtContrasena.Text;
            usuBEL.IdTipoPerfil = 2;

            PerfilBLL perBLL = new PerfilBLL();

            perBLL.agregarUsuario(usuBEL);

            DireccionBEL direccionBEL = new DireccionBEL();

            direccionBEL.Nombre    = txtDireccion.Text;
            direccionBEL.Numero    = Int32.Parse(txtnumero.Text);
            direccionBEL.Id_comuna = Int32.Parse(ddlComuna.SelectedItem.Value);

            DireccionBLL direccionBLL = new DireccionBLL();
            int          id_direccion = direccionBLL.agregarDireccion(direccionBEL);

            if (chkNegocio.Checked)
            {
                DireccionBEL direccionNegBEL = new DireccionBEL();

                direccionNegBEL.Nombre    = txtDireccionNegocio.Text;
                direccionNegBEL.Numero    = Int32.Parse(txtNumeroNegocio.Text);
                direccionNegBEL.Id_comuna = Int32.Parse(ddlComunaNegocio.SelectedItem.Value);

                DireccionBLL direccionNegBLL = new DireccionBLL();
                int          id_direccionNeg = direccionNegBLL.agregarDireccion(direccionNegBEL);

                ProductorBEL productorBEL = new ProductorBEL();

                productorBEL.Rut      = Int32.Parse(separadorRut[0]);
                productorBEL.Dv       = Char.Parse(separadorRut[1]);
                productorBEL.Nombre   = txtNombre.Text;
                productorBEL.Apellido = txtApellidos.Text;
                productorBEL.Sexo     = Char.Parse(txtSexo.Text);
                productorBEL.Id_direccionparticular = id_direccion;
                if (chbCell.Checked)
                {
                    productorBEL.Celular = Int32.Parse(txtCell.Text);
                }
                else
                {
                    productorBEL.Celular = Int32.Parse(txtTelefono.Text);
                }
                productorBEL.Correo = txtCorreo.Text;
                productorBEL.Id_direccionnegocio = id_direccionNeg;
                productorBEL.Mismadireccion      = 0;


                ProductorBLL productorBLL = new ProductorBLL();
                productorBLL.registroProductor(productorBEL);
            }
            else
            {
                ProductorBEL productorBEL = new ProductorBEL();

                productorBEL.Rut      = Int32.Parse(separadorRut[0]);
                productorBEL.Dv       = Char.Parse(separadorRut[1]);
                productorBEL.Nombre   = txtNombre.Text;
                productorBEL.Apellido = txtApellidos.Text;
                productorBEL.Sexo     = Char.Parse(txtSexo.Text);
                productorBEL.Id_direccionparticular = id_direccion;
                if (chbCell.Checked)
                {
                    productorBEL.Celular = Int32.Parse(txtCell.Text);
                }
                else
                {
                    productorBEL.Celular = Int32.Parse(txtTelefono.Text);
                }
                productorBEL.Correo = txtCorreo.Text;
                productorBEL.Id_direccionnegocio = id_direccion;
                productorBEL.Mismadireccion      = 1;

                ProductorBLL productorBLL = new ProductorBLL();
                productorBLL.registroProductor(productorBEL);
            }

            UsuarioPerfilesBEL usuperBEL = new UsuarioPerfilesBEL();

            usuperBEL.Rut            = Int32.Parse(separadorRut[0]);
            usuperBEL.Id_tipo_perfil = 1;

            UsuarioPerfilesBLL usuperBLL = new UsuarioPerfilesBLL();

            usuperBLL.agregarUsuarioPerfiles(usuperBEL);
        }