Files
compabetoOG/admin/visualizarImportes.cs

124 lines
4.8 KiB
C#

using compabetov2.database;
using compabetov2.database.modelos;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace compabetov2.admin
{
public partial class visualizarImportes : Form
{
private List<ImporteModel> importes;
public visualizarImportes()
{
InitializeComponent();
llenarPanel();
}
private void llenarPanel()
{
panelImporte.Controls.Clear();
importes = service.conseguirImportes();
foreach (ImporteModel importe in importes)
{
TableLayoutPanel filaLayout = new TableLayoutPanel();
filaLayout.RowCount = 1;
filaLayout.ColumnCount = 2;
filaLayout.Height = 100;
filaLayout.Width = 650;
filaLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
filaLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
filaLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
TableLayoutPanel informacionProducto = new TableLayoutPanel();
informacionProducto.RowCount = 1;
informacionProducto.ColumnCount = 2;
informacionProducto.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
informacionProducto.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 80F));
informacionProducto.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
informacionProducto.Dock = DockStyle.Fill;
PictureBox imagen = new PictureBox();
string rutaImg = Path.Combine(Application.StartupPath, "Resources", importe.img);
imagen.Image = Image.FromFile(rutaImg);
imagen.Dock = DockStyle.Fill;
imagen.BackgroundImageLayout = ImageLayout.Stretch;
imagen.SizeMode = PictureBoxSizeMode.Zoom;
Label nombreStock = new Label();
nombreStock.Text = importe.tipo;
nombreStock.Font = new Font(nombreStock.Font.FontFamily, 16);
nombreStock.Dock = DockStyle.Fill;
nombreStock.TextAlign = ContentAlignment.MiddleCenter;
//panel de agregar stock
TableLayoutPanel agregarPanel = new TableLayoutPanel();
agregarPanel.Dock = DockStyle.Fill;
agregarPanel.RowCount = 1;
agregarPanel.ColumnCount = 2;
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
agregarPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
Button btnEditar = new Button();
btnEditar.Text = "Editar";
btnEditar.Width = 150;
btnEditar.Height = 60;
btnEditar.Font = new Font(btnEditar.Font.FontFamily, 14);
btnEditar.ForeColor = Color.White;
btnEditar.FlatStyle = FlatStyle.Flat;
btnEditar.FlatAppearance.BorderSize = 0;
btnEditar.BackColor = Color.FromArgb(33, 90, 255);
btnEditar.Anchor = AnchorStyles.None;
btnEditar.Click += new EventHandler(delegate (object sender, EventArgs e)
{
});
Button btnEliminar = new Button();
btnEliminar.Text = "Eliminar";
btnEliminar.Width = 150;
btnEliminar.Height = 60;
btnEliminar.Font = new Font(btnEliminar.Font.FontFamily, 14);
btnEliminar.ForeColor = Color.Black;
btnEliminar.BackColor = Color.Red;
btnEliminar.FlatStyle = FlatStyle.Flat;
btnEliminar.FlatAppearance.BorderSize = 0;
btnEliminar.Anchor = AnchorStyles.None;
btnEliminar.Click += new EventHandler(delegate (object sender, EventArgs e)
{
});
informacionProducto.Controls.Add(imagen, 0, 0);
informacionProducto.Controls.Add(nombreStock, 1, 0);
agregarPanel.Controls.Add(btnEditar, 0, 0);
agregarPanel.Controls.Add(btnEliminar, 1, 0);
filaLayout.Controls.Add(informacionProducto, 0, 0);
filaLayout.Controls.Add(agregarPanel, 1, 0);
panelImporte.Controls.Add(filaLayout);
}
}
private void panelImporte_Paint(object sender, PaintEventArgs e)
{
}
}
}