diff --git a/admin/crud.Designer.cs b/admin/crud.Designer.cs index 769c661..8836728 100644 --- a/admin/crud.Designer.cs +++ b/admin/crud.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/admin/crud.cs b/admin/crud.cs index 1960683..1f31d81 100644 --- a/admin/crud.cs +++ b/admin/crud.cs @@ -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 productos = new List(); 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) diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index df805f7..6796f34 100644 Binary files a/bin/Debug/compabetov2.exe and b/bin/Debug/compabetov2.exe differ diff --git a/bin/Debug/compabetov2.pdb b/bin/Debug/compabetov2.pdb index d132ae6..68552d3 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 10a1a65..cfc5175 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache index 48a4903..6ae8e14 100644 Binary files a/obj/Debug/compabetov2.csproj.AssemblyReference.cache and b/obj/Debug/compabetov2.csproj.AssemblyReference.cache differ diff --git a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache index e3e6d75..97d6619 100644 --- a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache +++ b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -057a07ff8f8a6f35d17720e1156a8cbeaa37ba3ef371419afc7a5a193cc76c5e +79223065a562d51344b7320aac98712da31ef35fad93e21c7ea9a1c9b5a40da5 diff --git a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt index 95eced6..7a87eae 100644 --- a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt +++ b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt @@ -150,3 +150,4 @@ C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabet.5C4A C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.exe C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.pdb C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.admin.crud.resources +C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.admin.crud.resources diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index d9419a1..3761226 100644 Binary files a/obj/Debug/compabetov2.csproj.GenerateResource.cache and b/obj/Debug/compabetov2.csproj.GenerateResource.cache differ diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index df805f7..6796f34 100644 Binary files a/obj/Debug/compabetov2.exe and b/obj/Debug/compabetov2.exe differ diff --git a/obj/Debug/compabetov2.pdb b/obj/Debug/compabetov2.pdb index d132ae6..68552d3 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ