crud de importe en proceso

This commit is contained in:
Carlos Sandoval
2024-06-30 11:19:46 -06:00
parent 3a1c75967a
commit 8009e38291
21 changed files with 733 additions and 50 deletions
+59
View File
@@ -0,0 +1,59 @@
using compabetov2.database.modelos;
using compabetov2.Ventas;
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;
using System.Windows.Forms;
namespace compabetov2.admin
{
public partial class AgregarImporte : Form
{
private string imagePath;
private visualizarImportes ventanaPadre;
public AgregarImporte(visualizarImportes ventanaPadre)
{
InitializeComponent();
this.ventanaPadre = ventanaPadre;
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "Archivos de imagen (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp";
openFileDialog1.Title = "Seleccionar imagen";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
imagePath = openFileDialog1.FileName;
lbImg.Text = $"Imagen: {Path.GetFileName(imagePath)}";
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
string nombre = txtNombre.Text;
decimal precio = decimal.Parse(txtPrecio.Text);
ImporteModel importe = new ImporteModel(-1, nombre, precio, Path.GetFileName(imagePath));
}
catch
{
MessageBox.Show("Por favor introduzca un precio valido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}