Mermas Design
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using compabetov2.database;
|
||||
using compabetov2.database.modelos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace compabetov2
|
||||
{
|
||||
public partial class agregarmermas : Form
|
||||
{
|
||||
private mermas ventanaPadre;
|
||||
public agregarmermas(mermas ventanaPadre)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.ventanaPadre = ventanaPadre;
|
||||
}
|
||||
|
||||
private void label2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnAgregar_Click(object sender, EventArgs e)
|
||||
{
|
||||
string descripcion = txtDescripcion.Text;
|
||||
string fecha = dtFecha.Text;
|
||||
string responsable = txtResponsable.Text;
|
||||
Merma merma = new Merma(-1,fecha,responsable,descripcion);
|
||||
if (service.insertarMerma(merma)) {
|
||||
ventanaPadre.llenarPanel();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void pictureBox2_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Mostrar mensaje de confirmación
|
||||
DialogResult result = MessageBox.Show("¿En realidad quieres agregar esta nueva merma?", "Confirmar Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
|
||||
// Verificar la respuesta del usuario
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
// Si el usuario hace clic en "Sí", proceder con la inserción
|
||||
string descripcion = txtDescripcion.Text;
|
||||
string fecha = dtFecha.Text;
|
||||
string responsable = txtResponsable.Text;
|
||||
|
||||
Merma nuevaMerma = new Merma(-1, fecha, responsable, descripcion);
|
||||
|
||||
if (service.insertarMerma(nuevaMerma))
|
||||
{
|
||||
MessageBox.Show("Nueva merma agregada");
|
||||
ventanaPadre.llenarPanel();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pictureBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user