public ReducirStock(DataGridView productoSelected) { InitializeComponent(); string id = productoSelected.SelectedRows[0].Cells[0].Value.ToString(); //obtengo el stock del producto que quiere reducir el stock producto = new ProductoCEN(); p = producto.ObtenerProducto(id); stockProducto = p.Stock; }
public GenerarInforme(string id) { InitializeComponent(); ProductoCEN productoCEN = new ProductoCEN(); producto = productoCEN.ObtenerProducto(id); desactivarCampos(); pintarCabeceraEmpresa(); pintarDatosProducto(); }
public void Editar(string p_oid, string p_nombre, string p_descripcion, int p_stock, string p_foto) { ProductoEN productoEN = null; //Initialized ProductoEN productoEN = new ProductoEN (); productoEN.Id = p_oid; productoEN.Nombre = p_nombre; productoEN.Descripcion = p_descripcion; productoEN.Stock = p_stock; productoEN.Foto = p_foto; //Call to ProductoCAD _IProductoCAD.Editar (productoEN); }
public string Crear(string p_id, string p_nombre, string p_descripcion, int p_stock, string p_foto) { ProductoEN productoEN = null; string oid; //Initialized ProductoEN productoEN = new ProductoEN (); productoEN.Id = p_id; productoEN.Nombre = p_nombre; productoEN.Descripcion = p_descripcion; productoEN.Stock = p_stock; productoEN.Foto = p_foto; //Call to ProductoCAD oid = _IProductoCAD.Crear (productoEN); return oid; }
public ProductoEN(ProductoEN producto) { this.init (producto.Id, producto.Nombre, producto.Descripcion, producto.Stock, producto.Foto, producto.Linea); }
public string Crear(ProductoEN producto) { try { SessionInitializeTransaction (); session.Save (producto); SessionCommit (); } catch (Exception ex) { SessionRollBack (); if (ex is PalmeralGenNHibernate.Exceptions.ModelException) throw ex; throw new PalmeralGenNHibernate.Exceptions.DataLayerException ("Error in ProductoCAD.", ex); } finally { SessionClose (); } return producto.Id; }
public void Editar(ProductoEN producto) { try { SessionInitializeTransaction (); ProductoEN productoEN = (ProductoEN)session.Load (typeof(ProductoEN), producto.Id); productoEN.Nombre = producto.Nombre; productoEN.Descripcion = producto.Descripcion; productoEN.Stock = producto.Stock; productoEN.Foto = producto.Foto; session.Update (productoEN); SessionCommit (); } catch (Exception ex) { SessionRollBack (); if (ex is PalmeralGenNHibernate.Exceptions.ModelException) throw ex; throw new PalmeralGenNHibernate.Exceptions.DataLayerException ("Error in ProductoCAD.", ex); } finally { SessionClose (); } }
public void pdfProducto(ProductoEN producto) { Document document; document = new Document(PageSize.A4, 25, 25, 30, 30); string path = @"" + "Producto " + producto.Id + ".pdf"; FileStream fs = new FileStream(path, FileMode.OpenOrCreate); // Create an instance to the PDF file by creating an instance of the PDF // Writer class using the document and the filestrem in the constructor. PdfWriter writer = PdfWriter.GetInstance(document, fs); // Open the document to enable you to write to the document document.Open(); // Creo cabecera del informe PdfPTable tableTitulo = new PdfPTable(2); tableTitulo.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; PdfPCell cell = new PdfPCell(new Phrase("Informe de Producto")); cell.BorderWidth = 0; cell.Colspan = 3; cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right tableTitulo.AddCell(cell); document.Add(tableTitulo); PdfPTable tableCabecera = new PdfPTable(2); //Tabla sin bordes tableCabecera.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; //Cargamos la imagen de resources. System.Drawing.Image logores = Properties.Resources.logo; iTextSharp.text.Image logo = iTextSharp.text.Image.GetInstance(logores, System.Drawing.Imaging.ImageFormat.Jpeg); //Añado imagen a la cabecera y fecha. logo.ScaleAbsolute(100f, 100f); PdfPCell cellLogo = new PdfPCell(logo); cellLogo.BorderWidth = 0; tableCabecera.AddCell(cellLogo); tableCabecera.AddCell("\n\n\n\n\nEmpresa: " + Constantes._NOMBREEMPRESA + "\nLocalidad: " + Constantes._CIUDADEMPRESA + "\nFecha: " + DateTime.Now.ToString() + "\n"); //Inserto tabla de cabecera document.Add(tableCabecera); Paragraph salto = new Paragraph(" "); document.Add(salto); document.Add(salto); //Añadimos una tabla PdfPTable table = new PdfPTable(2); PdfPCell header = new PdfPCell(new Phrase("Datos del producto")); header.Colspan = 2; table.TotalWidth = 400f; table.LockedWidth = true; header.HorizontalAlignment = 1; table.AddCell(header); PdfPTable nested = new PdfPTable(1); nested.AddCell("ID: " + producto.Id); nested.AddCell("Nombre: " + producto.Nombre); nested.AddCell("Descripción: " + producto.Descripcion); nested.AddCell("Stock Actual: " + producto.Stock); PdfPCell nesthousing = new PdfPCell(nested); nesthousing.Padding = 0f; table.AddCell(nesthousing); iTextSharp.text.Image foto = iTextSharp.text.Image.GetInstance(producto.Foto); foto.ScaleAbsolute(100f, 100f); PdfPCell cellfoto = new PdfPCell(foto); cellfoto.HorizontalAlignment = 1; //bottom.Colspan = 1; table.AddCell(cellfoto); document.Add(table); //Cerramos todo document.Close(); writer.Close(); fs.Close(); MessageBox.Show("Se ha generado un informe en PDF con el nombre \"" + path + "\""); }
private void obtenerDatosProducto(DataGridView productoSelected) { string id = productoSelected.SelectedRows[0].Cells[0].Value.ToString(); p = producto.ObtenerProducto(id); textBoxId.Text = p.Id; textBoxId.Enabled = false; textBoxNombre.Text = p.Nombre; textBoxDescripcion.Text = p.Descripcion; numericStock.Value = p.Stock; pictureBoxImagen.ImageLocation = p.Foto; }