public int agregarProductos(ProductosBEL proBel) { fru.WebServicePruebaSoapClient servicio = new fru.WebServicePruebaSoapClient(); int id = servicio.Productos_Ins(proBel.Rut_productor, proBel.Id_tipo_producto, proBel.Oferta, proBel.Descripcion_elaboracion, proBel.Id_direccion, proBel.Zona_cultivo, proBel.Stock, proBel.Precio_unitario, proBel.Id_medida, proBel.Id_tipo_cultivo, proBel.Activo); return(id); }
/// <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>"); } }