panel de administrador en proceso
This commit is contained in:
+117
-1
@@ -1,9 +1,11 @@
|
||||
using compabetov2.database.modelos;
|
||||
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;
|
||||
@@ -14,10 +16,124 @@ namespace compabetov2.admin
|
||||
public partial class crud : Form
|
||||
{
|
||||
private LoginModel loginPrincipal;
|
||||
private List<Producto> productos = new List<Producto>();
|
||||
|
||||
public crud()
|
||||
{
|
||||
InitializeComponent();
|
||||
llenarLayout();
|
||||
}
|
||||
|
||||
private void llenarLayout()
|
||||
{
|
||||
productos = service.conseguirProductos();
|
||||
|
||||
foreach (Producto producto in productos)
|
||||
{
|
||||
TableLayoutPanel filaLayout = new TableLayoutPanel();
|
||||
filaLayout.RowCount = 1;
|
||||
filaLayout.ColumnCount = 2;
|
||||
filaLayout.Height = 100;
|
||||
filaLayout.Width = 1115;
|
||||
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;
|
||||
|
||||
Label idProducto = new Label();
|
||||
idProducto.Text = producto.idProducto.ToString();
|
||||
idProducto.BackColor = Color.FromArgb(82, 82, 82);
|
||||
idProducto.ForeColor = Color.White;
|
||||
idProducto.AutoSize = true;
|
||||
idProducto.Dock = DockStyle.Left;
|
||||
|
||||
PictureBox imagen = new PictureBox();
|
||||
string rutaImg = Path.Combine(Application.StartupPath, "Resources", producto.img);
|
||||
imagen.Image = Image.FromFile(rutaImg);
|
||||
imagen.Dock = DockStyle.Fill;
|
||||
imagen.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
imagen.SizeMode = PictureBoxSizeMode.Zoom;
|
||||
imagen.Controls.Add(idProducto);
|
||||
|
||||
|
||||
Label nombreStock = new Label();
|
||||
nombreStock.Text = producto.nombre;
|
||||
nombreStock.Font = new Font(nombreStock.Font.FontFamily, 18);
|
||||
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 = 3;
|
||||
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
|
||||
agregarPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||
|
||||
Button btnEditar = new Button();
|
||||
btnEditar.Text = "Editar";
|
||||
btnEditar.Font = new Font(btnEditar.Font.FontFamily, 20);
|
||||
btnEditar.ForeColor = Color.White;
|
||||
btnEditar.FlatStyle = FlatStyle.Flat;
|
||||
btnEditar.FlatAppearance.BorderSize = 0;
|
||||
btnEditar.BackColor = Color.FromArgb(33, 90, 255);
|
||||
btnEditar.Dock = DockStyle.Fill;
|
||||
btnEditar.Click += new EventHandler(delegate (object sender, EventArgs e)
|
||||
{
|
||||
|
||||
});
|
||||
|
||||
Button btnVariante = new Button();
|
||||
btnVariante.Text = "Variante";
|
||||
btnVariante.Width = 60;
|
||||
btnVariante.Height = 60;
|
||||
btnVariante.Font = new Font(btnVariante.Font.FontFamily, 20);
|
||||
btnVariante.ForeColor = Color.Black;
|
||||
btnVariante.BackColor = Color.Yellow;
|
||||
btnVariante.FlatStyle = FlatStyle.Flat;
|
||||
btnVariante.FlatAppearance.BorderSize = 0;
|
||||
btnVariante.Dock = DockStyle.Fill;
|
||||
btnVariante.Click += new EventHandler(delegate (object sender, EventArgs e)
|
||||
{
|
||||
});
|
||||
|
||||
Button btnEliminar = new Button();
|
||||
btnEliminar.Text = "Eliminar";
|
||||
btnEliminar.Font = new Font(btnEliminar.Font.FontFamily, 20);
|
||||
btnEliminar.ForeColor = Color.White;
|
||||
btnEliminar.FlatStyle = FlatStyle.Flat;
|
||||
btnEliminar.FlatAppearance.BorderSize = 0;
|
||||
btnEliminar.BackColor = Color.Red;
|
||||
btnEliminar.Dock = DockStyle.Fill;
|
||||
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(btnVariante, 1, 0);
|
||||
agregarPanel.Controls.Add(btnEliminar, 2, 0);
|
||||
|
||||
|
||||
filaLayout.Controls.Add(informacionProducto, 0, 0);
|
||||
filaLayout.Controls.Add(agregarPanel, 1, 0);
|
||||
AdminPanel.Controls.Add(filaLayout);
|
||||
}
|
||||
}
|
||||
|
||||
private void crud_Load(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user