public ProductorBEL Productor_Sel(int rut) { try { fru.WebServicePruebaSoapClient servicio = new fru.WebServicePruebaSoapClient(); DataSet custDS = new DataSet(); custDS = servicio.Productor_Sel(rut); if (custDS.Tables["PRODUCTORES"].Rows.Count > 0) { ProductorBEL productor_enc = new ProductorBEL(); productor_enc.Rut = Convert.ToInt32(custDS.Tables["PRODUCTORES"].Rows[0]["rut"].ToString()); productor_enc.Dv = Convert.ToChar(custDS.Tables["PRODUCTORES"].Rows[0]["dv"].ToString()); productor_enc.Nombre = custDS.Tables["PRODUCTORES"].Rows[0]["nombre"].ToString(); productor_enc.Apellido = custDS.Tables["PRODUCTORES"].Rows[0]["apellido"].ToString(); productor_enc.Sexo = Convert.ToChar(custDS.Tables["PRODUCTORES"].Rows[0]["sexo"].ToString()); productor_enc.Id_direccionparticular = Convert.ToInt32(custDS.Tables["PRODUCTORES"].Rows[0]["id_direccionparticular"]); productor_enc.Celular = Convert.ToInt32(custDS.Tables["PRODUCTORES"].Rows[0]["telefono"]); productor_enc.Correo = custDS.Tables["PRODUCTORES"].Rows[0]["correo"].ToString(); productor_enc.Id_direccionnegocio = Convert.ToInt32(custDS.Tables["PRODUCTORES"].Rows[0]["id_direccionnegocio"]); productor_enc.Mismadireccion = Convert.ToInt32(custDS.Tables["PRODUCTORES"].Rows[0]["mismadireccion"]); return(productor_enc); } return(null); } catch { return(null); } }
/// <summary> /// Guarda o Modifica el Evento con los datos ingresados por el usuario /// </summary> protected void btnGuardar_Click(object sender, EventArgs e) { String strFileName, strFileSave; UsuarioBEL usuario = (UsuarioBEL)Session["usuarioConectado"]; int rut = usuario.Rut; ProductorBEL proBEL = new ProductorBEL(); ProductorBLL proBLL = new ProductorBLL(); proBEL = proBLL.Productor_Sel(rut); ProductosBEL proBel = new ProductosBEL(); proBel.Rut_productor = proBEL.Rut; proBel.Id_tipo_producto = Int32.Parse(ddlTipo.SelectedItem.Value); if (chkOferta.Checked) { proBel.Oferta = 1; } else { proBel.Oferta = 0; } proBel.Descripcion_elaboracion = txtDescripcion.Text; proBel.Id_direccion = proBEL.Id_direccionnegocio; proBel.Zona_cultivo = txtZona.Text; proBel.Stock = Convert.ToInt32(txtStock.Text); proBel.Precio_unitario = Convert.ToInt32(txtPrecio.Text); proBel.Id_medida = Int32.Parse(ddlMedida.SelectedItem.Value); proBel.Id_tipo_cultivo = Int32.Parse(ddlCultivo.SelectedItem.Value); proBel.Activo = 1; ProductosBLL proBll = new ProductosBLL(); int id = proBll.agregarProductos(proBel); if (validaImagen(subirImagen.PostedFile.FileName)) { strFileName = System.IO.Path.GetFileName(subirImagen.PostedFile.FileName); String strFolderSave = Server.MapPath("../img/Productos/"); strFileSave = "/img/Productos/" + strFileName; ImagenesBEL imaBEL = new ImagenesBEL(); imaBEL.Id_producto = id; imaBEL.Nombre = txtNombre.Text; imaBEL.Descripcion = txtDescripcionI.Text; imaBEL.Orden = Convert.ToInt32(txtOrden.Text); imaBEL.Fecha = DateTime.Today; imaBEL.Ubicacion = strFileSave; subirImagen.PostedFile.SaveAs(strFolderSave + strFileName); ImagenesBLL imaBLL = new ImagenesBLL(); imaBLL.agregarImagenes(imaBEL); } /// <summary> /// Agrega el evento /// </summary> EventoBLL evBLL = new EventoBLL(); if (lblTitulo.Text.Equals("Agregar evento")) { // int idEvento = evBLL.agregarEvento(evBEL); //if (idEvento == -1) return; /*** se Agregan Los Asientos ***/ // this.guardarAsiento(idEvento); /***** Fin Agrega Asientos ******/ /*** se Agregan Los Precios ***/ // this.guardarPrecio(idEvento); /***** Fin Agrega Precios ******/ Response.Write("<script>alert('Se agregó correctamente');window.location='Eventos.aspx';</script></script>"); } /// <summary> /// Modifica el evento /// </summary> else { // evBEL.IdEvento = Int32.Parse(idEvento.Text); //evBLL.actualizarEvento(evBEL); Response.Write("<script>alert('Se Editó correctamente');window.location='Eventos.aspx';</script></script>"); } }
public void registroProductor(ProductorBEL productor) { fru.WebServicePruebaSoapClient servicio = new fru.WebServicePruebaSoapClient(); servicio.Productor_Ins(productor.Rut, productor.Dv, productor.Nombre, productor.Apellido, productor.Sexo, productor.Id_direccionparticular, productor.Celular, productor.Correo, productor.Id_direccionnegocio, productor.Mismadireccion); }
/// <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); }