inventario agregar stock

This commit is contained in:
carlos
2024-01-05 19:03:05 -06:00
parent 2dc7a75d97
commit e26af85c23
11 changed files with 207 additions and 239 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+53 -229
View File
@@ -28,9 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.lblfecha = new System.Windows.Forms.Label();
this.lblhora = new System.Windows.Forms.Label();
this.txtnombreproducto = new System.Windows.Forms.TextBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.panel2 = new System.Windows.Forms.Panel();
this.pictureBox7 = new System.Windows.Forms.PictureBox();
@@ -39,54 +37,24 @@
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.txtprecioproducto = new System.Windows.Forms.TextBox();
this.txtstockproducto = new System.Windows.Forms.TextBox();
this.txtdescripcionproducto = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.btnAgregarStock = new System.Windows.Forms.Button();
this.stockPanel = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
this.SuspendLayout();
//
// lblfecha
//
this.lblfecha.AutoSize = true;
this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F);
this.lblfecha.ForeColor = System.Drawing.Color.Navy;
this.lblfecha.Location = new System.Drawing.Point(747, 127);
this.lblfecha.Name = "lblfecha";
this.lblfecha.Size = new System.Drawing.Size(159, 58);
this.lblfecha.TabIndex = 11;
this.lblfecha.Text = "label2";
this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// lblhora
//
this.lblhora.AutoSize = true;
this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F);
this.lblhora.ForeColor = System.Drawing.Color.MediumBlue;
this.lblhora.Location = new System.Drawing.Point(933, 9);
this.lblhora.Location = new System.Drawing.Point(700, 7);
this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhora.Name = "lblhora";
this.lblhora.Size = new System.Drawing.Size(318, 113);
this.lblhora.Size = new System.Drawing.Size(238, 91);
this.lblhora.TabIndex = 10;
this.lblhora.Text = "label1";
//
// txtnombreproducto
//
this.txtnombreproducto.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtnombreproducto.Location = new System.Drawing.Point(497, 350);
this.txtnombreproducto.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtnombreproducto.Name = "txtnombreproducto";
this.txtnombreproducto.Size = new System.Drawing.Size(480, 55);
this.txtnombreproducto.TabIndex = 12;
this.lblhora.Text = "Stock";
//
// flowLayoutPanel1
//
@@ -98,26 +66,26 @@
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1061);
this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 862);
this.flowLayoutPanel1.TabIndex = 8;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7);
this.panel2.Location = new System.Drawing.Point(3, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel2.Location = new System.Drawing.Point(2, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(2);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(312, 263);
this.panel2.Size = new System.Drawing.Size(234, 214);
this.panel2.TabIndex = 8;
//
// pictureBox7
//
this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu;
this.pictureBox7.Location = new System.Drawing.Point(64, 34);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox7.Location = new System.Drawing.Point(48, 28);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -133,11 +101,11 @@
this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button1.Image = global::compabetov2.Properties.Resources.Menui1;
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.Location = new System.Drawing.Point(3, 269);
this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button1.Location = new System.Drawing.Point(2, 220);
this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(312, 114);
this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(234, 93);
this.button1.TabIndex = 8;
this.button1.Text = "Menú";
this.button1.UseVisualStyleBackColor = false;
@@ -152,11 +120,11 @@
this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi;
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.Location = new System.Drawing.Point(3, 387);
this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button2.Location = new System.Drawing.Point(2, 317);
this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2";
this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(312, 114);
this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(234, 93);
this.button2.TabIndex = 9;
this.button2.Text = "Estadisticas";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -171,11 +139,11 @@
this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button3.Image = global::compabetov2.Properties.Resources.productoi;
this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button3.Location = new System.Drawing.Point(3, 505);
this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button3.Location = new System.Drawing.Point(2, 414);
this.button3.Margin = new System.Windows.Forms.Padding(2);
this.button3.Name = "button3";
this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(312, 114);
this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(234, 93);
this.button3.TabIndex = 10;
this.button3.Text = "Productos";
this.button3.UseVisualStyleBackColor = false;
@@ -189,11 +157,11 @@
this.button4.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button4.Image = global::compabetov2.Properties.Resources.reportesi;
this.button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button4.Location = new System.Drawing.Point(3, 623);
this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button4.Location = new System.Drawing.Point(2, 511);
this.button4.Margin = new System.Windows.Forms.Padding(2);
this.button4.Name = "button4";
this.button4.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button4.Size = new System.Drawing.Size(312, 114);
this.button4.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button4.Size = new System.Drawing.Size(234, 93);
this.button4.TabIndex = 11;
this.button4.Text = "Reportes";
this.button4.UseVisualStyleBackColor = false;
@@ -207,177 +175,45 @@
this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button5.Image = global::compabetov2.Properties.Resources.sesionc;
this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button5.Location = new System.Drawing.Point(3, 741);
this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button5.Location = new System.Drawing.Point(2, 608);
this.button5.Margin = new System.Windows.Forms.Padding(2);
this.button5.Name = "button5";
this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(312, 114);
this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(234, 93);
this.button5.TabIndex = 12;
this.button5.Text = "Salir";
this.button5.UseVisualStyleBackColor = false;
//
// txtprecioproducto
// btnAgregarStock
//
this.txtprecioproducto.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtprecioproducto.Location = new System.Drawing.Point(1031, 350);
this.txtprecioproducto.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtprecioproducto.Name = "txtprecioproducto";
this.txtprecioproducto.Size = new System.Drawing.Size(171, 55);
this.txtprecioproducto.TabIndex = 13;
this.btnAgregarStock.Location = new System.Drawing.Point(744, 147);
this.btnAgregarStock.Name = "btnAgregarStock";
this.btnAgregarStock.Size = new System.Drawing.Size(100, 23);
this.btnAgregarStock.TabIndex = 12;
this.btnAgregarStock.Text = "Agregar stock";
this.btnAgregarStock.UseVisualStyleBackColor = true;
this.btnAgregarStock.Click += new System.EventHandler(this.button6_Click_1);
//
// txtstockproducto
// stockPanel
//
this.txtstockproducto.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtstockproducto.Location = new System.Drawing.Point(1239, 350);
this.txtstockproducto.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtstockproducto.Name = "txtstockproducto";
this.txtstockproducto.Size = new System.Drawing.Size(171, 55);
this.txtstockproducto.TabIndex = 14;
//
// txtdescripcionproducto
//
this.txtdescripcionproducto.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtdescripcionproducto.Location = new System.Drawing.Point(497, 502);
this.txtdescripcionproducto.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtdescripcionproducto.Multiline = true;
this.txtdescripcionproducto.Name = "txtdescripcionproducto";
this.txtdescripcionproducto.Size = new System.Drawing.Size(705, 443);
this.txtdescripcionproducto.TabIndex = 15;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label1.ForeColor = System.Drawing.Color.Navy;
this.label1.Location = new System.Drawing.Point(497, 287);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(334, 39);
this.label1.TabIndex = 16;
this.label1.Text = "Nombre del producto";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label2.ForeColor = System.Drawing.Color.Navy;
this.label2.Location = new System.Drawing.Point(1021, 272);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(114, 39);
this.label2.TabIndex = 17;
this.label2.Text = "Precio";
this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label3.ForeColor = System.Drawing.Color.Navy;
this.label3.Location = new System.Drawing.Point(1229, 272);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(102, 39);
this.label3.TabIndex = 18;
this.label3.Text = "Stock";
this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label4.ForeColor = System.Drawing.Color.Navy;
this.label4.Location = new System.Drawing.Point(497, 439);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(392, 39);
this.label4.TabIndex = 19;
this.label4.Text = "Descripción del producto";
this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// button6
//
this.button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button6.Location = new System.Drawing.Point(1239, 502);
this.button6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(171, 70);
this.button6.TabIndex = 20;
this.button6.Text = "Agregar";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button7.Location = new System.Drawing.Point(1239, 622);
this.button7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(171, 70);
this.button7.TabIndex = 21;
this.button7.Text = "Buscar";
this.button7.UseVisualStyleBackColor = true;
//
// button8
//
this.button8.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button8.Location = new System.Drawing.Point(1239, 756);
this.button8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(171, 70);
this.button8.TabIndex = 22;
this.button8.Text = "Editar";
this.button8.UseVisualStyleBackColor = true;
//
// button9
//
this.button9.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button9.Location = new System.Drawing.Point(1239, 875);
this.button9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(171, 70);
this.button9.TabIndex = 23;
this.button9.Text = "Eliminar";
this.button9.UseVisualStyleBackColor = true;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"cerveza",
"cigarros",
"sabritas",
"aguas"});
this.comboBox1.Location = new System.Drawing.Point(1153, 198);
this.comboBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(160, 24);
this.comboBox1.TabIndex = 24;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
this.stockPanel.Location = new System.Drawing.Point(394, 199);
this.stockPanel.Name = "stockPanel";
this.stockPanel.Size = new System.Drawing.Size(834, 518);
this.stockPanel.TabIndex = 13;
//
// inventario
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1924, 1055);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button9);
this.Controls.Add(this.button8);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtdescripcionproducto);
this.Controls.Add(this.txtstockproducto);
this.Controls.Add(this.txtprecioproducto);
this.Controls.Add(this.txtnombreproducto);
this.Controls.Add(this.lblfecha);
this.ClientSize = new System.Drawing.Size(1370, 749);
this.Controls.Add(this.stockPanel);
this.Controls.Add(this.btnAgregarStock);
this.Controls.Add(this.lblhora);
this.Controls.Add(this.flowLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "inventario";
this.Text = "inventario";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.inventario_Load);
this.flowLayoutPanel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
@@ -397,20 +233,8 @@
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Label lblfecha;
private System.Windows.Forms.Label lblhora;
private System.Windows.Forms.TextBox txtnombreproducto;
private System.Windows.Forms.TextBox txtprecioproducto;
private System.Windows.Forms.TextBox txtstockproducto;
private System.Windows.Forms.TextBox txtdescripcionproducto;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button btnAgregarStock;
private System.Windows.Forms.FlowLayoutPanel stockPanel;
}
}
+151 -7
View File
@@ -1,22 +1,138 @@
using compabetov2.database;
using compabetov2.database.modelos;
using compabetov2.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
namespace compabetov2
{
public partial class inventario : Form
{
private List<Producto> productos;
public inventario()
{
InitializeComponent();
llenarPanel();
}
private void llenarPanel()
{
productos = service.conseguirProductos();
foreach (Producto producto in productos)
{
TableLayoutPanel filaLayout = new TableLayoutPanel();
filaLayout.RowCount = 1;
filaLayout.ColumnCount = 2;
filaLayout.Height = 100;
filaLayout.Width = 830;
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 + " - Stock: " + producto.stock.ToString();
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 = 3;
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F));
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
agregarPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
TextBox txtStockAgregar = new TextBox();
txtStockAgregar.Text = "0";
txtStockAgregar.Height = 60;
txtStockAgregar.Width = 200;
txtStockAgregar.Anchor = AnchorStyles.None;
txtStockAgregar.Font = new Font(txtStockAgregar.Font.FontFamily, 17);
Button btnMenos = new Button();
btnMenos.Text = "-";
btnMenos.Width = 60;
btnMenos.Height = 60;
btnMenos.Font = new Font(btnMenos.Font.FontFamily, 30);
btnMenos.ForeColor = Color.White;
btnMenos.FlatStyle = FlatStyle.Flat;
btnMenos.FlatAppearance.BorderSize = 0;
btnMenos.BackColor = Color.FromArgb(33, 90, 255);
btnMenos.Anchor = AnchorStyles.None;
btnMenos.Click += new EventHandler(delegate (object sender, EventArgs e)
{
int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador - 1).ToString();
});
Button btnMas = new Button();
btnMas.Text = "+";
btnMas.Width = 60;
btnMas.Height = 60;
btnMas.Font = new Font(btnMas.Font.FontFamily, 30);
btnMas.ForeColor = Color.White;
btnMas.BackColor = Color.FromArgb(33, 90, 255);
btnMas.FlatStyle = FlatStyle.Flat;
btnMas.FlatAppearance.BorderSize = 0;
btnMas.Anchor = AnchorStyles.None;
btnMas.Click += new EventHandler(delegate (object sender, EventArgs e)
{
int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador + 1).ToString();
});
informacionProducto.Controls.Add(imagen,0,0);
informacionProducto.Controls.Add(nombreStock,1,0);
agregarPanel.Controls.Add(txtStockAgregar, 0, 0);
agregarPanel.Controls.Add(btnMenos, 1, 0);
agregarPanel.Controls.Add(btnMas, 2, 0);
filaLayout.Controls.Add(informacionProducto, 0, 0);
filaLayout.Controls.Add(agregarPanel, 1, 0);
stockPanel.Controls.Add(filaLayout);
}
}
private void button1_Click(object sender, EventArgs e)
@@ -30,7 +146,7 @@ namespace compabetov2
private void button6_Click(object sender, EventArgs e)
{
Categoria categoria = new Categoria(comboBox1.SelectedIndex + 1);
/*Categoria categoria = new Categoria(comboBox1.SelectedIndex + 1);
Producto producto = new Producto(
0,
txtnombreproducto.Text,
@@ -42,17 +158,45 @@ namespace compabetov2
if (service.insertarProducto(producto)) {
}
}*/
}
private void inventario_Load(object sender, EventArgs e)
private void button6_Click_1(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
List<Producto> stockNuevo = new List<Producto>();
foreach(Control control in stockPanel.Controls)
{
TableLayoutPanel informacionProducto = control.Controls[0] as TableLayoutPanel;
TableLayoutPanel agregarPanel = control.Controls[1] as TableLayoutPanel;
//id
Label lbIdProducto = informacionProducto.Controls[0].Controls[0] as Label;
int idProducto = int.Parse(lbIdProducto.Text);
//stock a agregar
TextBox txtStock = agregarPanel.Controls[0] as TextBox;
int stock = int.Parse(txtStock.Text);
Producto productoStockNuuevo = new Producto(idProducto,"","",0,"",stock, null);
stockNuevo.Add(productoStockNuuevo);
}
string mensajeConfirmacion = "Se aumentara el stock a los\nsiguientes productos\n";
for(int i = 0; i < stockNuevo.Count; i++)
{
if (stockNuevo[i].stock > 0)
{
mensajeConfirmacion += productos[i].nombre + ": " + stockNuevo[i].stock + "\n";
}
}
DialogResult result = MessageBox.Show(mensajeConfirmacion, "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
// Código para realizar la acción
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -67,7 +67,7 @@ namespace compabetov2
pic.Controls.Add(id);
Label precio = new Label();
precio.Text = "$5";// + producto.precion.ToString();
precio.Text = "$" + producto.precion.ToString() + " - " + producto.nombre;
precio.BackColor = Color.FromArgb(82, 82, 82);
precio.ForeColor = Color.White;
precio.Width = 40;