panel de administrador en proceso

This commit is contained in:
carlos
2024-06-18 18:49:57 -06:00
parent 9ce48e32b7
commit 3d3b79b1ed
11 changed files with 144 additions and 13 deletions
+25 -11
View File
@@ -35,7 +35,8 @@
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.stockPanel = new System.Windows.Forms.FlowLayoutPanel();
this.AdminPanel = new System.Windows.Forms.FlowLayoutPanel();
this.btnAgregar = new System.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
@@ -149,22 +150,34 @@
this.button5.Text = "Salir";
this.button5.UseVisualStyleBackColor = false;
//
// stockPanel
// AdminPanel
//
this.stockPanel.AutoScroll = true;
this.stockPanel.Location = new System.Drawing.Point(410, 233);
this.stockPanel.Margin = new System.Windows.Forms.Padding(4);
this.stockPanel.Name = "stockPanel";
this.stockPanel.Size = new System.Drawing.Size(1109, 757);
this.stockPanel.TabIndex = 14;
this.AdminPanel.AutoScroll = true;
this.AdminPanel.BackColor = System.Drawing.SystemColors.Control;
this.AdminPanel.Location = new System.Drawing.Point(410, 233);
this.AdminPanel.Margin = new System.Windows.Forms.Padding(4);
this.AdminPanel.Name = "AdminPanel";
this.AdminPanel.Size = new System.Drawing.Size(1528, 757);
this.AdminPanel.TabIndex = 14;
//
// btnAgregar
//
this.btnAgregar.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnAgregar.Location = new System.Drawing.Point(1084, 154);
this.btnAgregar.Name = "btnAgregar";
this.btnAgregar.Size = new System.Drawing.Size(120, 44);
this.btnAgregar.TabIndex = 15;
this.btnAgregar.Text = "Agregar";
this.btnAgregar.UseVisualStyleBackColor = true;
//
// crud
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1677, 1037);
this.ClientSize = new System.Drawing.Size(1942, 1037);
this.ControlBox = false;
this.Controls.Add(this.stockPanel);
this.Controls.Add(this.btnAgregar);
this.Controls.Add(this.AdminPanel);
this.Controls.Add(this.flowLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "crud";
@@ -188,6 +201,7 @@
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.FlowLayoutPanel stockPanel;
private System.Windows.Forms.FlowLayoutPanel AdminPanel;
private System.Windows.Forms.Button btnAgregar;
}
}
+117 -1
View File
@@ -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)