HAY UN AVANCE

This commit is contained in:
fedpo
2024-08-27 04:36:00 +01:00
parent 670190c44b
commit 2428f615a6
76 changed files with 5786 additions and 496 deletions

Binary file not shown.

View File

@@ -12,22 +12,11 @@ namespace Controladora
{ {
repositorioCategoria = new(new Context()); repositorioCategoria = new(new Context());
} }
// Método para verificar si una categoría con un ID ya existe
private bool CategoriaExiste(int id)
{
var cat = repositorioCategoria.ObtenerPorId(id);
return (cat.Id == id);
}
public string Añadir(Categoria t) public string Añadir(Categoria t)
{ {
if (t == null) return "La categoría es nula, fallo la carga"; if (t == null) return "La categoría es nula, fallo la carga";
if (CategoriaExiste(t.Id))
{
return $"Ya existe una categoría con el ID {t.Id}";
}
repositorioCategoria.Add(t); repositorioCategoria.Add(t);
repositorioCategoria.Guardar(); repositorioCategoria.Guardar();
return $"La categoría {t.Descripcion} se cargó correctamente"; return $"La categoría {t.Descripcion} se cargó correctamente";
@@ -46,11 +35,6 @@ namespace Controladora
{ {
if (t == null) return "La categoría es nula, fallo la carga"; if (t == null) return "La categoría es nula, fallo la carga";
if (!CategoriaExiste(t.Id))
{
return $"No se encontró una categoría con el ID {t.Id}";
}
repositorioCategoria.Mod(t); repositorioCategoria.Mod(t);
repositorioCategoria.Guardar(); repositorioCategoria.Guardar();
return $"La categoría {t.Descripcion} se modificó correctamente"; return $"La categoría {t.Descripcion} se modificó correctamente";

View File

@@ -11,22 +11,11 @@ namespace Controladora
{ {
repositorioClientes = new(new Context()); repositorioClientes = new(new Context());
} }
private bool ClienteExiste(long cuit)
{
var cat = repositorioClientes.ObtenerPorId(cuit);
return (cat.Cuit == cuit);
}
public string Añadir(Cliente t) public string Añadir(Cliente t)
{ {
if (t == null) return "El Cliente es nulo, fallo la carga"; if (t == null) return "El Cliente es nulo, fallo la carga";
// Verificar si el CUIT ya existe en el repositorio
if (ClienteExiste(t.Cuit))
{
return $"El Cliente con el CUIT {t.Cuit} ya existe";
}
try try
{ {
repositorioClientes.Add(t); repositorioClientes.Add(t);

View File

@@ -75,7 +75,7 @@ namespace Controladora
if (proveedor.Cuit < 0) return new List<Producto>().AsReadOnly(); if (proveedor.Cuit < 0) return new List<Producto>().AsReadOnly();
var productos = ControladoraProductos.Instance var productos = ControladoraProductos.Instance
.Listar() .Listar()
.Where(x => x.ListarProveedores() .Where(x => x.proveedores
.Any(x => x.Cuit == proveedor.Cuit)) .Any(x => x.Cuit == proveedor.Cuit))
.ToList() .ToList()
.AsReadOnly(); .AsReadOnly();

View File

@@ -1,12 +1,55 @@
using System; using Entidades;
using Modelo;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Controladora namespace Controladora
{ {
public class ControladoraProductoNoPercedero public class ControladoraProductoNoPercedero : Singleton<ControladoraProductoNoPercedero>
{ {
RepositorioProductosNoPercedero noPercedero;
public ControladoraProductoNoPercedero()
{
noPercedero = new RepositorioProductosNoPercedero(new Context());
}
public string Añadir(ProductoNoPercedero t)
{
if (t == null) return "El Producto es nulo fallo la carga";
noPercedero.Add(t);
return (noPercedero.Guardar()) ?
$"El Producto {t.Nombre} se cargo correctamente" :
$"Fallo la carga del Producto {t.Nombre}";
}
public string Eliminar(ProductoNoPercedero t)
{
if (t == null) return "El Producto es nulo fallo la carga";
noPercedero.Del(t);
return (noPercedero.Guardar()) ?
$"El Producto {t.Nombre} se Elimino correctamente" :
$"Fallo la Eliminacion del Producto {t.Nombre}";
}
public string Modificar(ProductoNoPercedero t)
{
if (t == null) return "El Producto es nulo fallo la carga";
noPercedero.Mod(t);
return (noPercedero.Guardar()) ?
$"El Producto {t.Nombre} se Modifico correctamente" :
$"Fallo la Modificacion del Producto {t.Nombre}";
}
public ReadOnlyCollection<ProductoNoPercedero> Listar()
{
return noPercedero.Listar().AsReadOnly();
}
} }
} }

View File

@@ -1,4 +1,6 @@
using System; using Entidades;
using Modelo;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -6,7 +8,41 @@ using System.Threading.Tasks;
namespace Controladora namespace Controladora
{ {
public class ControladoraProductoPercedero public class ControladoraProductoPercedero : Singleton<ControladoraProductoPercedero>
{ {
RepositorioProductosPercedero Percedero;
public ControladoraProductoPercedero()
{
Percedero = new RepositorioProductosPercedero(new Context());
}
public string Añadir(ProductoPercedero t)
{
if (t == null) return "El Producto es nulo fallo la carga";
Percedero.Add(t);
return (Percedero.Guardar()) ?
$"El Producto {t.Nombre} se cargo correctamente" :
$"Fallo la carga del Producto {t.Nombre}";
}
public string Eliminar(ProductoPercedero t)
{
if (t == null) return "El Producto es nulo fallo la carga";
Percedero.Del(t);
return (Percedero.Guardar()) ?
$"El Producto {t.Nombre} se Elimino correctamente" :
$"Fallo la eliminacion del Producto {t.Nombre}";
}
public string Modificar(ProductoPercedero t)
{
if (t == null) return "El Producto es nulo fallo la carga";
Percedero.Mod(t);
return (Percedero.Guardar()) ?
$"El Producto {t.Nombre} se Modifico correctamente" :
$"Fallo la Modificacion del Producto {t.Nombre}";
}
} }
} }

View File

@@ -18,7 +18,7 @@ namespace Controladora
{ {
Producto productoalistar = new RepositorioProductos(new Context()).Listar().First(x => x.Id == producto.Id); Producto productoalistar = new RepositorioProductos(new Context()).Listar().First(x => x.Id == producto.Id);
if (productoalistar == null) return new ReadOnlyCollection<Proveedor>(new List<Proveedor>()); if (productoalistar == null) return new ReadOnlyCollection<Proveedor>(new List<Proveedor>());
return productoalistar.ListarProveedores(); return productoalistar.proveedores.AsReadOnly();
} }

View File

@@ -1,9 +1,12 @@
 
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Entidades namespace Entidades
{ {
public class Categoria public class Categoria
{ {
public int Id { get; set; } public Int32 Id { get; set; }
public string Descripcion { get; set; } public string Descripcion { get; set; }
} }
} }

View File

@@ -9,7 +9,7 @@ namespace Entidades
public int Cantidad { get; set; } public int Cantidad { get; set; }
public T Producto { get; set; } public T Producto { get; set; }
public int IdProducto { get; set; }
} }
} }

View File

@@ -8,7 +8,6 @@ namespace Entidades
public int IdOrdenDeCompra { get; set; } public int IdOrdenDeCompra { get; set; }
public double MontoCU { get; set; } public double MontoCU { get; set; }
public int IdPresupuesto { get; set; } public int IdPresupuesto { get; set; }
public Presupuesto presupuesto { get; set; }
[NotMapped] [NotMapped]
public string NombreProducto public string NombreProducto

View File

@@ -11,7 +11,8 @@ namespace Entidades
public long IdCliente { get; set; } public long IdCliente { get; set; }
public Cliente Cliente { get; set; } public Cliente Cliente { get; set; }
public List<DetalleFactura> detalles = new List<DetalleFactura>(); private List<DetalleFactura> detalles = new List<DetalleFactura>();
public ReadOnlyCollection<DetalleFactura> Detalles => detalles.AsReadOnly();
public void AñadirDetalle(DetalleFactura detalle) public void AñadirDetalle(DetalleFactura detalle)

View File

@@ -11,8 +11,8 @@ namespace Entidades
public long IdProveedor { get; set; } public long IdProveedor { get; set; }
public bool Entregado { get; set; } public bool Entregado { get; set; }
public List<DetalleOrdenDeCompra> detalles = new List<DetalleOrdenDeCompra>(); private List<DetalleOrdenDeCompra> detalles = new List<DetalleOrdenDeCompra>();
public ReadOnlyCollection<DetalleOrdenDeCompra> Detalles => detalles.AsReadOnly();
public void AñadirDetalle(DetalleOrdenDeCompra detalle) public void AñadirDetalle(DetalleOrdenDeCompra detalle)
{ {
detalles.Add(detalle); detalles.Add(detalle);

View File

@@ -22,7 +22,7 @@
} }
public List<DetallePresupuesto> detalles = new List<DetallePresupuesto>(); public List<DetallePresupuesto> detalles = new List<DetallePresupuesto>();
public void AñadirDetalle(DetallePresupuesto det) { public void AñadirDetalle(DetallePresupuesto det) {
detalles.Add(det); detalles.Add(det);
} }

View File

@@ -12,7 +12,7 @@ namespace Entidades
public bool Habilitado { get; set; } public bool Habilitado { get; set; }
public bool EsPerecedero { get; set; } public bool EsPerecedero { get; set; }
private List<Proveedor> proveedores = new List<Proveedor>(); public List<Proveedor> proveedores = new List<Proveedor>();
public void AñadirProveedor(Proveedor proveedor) public void AñadirProveedor(Proveedor proveedor)
{ {
@@ -25,10 +25,6 @@ namespace Entidades
if (pAEliminar == null) return false; if (pAEliminar == null) return false;
return proveedores.Remove(pAEliminar); return proveedores.Remove(pAEliminar);
} }
public ReadOnlyCollection<Proveedor> ListarProveedores()
{
return proveedores.AsReadOnly();
}
public List<Categoria> categorias = new List<Categoria>(); public List<Categoria> categorias = new List<Categoria>();
@@ -42,8 +38,5 @@ namespace Entidades
return categorias.Remove(cAEliminar); return categorias.Remove(cAEliminar);
} }
public ReadOnlyCollection<Categoria> MostrarCategorias(){
return categorias.AsReadOnly();
}
} }
} }

View File

@@ -6,10 +6,12 @@
public class Remito public class Remito
{ {
public int Id { get; set; } public int Id { get; set; }
public List<Lote> lotesDeProductosEntregados = new List<Lote>();
public Proveedor Proveedor { get; set; } public Proveedor Proveedor { get; set; }
public int IdProveedor { get; set; } public int IdProveedor { get; set; }
private List<Lote> lotesDeProductosEntregados = new List<Lote>();
public ReadOnlyCollection<Lote> Lotes => lotesDeProductosEntregados.AsReadOnly();
public ReadOnlyCollection<Lote> MostrarLotes() public ReadOnlyCollection<Lote> MostrarLotes()
{ {
return lotesDeProductosEntregados.AsReadOnly(); return lotesDeProductosEntregados.AsReadOnly();

View File

@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Informes")] [assembly: System.Reflection.AssemblyCompanyAttribute("Informes")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+566bfe57c004ac77e4c9433bbd20ee10a1a09a57")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+670190c44b669009d2d84e1f849117de0d18586f")]
[assembly: System.Reflection.AssemblyProductAttribute("Informes")] [assembly: System.Reflection.AssemblyProductAttribute("Informes")]
[assembly: System.Reflection.AssemblyTitleAttribute("Informes")] [assembly: System.Reflection.AssemblyTitleAttribute("Informes")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
ae00625e110761358d22d1280d507fcadf870bc5f0bd5603a24f1f10ad9015b0 3686af964ab837044e10a22154c7a4ac73f28162a711d7a0fa37d00d14ff75af

View File

@@ -32,60 +32,168 @@ public class Context : Microsoft.EntityFrameworkCore.DbContext
modelBuilder.Entity<Categoria>() modelBuilder.Entity<Categoria>()
.ToTable("Categoria") .ToTable("Categoria")
.HasKey(x => x.Id); .HasKey(x => x.Id);
modelBuilder.Entity<Categoria>() modelBuilder.Entity<Categoria>()
.Property(c=>c.Descripcion) .Property(c => c.Descripcion)
.IsRequired() .IsRequired()
.HasMaxLength(100); .HasMaxLength(50);
/// Cliente /// Cliente
modelBuilder.Entity<Cliente>() modelBuilder.Entity<Cliente>()
.ToTable("Clientes") // Nombre de la tabla .ToTable("Clientes") // Nombre de la tabla
.HasKey(c => c.Cuit); // Configura la clave primaria .HasKey(c => c.Cuit); // Configura la clave primaria
modelBuilder.Entity<Cliente>()
.Property(x => x.Cuit)
.ValueGeneratedNever();
modelBuilder.Entity<Cliente>() modelBuilder.Entity<Cliente>()
.Property(c => c.Nombre) .Property(c => c.Nombre)
.IsRequired() .IsRequired()
.HasMaxLength(100); .HasMaxLength(30);
modelBuilder.Entity<Cliente>() modelBuilder.Entity<Cliente>()
.Property(c => c.Apellido) .Property(c => c.Apellido)
.IsRequired() .IsRequired()
.HasMaxLength(100); .HasMaxLength(30);
modelBuilder.Entity<Cliente>() modelBuilder.Entity<Cliente>()
.Property(c => c.Direccion) .Property(c => c.Direccion)
.HasMaxLength(200); .IsRequired()
.HasMaxLength(50);
modelBuilder.Entity<Cliente>() modelBuilder.Entity<Cliente>()
.Property(c => c.Correo) .Property(c => c.Correo)
.IsRequired()
.HasMaxLength(150); .HasMaxLength(150);
modelBuilder.Entity<Cliente>() modelBuilder.Entity<Cliente>()
.Property(c => c.Habilitado) .Property(c => c.Habilitado)
.IsRequired()
.HasDefaultValue(true); .HasDefaultValue(true);
/// Factura Y DetalleFactura WIP /// Factura Y DetalleFactura
modelBuilder.Entity<Factura>() modelBuilder.Entity<Factura>()
.ToTable("Facturas") .ToTable("Facturas")
.HasKey(f => f.Id); .HasKey(f => f.Id);
modelBuilder.Entity<Factura>() modelBuilder.Entity<Factura>()
.HasMany(f => f.detalles) .HasMany(f => f.Detalles)
.WithOne() .WithOne()
.HasForeignKey(df => df.IdFactura); .HasForeignKey(df => df.IdFactura);
modelBuilder.Entity<DetalleFactura>() modelBuilder.Entity<DetalleFactura>()
.ToTable("DetallesFacturas") .ToTable("DetallesFacturas")
.HasKey(df => df.Id); .HasKey(df => new { df.Id, df.IdFactura });
modelBuilder.Entity<DetalleFactura>() modelBuilder.Entity<DetalleFactura>()
.Property(df => df.IdFactura) .Property(df => df.IdFactura)
.IsRequired(); .IsRequired();
//Producto
modelBuilder.Entity<Producto>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Nombre)
.IsRequired()
.HasMaxLength(30);
entity.Property(e => e.Precio)
.HasColumnType("float");
entity.Property(e => e.Habilitado)
.IsRequired()
.HasDefaultValue(true);
entity.Property(e => e.EsPerecedero)
.IsRequired();
entity.HasMany(e => e.proveedores)
.WithMany()
.UsingEntity<Dictionary<string, object>>(
"ProductoProveedor",
j => j.HasOne<Proveedor>().WithMany().HasForeignKey("ProveedorId"),
j => j.HasOne<Producto>().WithMany().HasForeignKey("ProductoId"),
j => j.HasKey("ProveedorId", "ProductoId"));
entity.HasMany(e => e.categorias)
.WithMany()
.UsingEntity<Dictionary<string, object>>(
"ProductoCategoria",
j => j.HasOne<Categoria>().WithMany().HasForeignKey("CategoriaId"),
j => j.HasOne<Producto>().WithMany().HasForeignKey("ProductoId"),
j => j.HasKey("CategoriaId", "ProductoId"));
});
// Mapeo para ProductoNoPercedero
modelBuilder.Entity<ProductoNoPercedero>(entity =>
{
entity.Property(e => e.TipoDeEnvase)
.HasConversion<string>();
});
modelBuilder.Entity<Proveedor>(entity =>
{
entity.HasKey(x => x.Cuit);
entity.Property(x => x.Cuit).ValueGeneratedNever();
entity.Property(x => x.Nombre)
.IsRequired()
.HasMaxLength(30);
entity.Property(x => x.Habilitado)
.IsRequired()
.HasDefaultValue(true);
entity.Property(x => x.RazonSocial)
.IsRequired()
.HasMaxLength(60);
entity.Property(x => x.Direccion)
.IsRequired()
.HasMaxLength(60);
});
modelBuilder.Entity<DetalleOrdenDeCompra>()
.HasKey(df => new { df.Id, df.IdOrdenDeCompra });
modelBuilder.Entity<OrdenDeCompra>()
.HasKey(x => x.Id);
modelBuilder.Entity<OrdenDeCompra>()
.HasMany(x => x.Detalles)
.WithOne()
.HasForeignKey(x => x.IdOrdenDeCompra);
modelBuilder.Entity<DetallePresupuesto>()
.HasKey(df => new { df.Id, df.IdPresupuesto });
modelBuilder.Entity<Presupuesto>()
.HasKey(x => x.Id);
modelBuilder.Entity<Presupuesto>()
.HasMany(x => x.detalles)
.WithOne()
.HasForeignKey(x => x.IdPresupuesto);
modelBuilder.Entity<Lote>()
.HasKey(df => new { df.Id, df.IdRemito });
modelBuilder.Entity<Remito>()
.HasKey(x => x.Id);
modelBuilder.Entity<Remito>()
.HasMany(x => x.Lotes)
.WithOne()
.HasForeignKey(x => x.IdRemito);
modelBuilder.Entity<DetalleFactura>()
.HasOne(df => df.Producto)
.WithMany()
.HasForeignKey(df => df.Producto.Id);
} }
} }

View File

@@ -0,0 +1,591 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Modelo;
#nullable disable
namespace Modelo.Migrations
{
[DbContext(typeof(Context))]
[Migration("20240826212726_nuevasrelaciones")]
partial class nuevasrelaciones
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entidades.Categoria", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Descripcion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Categoria", (string)null);
});
modelBuilder.Entity("Entidades.Cliente", b =>
{
b.Property<long>("Cuit")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Cuit"));
b.Property<string>("Apellido")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("Correo")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.HasKey("Cuit");
b.ToTable("Clientes", (string)null);
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdFactura")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.HasKey("Id", "IdFactura");
b.HasIndex("IdFactura");
b.HasIndex("IdProducto");
b.ToTable("DetallesFacturas", (string)null);
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdOrdenDeCompra")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCU")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdOrdenDeCompra");
b.HasIndex("IdOrdenDeCompra");
b.HasIndex("ProductoId");
b.ToTable("DetalleOrdenDeCompras");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCUPropuesto")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdPresupuesto");
b.HasIndex("IdPresupuesto");
b.HasIndex("ProductoId");
b.ToTable("DetallePresupuestos");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<long>("ClienteCuit")
.HasColumnType("bigint");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<long>("IdCliente")
.HasColumnType("bigint");
b.Property<double>("Total")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClienteCuit");
b.ToTable("Facturas", (string)null);
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdRemito")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdRemito");
b.HasIndex("IdRemito");
b.HasIndex("ProductoId");
b.ToTable("Lotes");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Entregado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("OrdenDeCompras");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Aceptado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Presupuestos");
});
modelBuilder.Entity("Entidades.Producto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("nvarchar(21)");
b.Property<bool>("EsPerecedero")
.HasColumnType("bit");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<double>("Precio")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Producto");
b.HasDiscriminator().HasValue("Producto");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Entidades.Proveedor", b =>
{
b.Property<long>("Cuit")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Cuit"));
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("RazonSocial")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Cuit");
b.ToTable("Proveedores");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdProveedor")
.HasColumnType("int");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Remitos");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.Property<int>("CategoriaId")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("CategoriaId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoCategoria");
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.Property<int>("ProductoId")
.HasColumnType("int");
b.Property<long>("ProveedorId")
.HasColumnType("bigint");
b.HasKey("ProductoId", "ProveedorId");
b.HasIndex("ProveedorId");
b.ToTable("ProductoProveedor");
});
modelBuilder.Entity("Entidades.ProductoNoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<string>("TipoDeEnvase")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasDiscriminator().HasValue("ProductoNoPercedero");
});
modelBuilder.Entity("Entidades.ProductoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<int>("MesesHastaConsumoPreferente")
.HasColumnType("int");
b.Property<int>("MesesHastaVencimiento")
.HasColumnType("int");
b.HasDiscriminator().HasValue("ProductoPercedero");
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.HasOne("Entidades.Factura", null)
.WithMany("Detalles")
.HasForeignKey("IdFactura")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("IdProducto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.HasOne("Entidades.OrdenDeCompra", null)
.WithMany("Detalles")
.HasForeignKey("IdOrdenDeCompra")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.HasOne("Entidades.Presupuesto", null)
.WithMany("Detalles")
.HasForeignKey("IdPresupuesto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.HasOne("Entidades.Cliente", "Cliente")
.WithMany()
.HasForeignKey("ClienteCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cliente");
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.HasOne("Entidades.Remito", null)
.WithMany("Lotes")
.HasForeignKey("IdRemito")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.HasOne("Entidades.Categoria", null)
.WithMany()
.HasForeignKey("CategoriaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Proveedor", null)
.WithMany()
.HasForeignKey("ProveedorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Navigation("Lotes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,443 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Modelo.Migrations
{
/// <inheritdoc />
public partial class nuevasrelaciones : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Categoria",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Descripcion = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Categoria", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Clientes",
columns: table => new
{
Cuit = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Nombre = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
Apellido = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
Direccion = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Correo = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
Habilitado = table.Column<bool>(type: "bit", nullable: false, defaultValue: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Clientes", x => x.Cuit);
});
migrationBuilder.CreateTable(
name: "Producto",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Nombre = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
Precio = table.Column<double>(type: "float", nullable: false),
Habilitado = table.Column<bool>(type: "bit", nullable: false, defaultValue: true),
EsPerecedero = table.Column<bool>(type: "bit", nullable: false),
Discriminator = table.Column<string>(type: "nvarchar(21)", maxLength: 21, nullable: false),
TipoDeEnvase = table.Column<string>(type: "nvarchar(max)", nullable: true),
MesesHastaConsumoPreferente = table.Column<int>(type: "int", nullable: true),
MesesHastaVencimiento = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Producto", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Proveedores",
columns: table => new
{
Cuit = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Nombre = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
RazonSocial = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false),
Direccion = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false),
Habilitado = table.Column<bool>(type: "bit", nullable: false, defaultValue: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Proveedores", x => x.Cuit);
});
migrationBuilder.CreateTable(
name: "Facturas",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Total = table.Column<double>(type: "float", nullable: false),
Fecha = table.Column<DateTime>(type: "datetime2", nullable: false),
IdCliente = table.Column<long>(type: "bigint", nullable: false),
ClienteCuit = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Facturas", x => x.Id);
table.ForeignKey(
name: "FK_Facturas_Clientes_ClienteCuit",
column: x => x.ClienteCuit,
principalTable: "Clientes",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ProductoCategoria",
columns: table => new
{
CategoriaId = table.Column<int>(type: "int", nullable: false),
ProductoId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductoCategoria", x => new { x.CategoriaId, x.ProductoId });
table.ForeignKey(
name: "FK_ProductoCategoria_Categoria_CategoriaId",
column: x => x.CategoriaId,
principalTable: "Categoria",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProductoCategoria_Producto_ProductoId",
column: x => x.ProductoId,
principalTable: "Producto",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OrdenDeCompras",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ProveedorCuit = table.Column<long>(type: "bigint", nullable: false),
IdProveedor = table.Column<long>(type: "bigint", nullable: false),
Entregado = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrdenDeCompras", x => x.Id);
table.ForeignKey(
name: "FK_OrdenDeCompras_Proveedores_ProveedorCuit",
column: x => x.ProveedorCuit,
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Presupuestos",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Fecha = table.Column<DateTime>(type: "datetime2", nullable: false),
Habilitado = table.Column<bool>(type: "bit", nullable: false),
Aceptado = table.Column<bool>(type: "bit", nullable: false),
ProveedorCuit = table.Column<long>(type: "bigint", nullable: false),
IdProveedor = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Presupuestos", x => x.Id);
table.ForeignKey(
name: "FK_Presupuestos_Proveedores_ProveedorCuit",
column: x => x.ProveedorCuit,
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "ProductoProveedor",
columns: table => new
{
ProductoId = table.Column<int>(type: "int", nullable: false),
ProveedorId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProductoProveedor", x => new { x.ProductoId, x.ProveedorId });
table.ForeignKey(
name: "FK_ProductoProveedor_Producto_ProductoId",
column: x => x.ProductoId,
principalTable: "Producto",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProductoProveedor_Proveedores_ProveedorId",
column: x => x.ProveedorId,
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Remitos",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ProveedorCuit = table.Column<long>(type: "bigint", nullable: false),
IdProveedor = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Remitos", x => x.Id);
table.ForeignKey(
name: "FK_Remitos_Proveedores_ProveedorCuit",
column: x => x.ProveedorCuit,
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DetallesFacturas",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
IdFactura = table.Column<int>(type: "int", nullable: false),
Cantidad = table.Column<int>(type: "int", nullable: false),
IdProducto = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DetallesFacturas", x => new { x.Id, x.IdFactura });
table.ForeignKey(
name: "FK_DetallesFacturas_Facturas_IdFactura",
column: x => x.IdFactura,
principalTable: "Facturas",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DetallesFacturas_Producto_IdProducto",
column: x => x.IdProducto,
principalTable: "Producto",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DetalleOrdenDeCompras",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
IdOrdenDeCompra = table.Column<int>(type: "int", nullable: false),
MontoCU = table.Column<double>(type: "float", nullable: false),
IdPresupuesto = table.Column<int>(type: "int", nullable: false),
Cantidad = table.Column<int>(type: "int", nullable: false),
ProductoId = table.Column<int>(type: "int", nullable: false),
IdProducto = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DetalleOrdenDeCompras", x => new { x.Id, x.IdOrdenDeCompra });
table.ForeignKey(
name: "FK_DetalleOrdenDeCompras_OrdenDeCompras_IdOrdenDeCompra",
column: x => x.IdOrdenDeCompra,
principalTable: "OrdenDeCompras",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DetalleOrdenDeCompras_Producto_ProductoId",
column: x => x.ProductoId,
principalTable: "Producto",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DetallePresupuestos",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
IdPresupuesto = table.Column<int>(type: "int", nullable: false),
MontoCUPropuesto = table.Column<double>(type: "float", nullable: false),
Cantidad = table.Column<int>(type: "int", nullable: false),
ProductoId = table.Column<int>(type: "int", nullable: false),
IdProducto = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DetallePresupuestos", x => new { x.Id, x.IdPresupuesto });
table.ForeignKey(
name: "FK_DetallePresupuestos_Presupuestos_IdPresupuesto",
column: x => x.IdPresupuesto,
principalTable: "Presupuestos",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DetallePresupuestos_Producto_ProductoId",
column: x => x.ProductoId,
principalTable: "Producto",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Lotes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
IdRemito = table.Column<int>(type: "int", nullable: false),
Fecha = table.Column<DateTime>(type: "datetime2", nullable: false),
Habilitado = table.Column<bool>(type: "bit", nullable: false),
Cantidad = table.Column<int>(type: "int", nullable: false),
ProductoId = table.Column<int>(type: "int", nullable: false),
IdProducto = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Lotes", x => new { x.Id, x.IdRemito });
table.ForeignKey(
name: "FK_Lotes_Producto_ProductoId",
column: x => x.ProductoId,
principalTable: "Producto",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Lotes_Remitos_IdRemito",
column: x => x.IdRemito,
principalTable: "Remitos",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DetalleOrdenDeCompras_IdOrdenDeCompra",
table: "DetalleOrdenDeCompras",
column: "IdOrdenDeCompra");
migrationBuilder.CreateIndex(
name: "IX_DetalleOrdenDeCompras_ProductoId",
table: "DetalleOrdenDeCompras",
column: "ProductoId");
migrationBuilder.CreateIndex(
name: "IX_DetallePresupuestos_IdPresupuesto",
table: "DetallePresupuestos",
column: "IdPresupuesto");
migrationBuilder.CreateIndex(
name: "IX_DetallePresupuestos_ProductoId",
table: "DetallePresupuestos",
column: "ProductoId");
migrationBuilder.CreateIndex(
name: "IX_DetallesFacturas_IdFactura",
table: "DetallesFacturas",
column: "IdFactura");
migrationBuilder.CreateIndex(
name: "IX_DetallesFacturas_IdProducto",
table: "DetallesFacturas",
column: "IdProducto");
migrationBuilder.CreateIndex(
name: "IX_Facturas_ClienteCuit",
table: "Facturas",
column: "ClienteCuit");
migrationBuilder.CreateIndex(
name: "IX_Lotes_IdRemito",
table: "Lotes",
column: "IdRemito");
migrationBuilder.CreateIndex(
name: "IX_Lotes_ProductoId",
table: "Lotes",
column: "ProductoId");
migrationBuilder.CreateIndex(
name: "IX_OrdenDeCompras_ProveedorCuit",
table: "OrdenDeCompras",
column: "ProveedorCuit");
migrationBuilder.CreateIndex(
name: "IX_Presupuestos_ProveedorCuit",
table: "Presupuestos",
column: "ProveedorCuit");
migrationBuilder.CreateIndex(
name: "IX_ProductoCategoria_ProductoId",
table: "ProductoCategoria",
column: "ProductoId");
migrationBuilder.CreateIndex(
name: "IX_ProductoProveedor_ProveedorId",
table: "ProductoProveedor",
column: "ProveedorId");
migrationBuilder.CreateIndex(
name: "IX_Remitos_ProveedorCuit",
table: "Remitos",
column: "ProveedorCuit");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DetalleOrdenDeCompras");
migrationBuilder.DropTable(
name: "DetallePresupuestos");
migrationBuilder.DropTable(
name: "DetallesFacturas");
migrationBuilder.DropTable(
name: "Lotes");
migrationBuilder.DropTable(
name: "ProductoCategoria");
migrationBuilder.DropTable(
name: "ProductoProveedor");
migrationBuilder.DropTable(
name: "OrdenDeCompras");
migrationBuilder.DropTable(
name: "Presupuestos");
migrationBuilder.DropTable(
name: "Facturas");
migrationBuilder.DropTable(
name: "Remitos");
migrationBuilder.DropTable(
name: "Categoria");
migrationBuilder.DropTable(
name: "Producto");
migrationBuilder.DropTable(
name: "Clientes");
migrationBuilder.DropTable(
name: "Proveedores");
}
}
}

View File

@@ -0,0 +1,591 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Modelo;
#nullable disable
namespace Modelo.Migrations
{
[DbContext(typeof(Context))]
[Migration("20240826213353_fixrelacionproductocategoria")]
partial class fixrelacionproductocategoria
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entidades.Categoria", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Descripcion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Categoria", (string)null);
});
modelBuilder.Entity("Entidades.Cliente", b =>
{
b.Property<long>("Cuit")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Cuit"));
b.Property<string>("Apellido")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("Correo")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.HasKey("Cuit");
b.ToTable("Clientes", (string)null);
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdFactura")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.HasKey("Id", "IdFactura");
b.HasIndex("IdFactura");
b.HasIndex("IdProducto");
b.ToTable("DetallesFacturas", (string)null);
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdOrdenDeCompra")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCU")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdOrdenDeCompra");
b.HasIndex("IdOrdenDeCompra");
b.HasIndex("ProductoId");
b.ToTable("DetalleOrdenDeCompras");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCUPropuesto")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdPresupuesto");
b.HasIndex("IdPresupuesto");
b.HasIndex("ProductoId");
b.ToTable("DetallePresupuestos");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<long>("ClienteCuit")
.HasColumnType("bigint");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<long>("IdCliente")
.HasColumnType("bigint");
b.Property<double>("Total")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClienteCuit");
b.ToTable("Facturas", (string)null);
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdRemito")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdRemito");
b.HasIndex("IdRemito");
b.HasIndex("ProductoId");
b.ToTable("Lotes");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Entregado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("OrdenDeCompras");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Aceptado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Presupuestos");
});
modelBuilder.Entity("Entidades.Producto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("nvarchar(21)");
b.Property<bool>("EsPerecedero")
.HasColumnType("bit");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<double>("Precio")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Producto");
b.HasDiscriminator().HasValue("Producto");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Entidades.Proveedor", b =>
{
b.Property<long>("Cuit")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Cuit"));
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("RazonSocial")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Cuit");
b.ToTable("Proveedores");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdProveedor")
.HasColumnType("int");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Remitos");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.Property<int>("CategoriaId")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("CategoriaId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoCategoria");
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.Property<int>("ProductoId")
.HasColumnType("int");
b.Property<long>("ProveedorId")
.HasColumnType("bigint");
b.HasKey("ProductoId", "ProveedorId");
b.HasIndex("ProveedorId");
b.ToTable("ProductoProveedor");
});
modelBuilder.Entity("Entidades.ProductoNoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<string>("TipoDeEnvase")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasDiscriminator().HasValue("ProductoNoPercedero");
});
modelBuilder.Entity("Entidades.ProductoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<int>("MesesHastaConsumoPreferente")
.HasColumnType("int");
b.Property<int>("MesesHastaVencimiento")
.HasColumnType("int");
b.HasDiscriminator().HasValue("ProductoPercedero");
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.HasOne("Entidades.Factura", null)
.WithMany("Detalles")
.HasForeignKey("IdFactura")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("IdProducto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.HasOne("Entidades.OrdenDeCompra", null)
.WithMany("Detalles")
.HasForeignKey("IdOrdenDeCompra")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.HasOne("Entidades.Presupuesto", null)
.WithMany("Detalles")
.HasForeignKey("IdPresupuesto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.HasOne("Entidades.Cliente", "Cliente")
.WithMany()
.HasForeignKey("ClienteCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cliente");
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.HasOne("Entidades.Remito", null)
.WithMany("Lotes")
.HasForeignKey("IdRemito")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.HasOne("Entidades.Categoria", null)
.WithMany()
.HasForeignKey("CategoriaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Proveedor", null)
.WithMany()
.HasForeignKey("ProveedorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Navigation("Lotes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Modelo.Migrations
{
/// <inheritdoc />
public partial class fixrelacionproductocategoria : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -0,0 +1,591 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Modelo;
#nullable disable
namespace Modelo.Migrations
{
[DbContext(typeof(Context))]
[Migration("20240826222040_cambiadapkcompuesta")]
partial class cambiadapkcompuesta
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entidades.Categoria", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Descripcion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Categoria", (string)null);
});
modelBuilder.Entity("Entidades.Cliente", b =>
{
b.Property<long>("Cuit")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Cuit"));
b.Property<string>("Apellido")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("Correo")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.HasKey("Cuit");
b.ToTable("Clientes", (string)null);
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdFactura")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.HasKey("Id", "IdFactura");
b.HasIndex("IdFactura");
b.HasIndex("IdProducto");
b.ToTable("DetallesFacturas", (string)null);
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdOrdenDeCompra")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCU")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdOrdenDeCompra");
b.HasIndex("IdOrdenDeCompra");
b.HasIndex("ProductoId");
b.ToTable("DetalleOrdenDeCompras");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCUPropuesto")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdPresupuesto");
b.HasIndex("IdPresupuesto");
b.HasIndex("ProductoId");
b.ToTable("DetallePresupuestos");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<long>("ClienteCuit")
.HasColumnType("bigint");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<long>("IdCliente")
.HasColumnType("bigint");
b.Property<double>("Total")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClienteCuit");
b.ToTable("Facturas", (string)null);
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdRemito")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdRemito");
b.HasIndex("IdRemito");
b.HasIndex("ProductoId");
b.ToTable("Lotes");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Entregado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("OrdenDeCompras");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Aceptado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Presupuestos");
});
modelBuilder.Entity("Entidades.Producto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("nvarchar(21)");
b.Property<bool>("EsPerecedero")
.HasColumnType("bit");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<double>("Precio")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Producto");
b.HasDiscriminator().HasValue("Producto");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Entidades.Proveedor", b =>
{
b.Property<long>("Cuit")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Cuit"));
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("RazonSocial")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Cuit");
b.ToTable("Proveedores");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdProveedor")
.HasColumnType("int");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Remitos");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.Property<int>("CategoriaId")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("CategoriaId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoCategoria");
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.Property<long>("ProveedorId")
.HasColumnType("bigint");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("ProveedorId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoProveedor");
});
modelBuilder.Entity("Entidades.ProductoNoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<string>("TipoDeEnvase")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasDiscriminator().HasValue("ProductoNoPercedero");
});
modelBuilder.Entity("Entidades.ProductoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<int>("MesesHastaConsumoPreferente")
.HasColumnType("int");
b.Property<int>("MesesHastaVencimiento")
.HasColumnType("int");
b.HasDiscriminator().HasValue("ProductoPercedero");
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.HasOne("Entidades.Factura", null)
.WithMany("Detalles")
.HasForeignKey("IdFactura")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("IdProducto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.HasOne("Entidades.OrdenDeCompra", null)
.WithMany("Detalles")
.HasForeignKey("IdOrdenDeCompra")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.HasOne("Entidades.Presupuesto", null)
.WithMany("Detalles")
.HasForeignKey("IdPresupuesto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.HasOne("Entidades.Cliente", "Cliente")
.WithMany()
.HasForeignKey("ClienteCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cliente");
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.HasOne("Entidades.Remito", null)
.WithMany("Lotes")
.HasForeignKey("IdRemito")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.HasOne("Entidades.Categoria", null)
.WithMany()
.HasForeignKey("CategoriaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Proveedor", null)
.WithMany()
.HasForeignKey("ProveedorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Navigation("Lotes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,54 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Modelo.Migrations
{
/// <inheritdoc />
public partial class cambiadapkcompuesta : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_ProductoProveedor",
table: "ProductoProveedor");
migrationBuilder.DropIndex(
name: "IX_ProductoProveedor_ProveedorId",
table: "ProductoProveedor");
migrationBuilder.AddPrimaryKey(
name: "PK_ProductoProveedor",
table: "ProductoProveedor",
columns: new[] { "ProveedorId", "ProductoId" });
migrationBuilder.CreateIndex(
name: "IX_ProductoProveedor_ProductoId",
table: "ProductoProveedor",
column: "ProductoId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_ProductoProveedor",
table: "ProductoProveedor");
migrationBuilder.DropIndex(
name: "IX_ProductoProveedor_ProductoId",
table: "ProductoProveedor");
migrationBuilder.AddPrimaryKey(
name: "PK_ProductoProveedor",
table: "ProductoProveedor",
columns: new[] { "ProductoId", "ProveedorId" });
migrationBuilder.CreateIndex(
name: "IX_ProductoProveedor_ProveedorId",
table: "ProductoProveedor",
column: "ProveedorId");
}
}
}

View File

@@ -0,0 +1,585 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Modelo;
#nullable disable
namespace Modelo.Migrations
{
[DbContext(typeof(Context))]
[Migration("20240827025739_CuitNotGenerateValue")]
partial class CuitNotGenerateValue
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entidades.Categoria", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Descripcion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Categoria", (string)null);
});
modelBuilder.Entity("Entidades.Cliente", b =>
{
b.Property<long>("Cuit")
.HasColumnType("bigint");
b.Property<string>("Apellido")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("Correo")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.HasKey("Cuit");
b.ToTable("Clientes", (string)null);
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdFactura")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.HasKey("Id", "IdFactura");
b.HasIndex("IdFactura");
b.HasIndex("IdProducto");
b.ToTable("DetallesFacturas", (string)null);
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdOrdenDeCompra")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCU")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdOrdenDeCompra");
b.HasIndex("IdOrdenDeCompra");
b.HasIndex("ProductoId");
b.ToTable("DetalleOrdenDeCompras");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCUPropuesto")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdPresupuesto");
b.HasIndex("IdPresupuesto");
b.HasIndex("ProductoId");
b.ToTable("DetallePresupuestos");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<long>("ClienteCuit")
.HasColumnType("bigint");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<long>("IdCliente")
.HasColumnType("bigint");
b.Property<double>("Total")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClienteCuit");
b.ToTable("Facturas", (string)null);
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdRemito")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdRemito");
b.HasIndex("IdRemito");
b.HasIndex("ProductoId");
b.ToTable("Lotes");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Entregado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("OrdenDeCompras");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Aceptado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Presupuestos");
});
modelBuilder.Entity("Entidades.Producto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("nvarchar(21)");
b.Property<bool>("EsPerecedero")
.HasColumnType("bit");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<double>("Precio")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Producto");
b.HasDiscriminator().HasValue("Producto");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Entidades.Proveedor", b =>
{
b.Property<long>("Cuit")
.HasColumnType("bigint");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("RazonSocial")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Cuit");
b.ToTable("Proveedores");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdProveedor")
.HasColumnType("int");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Remitos");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.Property<int>("CategoriaId")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("CategoriaId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoCategoria");
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.Property<long>("ProveedorId")
.HasColumnType("bigint");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("ProveedorId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoProveedor");
});
modelBuilder.Entity("Entidades.ProductoNoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<string>("TipoDeEnvase")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasDiscriminator().HasValue("ProductoNoPercedero");
});
modelBuilder.Entity("Entidades.ProductoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<int>("MesesHastaConsumoPreferente")
.HasColumnType("int");
b.Property<int>("MesesHastaVencimiento")
.HasColumnType("int");
b.HasDiscriminator().HasValue("ProductoPercedero");
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.HasOne("Entidades.Factura", null)
.WithMany("Detalles")
.HasForeignKey("IdFactura")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("IdProducto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.HasOne("Entidades.OrdenDeCompra", null)
.WithMany("Detalles")
.HasForeignKey("IdOrdenDeCompra")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.HasOne("Entidades.Presupuesto", null)
.WithMany("detalles")
.HasForeignKey("IdPresupuesto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.HasOne("Entidades.Cliente", "Cliente")
.WithMany()
.HasForeignKey("ClienteCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cliente");
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.HasOne("Entidades.Remito", null)
.WithMany("Lotes")
.HasForeignKey("IdRemito")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.HasOne("Entidades.Categoria", null)
.WithMany()
.HasForeignKey("CategoriaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Proveedor", null)
.WithMany()
.HasForeignKey("ProveedorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Navigation("detalles");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Navigation("Lotes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,163 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Modelo.Migrations
{
/// <inheritdoc />
public partial class CuitNotGenerateValue : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Facturas_Clientes_ClienteCuit",
table: "Facturas");
migrationBuilder.DropForeignKey(
name: "FK_Remitos_Proveedores_ProveedorCuit",
table: "Remitos");
migrationBuilder.DropForeignKey(
name: "FK_ProductoProveedor_Proveedores_ProveedorId",
table: "ProductoProveedor");
migrationBuilder.DropForeignKey(
name: "FK_Presupuestos_Proveedores_ProveedorCuit",
table: "Presupuestos");
migrationBuilder.DropForeignKey(
name: "FK_OrdenDeCompras_Proveedores_ProveedorCuit",
table: "OrdenDeCompras");
migrationBuilder.DropPrimaryKey(
name:"PK_Clientes",
table: "Clientes");
migrationBuilder.DropColumn(
name:"Cuit",
table: "Clientes");
migrationBuilder.DropPrimaryKey(
name: "PK_Proveedores",
table: "Proveedores");
migrationBuilder.DropColumn(
name:"Cuit",
table: "Proveedores");
migrationBuilder.AddColumn<long>(
name: "Cuit",
table: "Clientes",
nullable: false,
defaultValue: 0);
migrationBuilder.AddPrimaryKey(
name: "PK_Clientes",
table: "Clientes",
column: "Cuit");
migrationBuilder.AddColumn<long>(
name: "Cuit",
table: "Proveedores",
nullable: false,
defaultValue: 0);
migrationBuilder.AddPrimaryKey(
name: "PK_Proveedores",
table: "Proveedores",
column: "Cuit");
migrationBuilder.AddForeignKey(
name: "FK_Facturas_Clientes_ClienteCuit",
table: "Facturas",
column: "ClienteCuit",
principalTable: "Clientes",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Remitos_Proveedores_ProveedorCuit",
table: "Remitos",
column: "ProveedorCuit",
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ProductoProveedor_Proveedores_ProveedorId",
table: "ProductoProveedor",
column: "ProveedorId",
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Presupuestos_Proveedores_ProveedorCuit",
table: "Presupuestos",
column: "ProveedorCuit",
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_OrdenDeCompras_Proveedores_ProveedorCuit",
table: "OrdenDeCompras",
column: "ProveedorCuit",
principalTable: "Proveedores",
principalColumn: "Cuit",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "Cuit",
table: "Clientes");
migrationBuilder.DropColumn(
name: "Cuit",
table: "Clientes");
migrationBuilder.DropPrimaryKey(
name: "Cuit",
table: "Proveedores");
migrationBuilder.DropColumn(
name: "Cuit",
table: "Proveedores");
migrationBuilder.AddColumn<long>(
name: "Cuit",
table: "Proveedores",
type: "bigint",
nullable: false,
defaultValue: 0L)
.Annotation("SqlServer:Identity", "1, 1");
migrationBuilder.AddColumn<long>(
name: "Cuit",
table: "Clientes",
type: "bigint",
nullable: false,
defaultValue: 0L)
.Annotation("SqlServer:Identity", "1, 1");
migrationBuilder.AddPrimaryKey(
name: "Cuit",
table: "Proveedores",
column: "Cuit");
migrationBuilder.AddPrimaryKey(
name: "Cuit",
table: "Clientes",
column: "Cuit");
}
}
}

View File

@@ -1,4 +1,5 @@
// <auto-generated /> // <auto-generated />
using System;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
@@ -16,10 +17,565 @@ namespace Modelo.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "8.0.7") .HasAnnotation("ProductVersion", "8.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 128); .HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Entidades.Categoria", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Descripcion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Categoria", (string)null);
});
modelBuilder.Entity("Entidades.Cliente", b =>
{
b.Property<long>("Cuit")
.HasColumnType("bigint");
b.Property<string>("Apellido")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("Correo")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("nvarchar(150)");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.HasKey("Cuit");
b.ToTable("Clientes", (string)null);
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdFactura")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.HasKey("Id", "IdFactura");
b.HasIndex("IdFactura");
b.HasIndex("IdProducto");
b.ToTable("DetallesFacturas", (string)null);
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdOrdenDeCompra")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCU")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdOrdenDeCompra");
b.HasIndex("IdOrdenDeCompra");
b.HasIndex("ProductoId");
b.ToTable("DetalleOrdenDeCompras");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdPresupuesto")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<double>("MontoCUPropuesto")
.HasColumnType("float");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdPresupuesto");
b.HasIndex("IdPresupuesto");
b.HasIndex("ProductoId");
b.ToTable("DetallePresupuestos");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<long>("ClienteCuit")
.HasColumnType("bigint");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<long>("IdCliente")
.HasColumnType("bigint");
b.Property<double>("Total")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClienteCuit");
b.ToTable("Facturas", (string)null);
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.Property<int>("Id")
.HasColumnType("int");
b.Property<int>("IdRemito")
.HasColumnType("int");
b.Property<int>("Cantidad")
.HasColumnType("int");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<int>("IdProducto")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("Id", "IdRemito");
b.HasIndex("IdRemito");
b.HasIndex("ProductoId");
b.ToTable("Lotes");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Entregado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("OrdenDeCompras");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Aceptado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<bool>("Habilitado")
.HasColumnType("bit");
b.Property<long>("IdProveedor")
.HasColumnType("bigint");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Presupuestos");
});
modelBuilder.Entity("Entidades.Producto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("nvarchar(21)");
b.Property<bool>("EsPerecedero")
.HasColumnType("bit");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<double>("Precio")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Producto");
b.HasDiscriminator().HasValue("Producto");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Entidades.Proveedor", b =>
{
b.Property<long>("Cuit")
.HasColumnType("bigint");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<string>("RazonSocial")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Cuit");
b.ToTable("Proveedores");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("IdProveedor")
.HasColumnType("int");
b.Property<long>("ProveedorCuit")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Remitos");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.Property<int>("CategoriaId")
.HasColumnType("int");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("CategoriaId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoCategoria");
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.Property<long>("ProveedorId")
.HasColumnType("bigint");
b.Property<int>("ProductoId")
.HasColumnType("int");
b.HasKey("ProveedorId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoProveedor");
});
modelBuilder.Entity("Entidades.ProductoNoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<string>("TipoDeEnvase")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasDiscriminator().HasValue("ProductoNoPercedero");
});
modelBuilder.Entity("Entidades.ProductoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<int>("MesesHastaConsumoPreferente")
.HasColumnType("int");
b.Property<int>("MesesHastaVencimiento")
.HasColumnType("int");
b.HasDiscriminator().HasValue("ProductoPercedero");
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.HasOne("Entidades.Factura", null)
.WithMany("Detalles")
.HasForeignKey("IdFactura")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("IdProducto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.HasOne("Entidades.OrdenDeCompra", null)
.WithMany("Detalles")
.HasForeignKey("IdOrdenDeCompra")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.HasOne("Entidades.Presupuesto", null)
.WithMany("detalles")
.HasForeignKey("IdPresupuesto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.HasOne("Entidades.Cliente", "Cliente")
.WithMany()
.HasForeignKey("ClienteCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cliente");
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.HasOne("Entidades.Remito", null)
.WithMany("Lotes")
.HasForeignKey("IdRemito")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.HasOne("Entidades.Categoria", null)
.WithMany()
.HasForeignKey("CategoriaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Proveedor", null)
.WithMany()
.HasForeignKey("ProveedorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Navigation("detalles");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Navigation("Lotes");
});
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }
} }

View File

@@ -4,7 +4,7 @@ namespace Modelo
{ {
public abstract class Repositorio<T> public abstract class Repositorio<T>
{ {
protected Context context; protected Context context = new Context(); //no voy a usar esta instancia igualmente
public abstract List<T> Listar(); public abstract List<T> Listar();
public abstract void Add(T t); public abstract void Add(T t);
public abstract void Del(T t); public abstract void Del(T t);
@@ -16,11 +16,13 @@ namespace Modelo
try try
{ {
context.SaveChanges(); context.SaveChanges();
context.Dispose();
context = new Context();
ret = true; ret = true;
} }
catch (DbUpdateException) catch (DbUpdateException ex)
{ {
throw; Console.Error.WriteLine(ex);
} }
return ret; return ret;

View File

@@ -10,7 +10,6 @@ namespace Modelo
public RepositorioCategoria(Context context) public RepositorioCategoria(Context context)
{ {
this.context = context;
} }
public override List<Categoria> Listar() public override List<Categoria> Listar()
@@ -20,7 +19,7 @@ namespace Modelo
public Categoria ObtenerPorId(int Tid) public Categoria ObtenerPorId(int Tid)
{ {
Categoria cat = context.Categorias.First(x => x.Id == Tid); Categoria cat = context.Categorias.FirstOrDefault(x => x.Id == Tid);
return cat ?? new Categoria(); return cat ?? new Categoria();
} }

View File

@@ -7,6 +7,7 @@ namespace Modelo
{ {
public RepositorioClientes(Context context) public RepositorioClientes(Context context)
{ {
this.context = context; this.context = context;
} }
@@ -15,9 +16,9 @@ namespace Modelo
return context.Clientes.ToList(); return context.Clientes.ToList();
} }
public Cliente ObtenerPorId(long Tid) public Cliente ObtenerPorId(Int64 Tid)
{ {
Cliente cli = context.Clientes.First(x => x.Cuit == Tid); Cliente cli = context.Clientes.FirstOrDefault(x => x.Cuit == Tid);
return cli ?? new Cliente(); return cli ?? new Cliente();
} }

View File

@@ -1,6 +1,6 @@
namespace Vista namespace Vista
{ {
partial class AddCategoria partial class FrmCategoria
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -90,7 +90,7 @@
btnAceptar.UseVisualStyleBackColor = true; btnAceptar.UseVisualStyleBackColor = true;
btnAceptar.Click += button1_Click; btnAceptar.Click += button1_Click;
// //
// AddCategoria // FrmCategoria
// //
AcceptButton = btnAceptar; AcceptButton = btnAceptar;
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@@ -103,7 +103,7 @@
Controls.Add(label2); Controls.Add(label2);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(btnCancelar); Controls.Add(btnCancelar);
Name = "AddCategoria"; Name = "FrmCategoria";
Text = "Añadir Categoria"; Text = "Añadir Categoria";
((System.ComponentModel.ISupportInitialize)numid).EndInit(); ((System.ComponentModel.ISupportInitialize)numid).EndInit();
ResumeLayout(false); ResumeLayout(false);

View File

@@ -12,10 +12,10 @@ using System.Windows.Forms;
namespace Vista namespace Vista
{ {
public partial class AddCategoria : Form public partial class FrmCategoria : Form
{ {
private Categoria? categoria; private Categoria? categoria;
public AddCategoria() public FrmCategoria()
{ {
InitializeComponent(); InitializeComponent();
CargarDatos(); CargarDatos();
@@ -28,7 +28,12 @@ namespace Vista
} }
private void CargarDatos() private void CargarDatos()
{ {
numid.Value = ControladoraCategorias.Instance.Listar().Max(x => x.Id + 1); var list = ControladoraCategorias.Instance.Listar();
var num = (list.Count == 0) ?
1:
list.Max(x => x.Id + 1);
numid.Value = num;
numid.Enabled = false; numid.Enabled = false;
} }
@@ -41,12 +46,6 @@ namespace Vista
else if (textBox1.Text.Length > 100) // Ajusta el límite según sea necesario else if (textBox1.Text.Length > 100) // Ajusta el límite según sea necesario
devolucion += "La descripción no puede superar los 100 caracteres\n"; devolucion += "La descripción no puede superar los 100 caracteres\n";
// Validar unicidad del ID solo si es una nueva categoría
if (categoria == null && ControladoraCategorias.Instance.Listar().Any(c => c.Id == (int)numid.Value))
{
devolucion += "Ya existe una categoría con el mismo ID\n";
}
if (devolucion == "") if (devolucion == "")
{ {
return true; return true;
@@ -69,7 +68,6 @@ namespace Vista
{ {
categoria = new Categoria categoria = new Categoria
{ {
Id = (int)numid.Value,
Descripcion = textBox1.Text Descripcion = textBox1.Text
}; };

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
@@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@@ -48,7 +48,7 @@
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter

78
Vista/FrmCategorias.Designer.cs generated Normal file
View File

@@ -0,0 +1,78 @@
namespace Vista
{
partial class FrmCategorias
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dgvCategorias = new DataGridView();
btnAñadir = new Button();
((System.ComponentModel.ISupportInitialize)dgvCategorias).BeginInit();
SuspendLayout();
//
// dgvCategorias
//
dgvCategorias.AllowUserToAddRows = false;
dgvCategorias.AllowUserToDeleteRows = false;
dgvCategorias.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvCategorias.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvCategorias.Location = new Point(12, 12);
dgvCategorias.MultiSelect = false;
dgvCategorias.Name = "dgvCategorias";
dgvCategorias.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvCategorias.Size = new Size(498, 289);
dgvCategorias.TabIndex = 0;
//
// btnAñadir
//
btnAñadir.Location = new Point(516, 12);
btnAñadir.Name = "btnAñadir";
btnAñadir.Size = new Size(75, 23);
btnAñadir.TabIndex = 1;
btnAñadir.Text = "Añadir";
btnAñadir.UseVisualStyleBackColor = true;
btnAñadir.Click += btnAñadir_Click;
//
// FrmCategorias
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(btnAñadir);
Controls.Add(dgvCategorias);
Name = "FrmCategorias";
Text = "FrmCategorias";
WindowState = FormWindowState.Maximized;
((System.ComponentModel.ISupportInitialize)dgvCategorias).EndInit();
ResumeLayout(false);
}
#endregion
private DataGridView dgvCategorias;
private Button btnAñadir;
}
}

34
Vista/FrmCategorias.cs Normal file
View File

@@ -0,0 +1,34 @@
using Controladora;
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 Vista
{
public partial class FrmCategorias : Form
{
public FrmCategorias()
{
InitializeComponent();
RecargarTabla();
}
private void RecargarTabla()
{
dgvCategorias.DataSource = ControladoraCategorias.Instance.Listar();
}
private void btnAñadir_Click(object sender, EventArgs e)
{
new FrmCategoria().ShowDialog();
RecargarTabla();
}
}
}

120
Vista/FrmCategorias.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -73,7 +73,6 @@ namespace Vista
IdOrdenDeCompra = Convert.ToInt32(numId.Value), IdOrdenDeCompra = Convert.ToInt32(numId.Value),
MontoCU = detalle.MontoCUPropuesto, MontoCU = detalle.MontoCUPropuesto,
Producto = detalle.Producto, Producto = detalle.Producto,
presupuesto = pres,
}); });
} }

View File

@@ -37,7 +37,6 @@
txtNombre = new TextBox(); txtNombre = new TextBox();
numPrecio = new NumericUpDown(); numPrecio = new NumericUpDown();
checkHabilitado = new CheckBox(); checkHabilitado = new CheckBox();
cmbCategoria = new ComboBox();
btnacept = new Button(); btnacept = new Button();
btncancel = new Button(); btncancel = new Button();
label6 = new Label(); label6 = new Label();
@@ -52,13 +51,20 @@
label10 = new Label(); label10 = new Label();
numericUpDown1 = new NumericUpDown(); numericUpDown1 = new NumericUpDown();
numericUpDown2 = new NumericUpDown(); numericUpDown2 = new NumericUpDown();
comboBox1 = new ComboBox(); cmbEnvase = new ComboBox();
dgvCategoria = new DataGridView();
label11 = new Label();
dgvCategoriaAñadida = new DataGridView();
btnaddCategoria = new Button();
btnrmCategoria = new Button();
((System.ComponentModel.ISupportInitialize)numId).BeginInit(); ((System.ComponentModel.ISupportInitialize)numId).BeginInit();
((System.ComponentModel.ISupportInitialize)numPrecio).BeginInit(); ((System.ComponentModel.ISupportInitialize)numPrecio).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvProveedorAñadido).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvProveedorAñadido).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvProveedor).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvProveedor).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit(); ((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit(); ((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvCategoria).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvCategoriaAñadida).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// label1 // label1
@@ -100,7 +106,7 @@
// label5 // label5
// //
label5.AutoSize = true; label5.AutoSize = true;
label5.Location = new Point(7, 142); label5.Location = new Point(373, 9);
label5.Name = "label5"; label5.Name = "label5";
label5.Size = new Size(58, 15); label5.Size = new Size(58, 15);
label5.TabIndex = 4; label5.TabIndex = 4;
@@ -140,18 +146,9 @@
checkHabilitado.TabIndex = 8; checkHabilitado.TabIndex = 8;
checkHabilitado.UseVisualStyleBackColor = true; checkHabilitado.UseVisualStyleBackColor = true;
// //
// cmbCategoria
//
cmbCategoria.DropDownStyle = ComboBoxStyle.DropDownList;
cmbCategoria.FormattingEnabled = true;
cmbCategoria.Location = new Point(70, 134);
cmbCategoria.Name = "cmbCategoria";
cmbCategoria.Size = new Size(121, 23);
cmbCategoria.TabIndex = 9;
//
// btnacept // btnacept
// //
btnacept.Location = new Point(14, 336); btnacept.Location = new Point(13, 311);
btnacept.Name = "btnacept"; btnacept.Name = "btnacept";
btnacept.Size = new Size(72, 21); btnacept.Size = new Size(72, 21);
btnacept.TabIndex = 10; btnacept.TabIndex = 10;
@@ -161,7 +158,7 @@
// //
// btncancel // btncancel
// //
btncancel.Location = new Point(106, 336); btncancel.Location = new Point(105, 311);
btncancel.Name = "btncancel"; btncancel.Name = "btncancel";
btncancel.Size = new Size(68, 21); btncancel.Size = new Size(68, 21);
btncancel.TabIndex = 11; btncancel.TabIndex = 11;
@@ -172,7 +169,7 @@
// label6 // label6
// //
label6.AutoSize = true; label6.AutoSize = true;
label6.Location = new Point(230, 12); label6.Location = new Point(652, 216);
label6.Name = "label6"; label6.Name = "label6";
label6.Size = new Size(123, 15); label6.Size = new Size(123, 15);
label6.TabIndex = 12; label6.TabIndex = 12;
@@ -181,7 +178,7 @@
// label7 // label7
// //
label7.AutoSize = true; label7.AutoSize = true;
label7.Location = new Point(494, 9); label7.Location = new Point(652, 9);
label7.Name = "label7"; label7.Name = "label7";
label7.Size = new Size(72, 15); label7.Size = new Size(72, 15);
label7.TabIndex = 13; label7.TabIndex = 13;
@@ -193,9 +190,8 @@
dgvProveedorAñadido.AllowUserToDeleteRows = false; dgvProveedorAñadido.AllowUserToDeleteRows = false;
dgvProveedorAñadido.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvProveedorAñadido.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProveedorAñadido.EditMode = DataGridViewEditMode.EditProgrammatically; dgvProveedorAñadido.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvProveedorAñadido.Location = new Point(230, 30); dgvProveedorAñadido.Location = new Point(652, 234);
dgvProveedorAñadido.Name = "dgvProveedorAñadido"; dgvProveedorAñadido.Name = "dgvProveedorAñadido";
dgvProveedorAñadido.RowTemplate.Height = 25;
dgvProveedorAñadido.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvProveedorAñadido.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProveedorAñadido.Size = new Size(240, 150); dgvProveedorAñadido.Size = new Size(240, 150);
dgvProveedorAñadido.TabIndex = 14; dgvProveedorAñadido.TabIndex = 14;
@@ -204,7 +200,7 @@
// //
dgvProveedor.AllowUserToAddRows = false; dgvProveedor.AllowUserToAddRows = false;
dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProveedor.Location = new Point(494, 30); dgvProveedor.Location = new Point(652, 30);
dgvProveedor.Name = "dgvProveedor"; dgvProveedor.Name = "dgvProveedor";
dgvProveedor.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvProveedor.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProveedor.Size = new Size(240, 150); dgvProveedor.Size = new Size(240, 150);
@@ -212,7 +208,7 @@
// //
// btnaddProveedor // btnaddProveedor
// //
btnaddProveedor.Location = new Point(740, 30); btnaddProveedor.Location = new Point(652, 186);
btnaddProveedor.Name = "btnaddProveedor"; btnaddProveedor.Name = "btnaddProveedor";
btnaddProveedor.Size = new Size(72, 21); btnaddProveedor.Size = new Size(72, 21);
btnaddProveedor.TabIndex = 16; btnaddProveedor.TabIndex = 16;
@@ -222,7 +218,7 @@
// //
// btnrmProveedor // btnrmProveedor
// //
btnrmProveedor.Location = new Point(740, 57); btnrmProveedor.Location = new Point(820, 186);
btnrmProveedor.Name = "btnrmProveedor"; btnrmProveedor.Name = "btnrmProveedor";
btnrmProveedor.Size = new Size(72, 21); btnrmProveedor.Size = new Size(72, 21);
btnrmProveedor.TabIndex = 17; btnrmProveedor.TabIndex = 17;
@@ -233,7 +229,7 @@
// checkBox1 // checkBox1
// //
checkBox1.AutoSize = true; checkBox1.AutoSize = true;
checkBox1.Location = new Point(7, 187); checkBox1.Location = new Point(6, 183);
checkBox1.Name = "checkBox1"; checkBox1.Name = "checkBox1";
checkBox1.Size = new Size(79, 19); checkBox1.Size = new Size(79, 19);
checkBox1.TabIndex = 18; checkBox1.TabIndex = 18;
@@ -244,7 +240,7 @@
// label8 // label8
// //
label8.AutoSize = true; label8.AutoSize = true;
label8.Location = new Point(25, 230); label8.Location = new Point(24, 205);
label8.Name = "label8"; label8.Name = "label8";
label8.Size = new Size(185, 15); label8.Size = new Size(185, 15);
label8.TabIndex = 20; label8.TabIndex = 20;
@@ -253,7 +249,7 @@
// label9 // label9
// //
label9.AutoSize = true; label9.AutoSize = true;
label9.Location = new Point(141, 289); label9.Location = new Point(140, 264);
label9.Name = "label9"; label9.Name = "label9";
label9.Size = new Size(69, 15); label9.Size = new Size(69, 15);
label9.TabIndex = 21; label9.TabIndex = 21;
@@ -262,7 +258,7 @@
// label10 // label10
// //
label10.AutoSize = true; label10.AutoSize = true;
label10.Location = new Point(68, 259); label10.Location = new Point(67, 234);
label10.Name = "label10"; label10.Name = "label10";
label10.Size = new Size(142, 15); label10.Size = new Size(142, 15);
label10.TabIndex = 22; label10.TabIndex = 22;
@@ -271,7 +267,7 @@
// numericUpDown1 // numericUpDown1
// //
numericUpDown1.Enabled = false; numericUpDown1.Enabled = false;
numericUpDown1.Location = new Point(230, 222); numericUpDown1.Location = new Point(229, 197);
numericUpDown1.Name = "numericUpDown1"; numericUpDown1.Name = "numericUpDown1";
numericUpDown1.Size = new Size(120, 23); numericUpDown1.Size = new Size(120, 23);
numericUpDown1.TabIndex = 23; numericUpDown1.TabIndex = 23;
@@ -280,20 +276,71 @@
// numericUpDown2 // numericUpDown2
// //
numericUpDown2.Enabled = false; numericUpDown2.Enabled = false;
numericUpDown2.Location = new Point(229, 252); numericUpDown2.Location = new Point(228, 227);
numericUpDown2.Name = "numericUpDown2"; numericUpDown2.Name = "numericUpDown2";
numericUpDown2.Size = new Size(120, 23); numericUpDown2.Size = new Size(120, 23);
numericUpDown2.TabIndex = 24; numericUpDown2.TabIndex = 24;
numericUpDown2.ValueChanged += numericUpDown2_ValueChanged; numericUpDown2.ValueChanged += numericUpDown2_ValueChanged;
// //
// comboBox1 // cmbEnvase
// //
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; cmbEnvase.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.FormattingEnabled = true; cmbEnvase.FormattingEnabled = true;
comboBox1.Location = new Point(228, 281); cmbEnvase.Location = new Point(227, 256);
comboBox1.Name = "comboBox1"; cmbEnvase.Name = "cmbEnvase";
comboBox1.Size = new Size(121, 23); cmbEnvase.Size = new Size(121, 23);
comboBox1.TabIndex = 25; cmbEnvase.TabIndex = 25;
//
// dgvCategoria
//
dgvCategoria.AllowUserToAddRows = false;
dgvCategoria.AllowUserToDeleteRows = false;
dgvCategoria.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvCategoria.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvCategoria.Location = new Point(373, 30);
dgvCategoria.Name = "dgvCategoria";
dgvCategoria.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvCategoria.Size = new Size(240, 150);
dgvCategoria.TabIndex = 26;
//
// label11
//
label11.AutoSize = true;
label11.Location = new Point(373, 216);
label11.Name = "label11";
label11.Size = new Size(108, 15);
label11.TabIndex = 27;
label11.Text = "Categoria Añadida ";
//
// dgvCategoriaAñadida
//
dgvCategoriaAñadida.AllowUserToAddRows = false;
dgvCategoriaAñadida.AllowUserToDeleteRows = false;
dgvCategoriaAñadida.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvCategoriaAñadida.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvCategoriaAñadida.Location = new Point(373, 234);
dgvCategoriaAñadida.Name = "dgvCategoriaAñadida";
dgvCategoriaAñadida.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvCategoriaAñadida.Size = new Size(240, 150);
dgvCategoriaAñadida.TabIndex = 28;
//
// btnaddCategoria
//
btnaddCategoria.Location = new Point(373, 186);
btnaddCategoria.Name = "btnaddCategoria";
btnaddCategoria.Size = new Size(72, 21);
btnaddCategoria.TabIndex = 29;
btnaddCategoria.Text = "Añadir";
btnaddCategoria.UseVisualStyleBackColor = true;
//
// btnrmCategoria
//
btnrmCategoria.Location = new Point(541, 186);
btnrmCategoria.Name = "btnrmCategoria";
btnrmCategoria.Size = new Size(72, 21);
btnrmCategoria.TabIndex = 30;
btnrmCategoria.Text = "Eliminar";
btnrmCategoria.UseVisualStyleBackColor = true;
// //
// FrmProducto // FrmProducto
// //
@@ -301,8 +348,13 @@
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
CancelButton = btncancel; CancelButton = btncancel;
ClientSize = new Size(877, 369); ClientSize = new Size(1219, 517);
Controls.Add(comboBox1); Controls.Add(btnrmCategoria);
Controls.Add(btnaddCategoria);
Controls.Add(dgvCategoriaAñadida);
Controls.Add(label11);
Controls.Add(dgvCategoria);
Controls.Add(cmbEnvase);
Controls.Add(numericUpDown2); Controls.Add(numericUpDown2);
Controls.Add(numericUpDown1); Controls.Add(numericUpDown1);
Controls.Add(label10); Controls.Add(label10);
@@ -317,7 +369,6 @@
Controls.Add(label6); Controls.Add(label6);
Controls.Add(btncancel); Controls.Add(btncancel);
Controls.Add(btnacept); Controls.Add(btnacept);
Controls.Add(cmbCategoria);
Controls.Add(checkHabilitado); Controls.Add(checkHabilitado);
Controls.Add(numPrecio); Controls.Add(numPrecio);
Controls.Add(txtNombre); Controls.Add(txtNombre);
@@ -335,6 +386,8 @@
((System.ComponentModel.ISupportInitialize)dgvProveedor).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvProveedor).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit(); ((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDown2).EndInit(); ((System.ComponentModel.ISupportInitialize)numericUpDown2).EndInit();
((System.ComponentModel.ISupportInitialize)dgvCategoria).EndInit();
((System.ComponentModel.ISupportInitialize)dgvCategoriaAñadida).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@@ -350,7 +403,6 @@
private TextBox txtNombre; private TextBox txtNombre;
private NumericUpDown numPrecio; private NumericUpDown numPrecio;
private CheckBox checkHabilitado; private CheckBox checkHabilitado;
private ComboBox cmbCategoria;
private Button btnacept; private Button btnacept;
private Button btncancel; private Button btncancel;
private Label label6; private Label label6;
@@ -365,6 +417,11 @@
private Label label10; private Label label10;
private NumericUpDown numericUpDown1; private NumericUpDown numericUpDown1;
private NumericUpDown numericUpDown2; private NumericUpDown numericUpDown2;
private ComboBox comboBox1; private ComboBox cmbEnvase;
private DataGridView dgvCategoria;
private Label label11;
private DataGridView dgvCategoriaAñadida;
private Button btnaddCategoria;
private Button btnrmCategoria;
} }
} }

View File

@@ -33,7 +33,7 @@ namespace Vista
} }
private void cargarcombo() private void cargarcombo()
{ {
comboBox1.DataSource = Enum.GetValues(typeof(EnvaseTipo)); cmbEnvase.DataSource = Enum.GetValues(typeof(EnvaseTipo));
} }
private void InicializarFormulario() private void InicializarFormulario()
{ {
@@ -42,8 +42,7 @@ namespace Vista
txtNombre.Text = nuevoproducto.Nombre; txtNombre.Text = nuevoproducto.Nombre;
numPrecio.Value = (decimal)nuevoproducto.Precio; numPrecio.Value = (decimal)nuevoproducto.Precio;
checkHabilitado.Checked = nuevoproducto.Habilitado; checkHabilitado.Checked = nuevoproducto.Habilitado;
cmbCategoria.SelectedValue = nuevoproducto.Categoria.Id; dgvProveedorAñadido.DataSource = nuevoproducto.proveedores.AsReadOnly();
dgvProveedorAñadido.DataSource = nuevoproducto.ListarProveedores();
} }
@@ -62,16 +61,7 @@ namespace Vista
private void CargarCategorias() private void CargarCategorias()
{ {
// Obtener la lista de categorías desde la controladora
var categorias = ControladoraCategorias.Instance.Listar();
// Configurar el ComboBox para categorías
cmbCategoria.DisplayMember = "Descripcion"; // Mostrar la propiedad Descripcion
cmbCategoria.ValueMember = "Id"; // Usar la propiedad Id como valor
// Asignar la lista de categorías al ComboBox
cmbCategoria.DataSource = categorias;
var listprod = ControladoraProductos.Instance.Listar(); var listprod = ControladoraProductos.Instance.Listar();
numId.Value = (listprod.Count > 0) ? numId.Value = (listprod.Count > 0) ?
listprod.Max(x => x.Id + 1) : listprod.Max(x => x.Id + 1) :
@@ -100,14 +90,11 @@ namespace Vista
devolucion += "Ya existe un producto con el mismo ID.\n"; devolucion += "Ya existe un producto con el mismo ID.\n";
} }
// Validar Categoría Seleccionada // Validar Categoría Seleccionada (wip)
if (cmbCategoria.SelectedItem == null) //devolucion += "Debe seleccionar una categoría.\n";
{
devolucion += "Debe seleccionar una categoría.\n";
}
// Validar Tipo de Producto // Validar Tipo de Producto
if (!checkBox1.Checked && comboBox1.SelectedItem == null) if (!checkBox1.Checked && cmbEnvase.SelectedItem == null)
{ {
devolucion += "Debe seleccionar un tipo de envase para el producto no perecedero.\n"; devolucion += "Debe seleccionar un tipo de envase para el producto no perecedero.\n";
} }
@@ -144,19 +131,18 @@ namespace Vista
Nombre = txtNombre.Text, Nombre = txtNombre.Text,
Precio = (double)numPrecio.Value, Precio = (double)numPrecio.Value,
Habilitado = checkHabilitado.Checked, Habilitado = checkHabilitado.Checked,
Categoria = (Categoria)cmbCategoria.SelectedItem,
MesesHastaConsumoPreferente = (int)numericUpDown1.Value, MesesHastaConsumoPreferente = (int)numericUpDown1.Value,
MesesHastaVencimiento = (int)numericUpDown2.Value, MesesHastaVencimiento = (int)numericUpDown2.Value,
}; };
foreach (var proveedor in nuevoproducto.ListarProveedores()) foreach (var proveedor in nuevoproducto.proveedores.AsReadOnly())
{ {
productoPerecedero.AñadirProveedor(proveedor); productoPerecedero.AñadirProveedor(proveedor);
} }
string mensaje = mod string mensaje = mod
? ControladoraProductos.Instance.Modificar(productoPerecedero) ? ControladoraProductoPercedero.Instance.Modificar(productoPerecedero)
: ControladoraProductos.Instance.Añadir(productoPerecedero); : ControladoraProductoPercedero.Instance.Añadir(productoPerecedero);
MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
@@ -168,17 +154,16 @@ namespace Vista
Nombre = txtNombre.Text, Nombre = txtNombre.Text,
Precio = (double)numPrecio.Value, Precio = (double)numPrecio.Value,
Habilitado = checkHabilitado.Checked, Habilitado = checkHabilitado.Checked,
Categoria = (Categoria)cmbCategoria.SelectedItem, TipoDeEnvase = (EnvaseTipo)cmbEnvase.SelectedItem,
TipoDeEnvase = (EnvaseTipo)comboBox1.SelectedItem,
}; };
foreach (var proveedor in nuevoproducto.ListarProveedores()) foreach (var proveedor in nuevoproducto.proveedores.AsReadOnly())
{ {
productoNoPerecedero.AñadirProveedor(proveedor); productoNoPerecedero.AñadirProveedor(proveedor);
} }
string mensaje = mod string mensaje = mod
? ControladoraProductos.Instance.Modificar(productoNoPerecedero) ? ControladoraProductoNoPercedero.Instance.Modificar(productoNoPerecedero)
: ControladoraProductos.Instance.Añadir(productoNoPerecedero); : ControladoraProductoNoPercedero.Instance.Añadir(productoNoPerecedero);
MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
@@ -204,7 +189,7 @@ namespace Vista
foreach (DataGridViewRow selectedRow in dgvProveedor.SelectedRows) foreach (DataGridViewRow selectedRow in dgvProveedor.SelectedRows)
{ {
Proveedor proveedor = (Proveedor)selectedRow.DataBoundItem; Proveedor proveedor = (Proveedor)selectedRow.DataBoundItem;
var checkcolicion = nuevoproducto.ListarProveedores().Contains(proveedor); var checkcolicion = nuevoproducto.proveedores.Contains(proveedor);
if (checkcolicion) if (checkcolicion)
{ {
MessageBox.Show("El proveedor ya fue cargado"); MessageBox.Show("El proveedor ya fue cargado");
@@ -212,7 +197,7 @@ namespace Vista
} }
nuevoproducto.AñadirProveedor(proveedor); nuevoproducto.AñadirProveedor(proveedor);
dgvProveedorAñadido.DataSource = null; dgvProveedorAñadido.DataSource = null;
dgvProveedorAñadido.DataSource = nuevoproducto.ListarProveedores(); dgvProveedorAñadido.DataSource = nuevoproducto.proveedores.AsReadOnly();
} }
} }
else else
@@ -233,7 +218,7 @@ namespace Vista
Proveedor proveedor = (Proveedor)selectedRow.DataBoundItem; Proveedor proveedor = (Proveedor)selectedRow.DataBoundItem;
nuevoproducto.EliminarProveedor(proveedor); nuevoproducto.EliminarProveedor(proveedor);
dgvProveedorAñadido.DataSource = null; dgvProveedorAñadido.DataSource = null;
dgvProveedorAñadido.DataSource = nuevoproducto.ListarProveedores(); dgvProveedorAñadido.DataSource = nuevoproducto.proveedores.AsReadOnly();
} }
} }
else else
@@ -253,7 +238,7 @@ namespace Vista
numericUpDown1.Enabled = esPerecedero; numericUpDown1.Enabled = esPerecedero;
numericUpDown2.Enabled = esPerecedero; numericUpDown2.Enabled = esPerecedero;
comboBox1.Enabled = !esPerecedero; cmbEnvase.Enabled = !esPerecedero;
} }
private void numericUpDown2_ValueChanged(object sender, EventArgs e) private void numericUpDown2_ValueChanged(object sender, EventArgs e)

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
@@ -48,7 +48,7 @@
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter

View File

@@ -29,6 +29,8 @@
private void InitializeComponent() private void InitializeComponent()
{ {
groupBox1 = new GroupBox(); groupBox1 = new GroupBox();
numStock = new NumericUpDown();
label6 = new Label();
btnModificar = new Button(); btnModificar = new Button();
label3 = new Label(); label3 = new Label();
dgvProveedores = new DataGridView(); dgvProveedores = new DataGridView();
@@ -36,22 +38,25 @@
dgvProductos = new DataGridView(); dgvProductos = new DataGridView();
BtnAdd = new Button(); BtnAdd = new Button();
BtnEliminar = new Button(); BtnEliminar = new Button();
btnCrearCategoria = new Button();
dgvCategorias = new DataGridView(); dgvCategorias = new DataGridView();
label1 = new Label(); label1 = new Label();
dgvPercedero = new DataGridView(); numConsumoPreferente = new NumericUpDown();
dgvNoPercedero = new DataGridView(); numHastaVencimiento = new NumericUpDown();
label4 = new Label(); label8 = new Label();
label5 = new Label(); label7 = new Label();
label6 = new Label(); label9 = new Label();
numStock = new NumericUpDown(); cmbTipoEnvase = new ComboBox();
groupBox2 = new GroupBox();
groupBox3 = new GroupBox();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numStock).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvProveedores).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvProveedores).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvProductos).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvProductos).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvCategorias).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvCategorias).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvPercedero).BeginInit(); ((System.ComponentModel.ISupportInitialize)numConsumoPreferente).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvNoPercedero).BeginInit(); ((System.ComponentModel.ISupportInitialize)numHastaVencimiento).BeginInit();
((System.ComponentModel.ISupportInitialize)numStock).BeginInit(); groupBox2.SuspendLayout();
groupBox3.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// groupBox1 // groupBox1
@@ -71,6 +76,23 @@
groupBox1.TabIndex = 5; groupBox1.TabIndex = 5;
groupBox1.TabStop = false; groupBox1.TabStop = false;
// //
// numStock
//
numStock.Enabled = false;
numStock.Location = new Point(317, 269);
numStock.Name = "numStock";
numStock.Size = new Size(120, 23);
numStock.TabIndex = 13;
//
// label6
//
label6.AutoSize = true;
label6.Location = new Point(275, 271);
label6.Name = "label6";
label6.Size = new Size(36, 15);
label6.TabIndex = 12;
label6.Text = "Stock";
//
// btnModificar // btnModificar
// //
btnModificar.Location = new Point(87, 263); btnModificar.Location = new Point(87, 263);
@@ -95,7 +117,6 @@
dgvProveedores.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvProveedores.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProveedores.Location = new Point(613, 22); dgvProveedores.Location = new Point(613, 22);
dgvProveedores.Name = "dgvProveedores"; dgvProveedores.Name = "dgvProveedores";
dgvProveedores.RowTemplate.Height = 25;
dgvProveedores.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvProveedores.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProveedores.Size = new Size(577, 235); dgvProveedores.Size = new Size(577, 235);
dgvProveedores.TabIndex = 9; dgvProveedores.TabIndex = 9;
@@ -116,7 +137,6 @@
dgvProductos.EditMode = DataGridViewEditMode.EditProgrammatically; dgvProductos.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvProductos.Location = new Point(6, 22); dgvProductos.Location = new Point(6, 22);
dgvProductos.Name = "dgvProductos"; dgvProductos.Name = "dgvProductos";
dgvProductos.RowTemplate.Height = 25;
dgvProductos.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvProductos.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProductos.Size = new Size(591, 235); dgvProductos.Size = new Size(591, 235);
dgvProductos.TabIndex = 3; dgvProductos.TabIndex = 3;
@@ -142,111 +162,109 @@
BtnEliminar.UseVisualStyleBackColor = true; BtnEliminar.UseVisualStyleBackColor = true;
BtnEliminar.Click += BtnEliminar_Click; BtnEliminar.Click += BtnEliminar_Click;
// //
// btnCrearCategoria
//
btnCrearCategoria.Location = new Point(958, 582);
btnCrearCategoria.Name = "btnCrearCategoria";
btnCrearCategoria.Size = new Size(128, 23);
btnCrearCategoria.TabIndex = 4;
btnCrearCategoria.Text = "Crear Categoria";
btnCrearCategoria.UseVisualStyleBackColor = true;
btnCrearCategoria.Click += btnCrearCategoria_Click;
//
// dgvCategorias // dgvCategorias
// //
dgvCategorias.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvCategorias.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvCategorias.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvCategorias.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvCategorias.EditMode = DataGridViewEditMode.EditProgrammatically; dgvCategorias.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvCategorias.Location = new Point(958, 341); dgvCategorias.Location = new Point(778, 343);
dgvCategorias.Name = "dgvCategorias"; dgvCategorias.Name = "dgvCategorias";
dgvCategorias.RowTemplate.Height = 25;
dgvCategorias.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvCategorias.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvCategorias.Size = new Size(250, 235); dgvCategorias.Size = new Size(250, 182);
dgvCategorias.TabIndex = 6; dgvCategorias.TabIndex = 6;
// //
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(961, 323); label1.Location = new Point(781, 325);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(63, 15); label1.Size = new Size(63, 15);
label1.TabIndex = 7; label1.TabIndex = 7;
label1.Text = "Categorias"; label1.Text = "Categorias";
// //
// dgvPercedero // numConsumoPreferente
// //
dgvPercedero.AllowUserToAddRows = false; numConsumoPreferente.Enabled = false;
dgvPercedero.AllowUserToDeleteRows = false; numConsumoPreferente.Location = new Point(164, 33);
dgvPercedero.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; numConsumoPreferente.Name = "numConsumoPreferente";
dgvPercedero.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; numConsumoPreferente.Size = new Size(120, 23);
dgvPercedero.EditMode = DataGridViewEditMode.EditProgrammatically; numConsumoPreferente.TabIndex = 15;
dgvPercedero.Location = new Point(18, 341);
dgvPercedero.Name = "dgvPercedero";
dgvPercedero.RowTemplate.Height = 25;
dgvPercedero.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvPercedero.Size = new Size(439, 245);
dgvPercedero.TabIndex = 8;
// //
// dgvNoPercedero // numHastaVencimiento
// //
dgvNoPercedero.AllowUserToAddRows = false; numHastaVencimiento.Enabled = false;
dgvNoPercedero.AllowUserToDeleteRows = false; numHastaVencimiento.Location = new Point(164, 68);
dgvNoPercedero.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; numHastaVencimiento.Name = "numHastaVencimiento";
dgvNoPercedero.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; numHastaVencimiento.Size = new Size(120, 23);
dgvNoPercedero.EditMode = DataGridViewEditMode.EditProgrammatically; numHastaVencimiento.TabIndex = 17;
dgvNoPercedero.Location = new Point(485, 341);
dgvNoPercedero.Name = "dgvNoPercedero";
dgvNoPercedero.RowTemplate.Height = 25;
dgvNoPercedero.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvNoPercedero.Size = new Size(420, 245);
dgvNoPercedero.TabIndex = 9;
// //
// label4 // label8
// //
label4.AutoSize = true; label8.AutoSize = true;
label4.Location = new Point(485, 323); label8.Location = new Point(16, 70);
label4.Name = "label4"; label8.Name = "label8";
label4.Size = new Size(143, 15); label8.Size = new Size(142, 15);
label4.TabIndex = 12; label8.TabIndex = 16;
label4.Text = "Productos NO Percederos"; label8.Text = "Meses Hasta Vencimiento";
// //
// label5 // label7
// //
label5.AutoSize = true; label7.AutoSize = true;
label5.Location = new Point(18, 323); label7.Location = new Point(6, 35);
label5.Name = "label5"; label7.Name = "label7";
label5.Size = new Size(125, 15); label7.Size = new Size(152, 15);
label5.TabIndex = 13; label7.TabIndex = 14;
label5.Text = "Productos Percederos"; label7.Text = "Meses Consumo Preferente";
// //
// label6 // label9
// //
label6.AutoSize = true; label9.AutoSize = true;
label6.Location = new Point(275, 271); label9.Location = new Point(6, 35);
label6.Name = "label6"; label9.Name = "label9";
label6.Size = new Size(36, 15); label9.Size = new Size(69, 15);
label6.TabIndex = 12; label9.TabIndex = 18;
label6.Text = "Stock"; label9.Text = "Tipo Envase";
// //
// numStock // cmbTipoEnvase
// //
numStock.Enabled = false; cmbTipoEnvase.FormattingEnabled = true;
numStock.Location = new Point(317, 269); cmbTipoEnvase.Location = new Point(81, 32);
numStock.Name = "numStock"; cmbTipoEnvase.Name = "cmbTipoEnvase";
numStock.Size = new Size(120, 23); cmbTipoEnvase.Size = new Size(121, 23);
numStock.TabIndex = 13; cmbTipoEnvase.TabIndex = 19;
//
// groupBox2
//
groupBox2.Controls.Add(label7);
groupBox2.Controls.Add(numConsumoPreferente);
groupBox2.Controls.Add(numHastaVencimiento);
groupBox2.Controls.Add(label8);
groupBox2.Location = new Point(12, 323);
groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(396, 202);
groupBox2.TabIndex = 20;
groupBox2.TabStop = false;
groupBox2.Text = "Productos Percederos";
//
// groupBox3
//
groupBox3.Controls.Add(label9);
groupBox3.Controls.Add(cmbTipoEnvase);
groupBox3.Location = new Point(414, 323);
groupBox3.Name = "groupBox3";
groupBox3.Size = new Size(348, 202);
groupBox3.TabIndex = 21;
groupBox3.TabStop = false;
groupBox3.Text = "Productos No Percederos";
// //
// FrmProductos // FrmProductos
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1237, 589); ClientSize = new Size(1237, 616);
Controls.Add(label5); Controls.Add(groupBox3);
Controls.Add(label4); Controls.Add(groupBox2);
Controls.Add(dgvNoPercedero);
Controls.Add(dgvPercedero);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(btnCrearCategoria);
Controls.Add(dgvCategorias); Controls.Add(dgvCategorias);
Controls.Add(groupBox1); Controls.Add(groupBox1);
Name = "FrmProductos"; Name = "FrmProductos";
@@ -254,12 +272,16 @@
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized;
groupBox1.ResumeLayout(false); groupBox1.ResumeLayout(false);
groupBox1.PerformLayout(); groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)numStock).EndInit();
((System.ComponentModel.ISupportInitialize)dgvProveedores).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvProveedores).EndInit();
((System.ComponentModel.ISupportInitialize)dgvProductos).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvProductos).EndInit();
((System.ComponentModel.ISupportInitialize)dgvCategorias).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvCategorias).EndInit();
((System.ComponentModel.ISupportInitialize)dgvPercedero).EndInit(); ((System.ComponentModel.ISupportInitialize)numConsumoPreferente).EndInit();
((System.ComponentModel.ISupportInitialize)dgvNoPercedero).EndInit(); ((System.ComponentModel.ISupportInitialize)numHastaVencimiento).EndInit();
((System.ComponentModel.ISupportInitialize)numStock).EndInit(); groupBox2.ResumeLayout(false);
groupBox2.PerformLayout();
groupBox3.ResumeLayout(false);
groupBox3.PerformLayout();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@@ -270,7 +292,6 @@
private DataGridView dgvProductos; private DataGridView dgvProductos;
private Button BtnAdd; private Button BtnAdd;
private Button BtnEliminar; private Button BtnEliminar;
private Button btnCrearCategoria;
private DataGridView dgvCategorias; private DataGridView dgvCategorias;
private Label label2; private Label label2;
private Label label1; private Label label1;
@@ -279,9 +300,16 @@
private Button btnModificar; private Button btnModificar;
private DataGridView dgvPercedero; private DataGridView dgvPercedero;
private DataGridView dgvNoPercedero; private DataGridView dgvNoPercedero;
private Label label4;
private Label label5; private Label label5;
private NumericUpDown numStock; private NumericUpDown numStock;
private Label label6; private Label label6;
private NumericUpDown numConsumoPreferente;
private NumericUpDown numHastaVencimiento;
private Label label8;
private Label label7;
private Label label9;
private ComboBox cmbTipoEnvase;
private GroupBox groupBox2;
private GroupBox groupBox3;
} }
} }

View File

@@ -23,79 +23,9 @@ namespace Vista
{ {
InitializeComponent(); InitializeComponent();
ConfigurarDataGridView(); ConfigurarDataGridView();
ConfigurarDataGridViewPerecedero();
ConfigurarDataGridViewNoPerecedero();
ActualizarGrilla(); ActualizarGrilla();
} }
private void ConfigurarDataGridViewNoPerecedero()
{
dgvNoPercedero.AutoGenerateColumns = false;
// Crear una columna para el nombre
var colNombre = new DataGridViewTextBoxColumn
{
DataPropertyName = "Nombre",
HeaderText = "Nombre",
Name = "Nombre",
Width = 150
};
// Crear una columna para el tipo de envase
var colTipoDeEnvase = new DataGridViewTextBoxColumn
{
DataPropertyName = "TipoDeEnvase",
HeaderText = "Tipo de Envase",
Name = "TipoDeEnvase",
Width = 200
};
// Limpiar columnas existentes
dgvNoPercedero.Columns.Clear();
// Agregar las columnas al DataGridView
dgvNoPercedero.Columns.Add(colNombre);
dgvNoPercedero.Columns.Add(colTipoDeEnvase);
}
private void ConfigurarDataGridViewPerecedero()
{
dgvPercedero.AutoGenerateColumns = false;
// Crear una columna para el nombre
var colNombre = new DataGridViewTextBoxColumn
{
DataPropertyName = "Nombre",
HeaderText = "Nombre",
Name = "Nombre",
};
// Crear una columna para los meses hasta consumo preferente
var colMesesHastaConsumoPreferente = new DataGridViewTextBoxColumn
{
DataPropertyName = "MesesHastaConsumoPreferente",
HeaderText = "Meses Hasta Consumo Preferente",
Name = "MesesHastaConsumoPreferente",
};
// Crear una columna para los meses hasta vencimiento
var colMesesHastaVencimiento = new DataGridViewTextBoxColumn
{
DataPropertyName = "MesesHastaVencimiento",
HeaderText = "Meses Hasta Vencimiento",
Name = "MesesHastaVencimiento",
};
// Limpiar columnas existentes
dgvPercedero.Columns.Clear();
// Agregar las columnas al DataGridView
dgvPercedero.Columns.Add(colNombre);
dgvPercedero.Columns.Add(colMesesHastaConsumoPreferente);
dgvPercedero.Columns.Add(colMesesHastaVencimiento);
}
private void ConfigurarDataGridView() private void ConfigurarDataGridView()
{ {
dgvProductos.AutoGenerateColumns = false; dgvProductos.AutoGenerateColumns = false;
@@ -159,12 +89,6 @@ namespace Vista
// Obtén todos los productos de la controladora o la fuente de datos // Obtén todos los productos de la controladora o la fuente de datos
var todosLosProductos = ControladoraProductos.Instance.Listar(); var todosLosProductos = ControladoraProductos.Instance.Listar();
// Filtra los productos perecederos y no perecederos
var productosPerecederos = todosLosProductos.OfType<ProductoPercedero>().ToList();
var productosNoPerecederos = todosLosProductos.OfType<ProductoNoPercedero>().ToList();
dgvPercedero.DataSource = null; // Limpiar la fuente de datos
dgvNoPercedero.DataSource = null; // Limpiar la fuente de datos
dgvProductos.DataSource = null; dgvProductos.DataSource = null;
dgvCategorias.DataSource = null; dgvCategorias.DataSource = null;
@@ -179,7 +103,6 @@ namespace Vista
p.Nombre, p.Nombre,
p.Precio, p.Precio,
p.Habilitado, p.Habilitado,
CategoriaDescripcion = p.Categoria != null ? p.Categoria.Descripcion : string.Empty,
p.EsPerecedero p.EsPerecedero
}) })
.ToList(); .ToList();
@@ -215,9 +138,9 @@ namespace Vista
if (producto != null) if (producto != null)
{ {
string devolucion = (producto.EsPerecedero) ? string devolucion = (producto.EsPerecedero) ?
ControladoraProductos: ControladoraProductoPercedero.Instance.Eliminar(producto as ProductoPercedero) :
; ControladoraProductoNoPercedero.Instance.Eliminar(producto as ProductoNoPercedero);
MessageBox.Show(devolucion); MessageBox.Show(devolucion);
} }
else else
@@ -235,10 +158,11 @@ namespace Vista
ActualizarGrilla(); ActualizarGrilla();
} }
public void ActualizarGrillaGeneralizaciones() public void ActualizarGeneralizaciones()
{ {
dgvNoPercedero.DataSource = null; numHastaVencimiento.Enabled = true;
dgvPercedero.DataSource = null; numConsumoPreferente.Enabled = true;
cmbTipoEnvase.Enabled = true;
var selectedRow = dgvProductos.SelectedRows[0]; var selectedRow = dgvProductos.SelectedRows[0];
var Producto = new Entidades.Producto var Producto = new Entidades.Producto
@@ -251,14 +175,27 @@ namespace Vista
ProductoPercedero prod = (ProductoPercedero)ControladoraProductos.Instance.MostrarPorId(Producto); ProductoPercedero prod = (ProductoPercedero)ControladoraProductos.Instance.MostrarPorId(Producto);
if (prod == null) return; if (prod == null) return;
dgvPercedero.DataSource = new List<ProductoPercedero> { prod };
numConsumoPreferente.Value = prod.MesesHastaConsumoPreferente;
numHastaVencimiento.Value = prod.MesesHastaVencimiento;
cmbTipoEnvase.SelectedIndex = -1;
cmbTipoEnvase.Enabled = false;
} }
else else
{ {
ProductoNoPercedero prod = (ProductoNoPercedero)ControladoraProductos.Instance.MostrarPorId(Producto); ProductoNoPercedero prod = (ProductoNoPercedero)ControladoraProductos.Instance.MostrarPorId(Producto);
if (prod == null) return; if (prod == null) return;
dgvNoPercedero.DataSource = new List<ProductoNoPercedero> { prod }; cmbTipoEnvase.Items.Clear();
cmbTipoEnvase.Items.Add(prod.TipoDeEnvase.GetType().FullName);
cmbTipoEnvase.SelectedIndex = 0;
numHastaVencimiento.Value = 0;
numConsumoPreferente.Value = 0;
numConsumoPreferente.Enabled = false;
numHastaVencimiento.Enabled = false;
} }
} }
private void MostrarStock() private void MostrarStock()
@@ -274,7 +211,7 @@ namespace Vista
{ {
if (dgvProductos.SelectedRows.Count == 0) return; if (dgvProductos.SelectedRows.Count == 0) return;
ActualizarGrillaProveedores(); ActualizarGrillaProveedores();
ActualizarGrillaGeneralizaciones(); ActualizarGeneralizaciones();
MostrarStock(); MostrarStock();
} }
@@ -292,7 +229,6 @@ namespace Vista
Nombre = dgvProductos.SelectedRows[0].Cells["Nombre"].Value as String, Nombre = dgvProductos.SelectedRows[0].Cells["Nombre"].Value as String,
Precio = Convert.ToDouble(dgvProductos.SelectedRows[0].Cells["Precio"].Value), Precio = Convert.ToDouble(dgvProductos.SelectedRows[0].Cells["Precio"].Value),
Habilitado = Convert.ToBoolean(dgvProductos.SelectedRows[0].Cells["Habilitado"].Value), Habilitado = Convert.ToBoolean(dgvProductos.SelectedRows[0].Cells["Habilitado"].Value),
Categoria = ControladoraCategorias.Instance.Listar().FirstOrDefault(c => c.Descripcion == dgvProductos.SelectedRows[0].Cells["Categoria"].Value.ToString())
}; };
foreach (Proveedor prov in ControladoraProductos.Instance.ListarProveedores(producto)) foreach (Proveedor prov in ControladoraProductos.Instance.ListarProveedores(producto))
{ {
@@ -316,12 +252,6 @@ namespace Vista
} }
} }
private void btnCrearCategoria_Click(object sender, EventArgs e)
{
var form = new AddCategoria();
form.ShowDialog();
ActualizarGrilla();
}
} }
} }

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
@@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@@ -48,7 +48,7 @@
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter

View File

@@ -39,6 +39,7 @@
pedidosPresupuestoToolStripMenuItem = new ToolStripMenuItem(); pedidosPresupuestoToolStripMenuItem = new ToolStripMenuItem();
configToolStripMenuItem = new ToolStripMenuItem(); configToolStripMenuItem = new ToolStripMenuItem();
informesToolStripMenuItem = new ToolStripMenuItem(); informesToolStripMenuItem = new ToolStripMenuItem();
categoriasToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
@@ -53,7 +54,7 @@
// //
// gestionarToolStripMenuItem // gestionarToolStripMenuItem
// //
gestionarToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientesToolStripMenuItem, ventasToolStripMenuItem, proveedoresToolStripMenuItem, productosToolStripMenuItem, remitosToolStripMenuItem, ordenDeCompraToolStripMenuItem, pedidosPresupuestoToolStripMenuItem }); gestionarToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientesToolStripMenuItem, ventasToolStripMenuItem, proveedoresToolStripMenuItem, productosToolStripMenuItem, remitosToolStripMenuItem, ordenDeCompraToolStripMenuItem, pedidosPresupuestoToolStripMenuItem, categoriasToolStripMenuItem });
gestionarToolStripMenuItem.Name = "gestionarToolStripMenuItem"; gestionarToolStripMenuItem.Name = "gestionarToolStripMenuItem";
gestionarToolStripMenuItem.Size = new Size(69, 20); gestionarToolStripMenuItem.Size = new Size(69, 20);
gestionarToolStripMenuItem.Text = "Gestionar"; gestionarToolStripMenuItem.Text = "Gestionar";
@@ -62,49 +63,49 @@
// clientesToolStripMenuItem // clientesToolStripMenuItem
// //
clientesToolStripMenuItem.Name = "clientesToolStripMenuItem"; clientesToolStripMenuItem.Name = "clientesToolStripMenuItem";
clientesToolStripMenuItem.Size = new Size(164, 22); clientesToolStripMenuItem.Size = new Size(180, 22);
clientesToolStripMenuItem.Text = "Clientes"; clientesToolStripMenuItem.Text = "Clientes";
clientesToolStripMenuItem.Click += clientesToolStripMenuItem_Click; clientesToolStripMenuItem.Click += clientesToolStripMenuItem_Click;
// //
// ventasToolStripMenuItem // ventasToolStripMenuItem
// //
ventasToolStripMenuItem.Name = "ventasToolStripMenuItem"; ventasToolStripMenuItem.Name = "ventasToolStripMenuItem";
ventasToolStripMenuItem.Size = new Size(164, 22); ventasToolStripMenuItem.Size = new Size(180, 22);
ventasToolStripMenuItem.Text = "Ventas"; ventasToolStripMenuItem.Text = "Ventas";
ventasToolStripMenuItem.Click += ventasToolStripMenuItem_Click; ventasToolStripMenuItem.Click += ventasToolStripMenuItem_Click;
// //
// proveedoresToolStripMenuItem // proveedoresToolStripMenuItem
// //
proveedoresToolStripMenuItem.Name = "proveedoresToolStripMenuItem"; proveedoresToolStripMenuItem.Name = "proveedoresToolStripMenuItem";
proveedoresToolStripMenuItem.Size = new Size(164, 22); proveedoresToolStripMenuItem.Size = new Size(180, 22);
proveedoresToolStripMenuItem.Text = "Proveedores"; proveedoresToolStripMenuItem.Text = "Proveedores";
proveedoresToolStripMenuItem.Click += proveedoresToolStripMenuItem_Click; proveedoresToolStripMenuItem.Click += proveedoresToolStripMenuItem_Click;
// //
// productosToolStripMenuItem // productosToolStripMenuItem
// //
productosToolStripMenuItem.Name = "productosToolStripMenuItem"; productosToolStripMenuItem.Name = "productosToolStripMenuItem";
productosToolStripMenuItem.Size = new Size(164, 22); productosToolStripMenuItem.Size = new Size(180, 22);
productosToolStripMenuItem.Text = "Productos"; productosToolStripMenuItem.Text = "Productos";
productosToolStripMenuItem.Click += productosToolStripMenuItem_Click; productosToolStripMenuItem.Click += productosToolStripMenuItem_Click;
// //
// remitosToolStripMenuItem // remitosToolStripMenuItem
// //
remitosToolStripMenuItem.Name = "remitosToolStripMenuItem"; remitosToolStripMenuItem.Name = "remitosToolStripMenuItem";
remitosToolStripMenuItem.Size = new Size(164, 22); remitosToolStripMenuItem.Size = new Size(180, 22);
remitosToolStripMenuItem.Text = "Remitos"; remitosToolStripMenuItem.Text = "Remitos";
remitosToolStripMenuItem.Click += remitosToolStripMenuItem_Click; remitosToolStripMenuItem.Click += remitosToolStripMenuItem_Click;
// //
// ordenDeCompraToolStripMenuItem // ordenDeCompraToolStripMenuItem
// //
ordenDeCompraToolStripMenuItem.Name = "ordenDeCompraToolStripMenuItem"; ordenDeCompraToolStripMenuItem.Name = "ordenDeCompraToolStripMenuItem";
ordenDeCompraToolStripMenuItem.Size = new Size(164, 22); ordenDeCompraToolStripMenuItem.Size = new Size(180, 22);
ordenDeCompraToolStripMenuItem.Text = "OrdenDeCompra"; ordenDeCompraToolStripMenuItem.Text = "OrdenDeCompra";
ordenDeCompraToolStripMenuItem.Click += ordenDeCompraToolStripMenuItem_Click; ordenDeCompraToolStripMenuItem.Click += ordenDeCompraToolStripMenuItem_Click;
// //
// pedidosPresupuestoToolStripMenuItem // pedidosPresupuestoToolStripMenuItem
// //
pedidosPresupuestoToolStripMenuItem.Name = "pedidosPresupuestoToolStripMenuItem"; pedidosPresupuestoToolStripMenuItem.Name = "pedidosPresupuestoToolStripMenuItem";
pedidosPresupuestoToolStripMenuItem.Size = new Size(164, 22); pedidosPresupuestoToolStripMenuItem.Size = new Size(180, 22);
pedidosPresupuestoToolStripMenuItem.Text = "Presupuesto"; pedidosPresupuestoToolStripMenuItem.Text = "Presupuesto";
pedidosPresupuestoToolStripMenuItem.Click += pedidosPresupuestoToolStripMenuItem_Click; pedidosPresupuestoToolStripMenuItem.Click += pedidosPresupuestoToolStripMenuItem_Click;
// //
@@ -122,6 +123,13 @@
informesToolStripMenuItem.Text = "Informes"; informesToolStripMenuItem.Text = "Informes";
informesToolStripMenuItem.Click += informesToolStripMenuItem_Click; informesToolStripMenuItem.Click += informesToolStripMenuItem_Click;
// //
// categoriasToolStripMenuItem
//
categoriasToolStripMenuItem.Name = "categoriasToolStripMenuItem";
categoriasToolStripMenuItem.Size = new Size(180, 22);
categoriasToolStripMenuItem.Text = "Categorias";
categoriasToolStripMenuItem.Click += categoriasToolStripMenuItem_Click;
//
// PantallaPrincipal // PantallaPrincipal
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@@ -152,5 +160,6 @@
private ToolStripMenuItem clientesToolStripMenuItem; private ToolStripMenuItem clientesToolStripMenuItem;
private ToolStripMenuItem configToolStripMenuItem; private ToolStripMenuItem configToolStripMenuItem;
private ToolStripMenuItem informesToolStripMenuItem; private ToolStripMenuItem informesToolStripMenuItem;
private ToolStripMenuItem categoriasToolStripMenuItem;
} }
} }

View File

@@ -101,5 +101,16 @@ namespace Vista
Frm.MdiParent = this; Frm.MdiParent = this;
Frm.Show(); Frm.Show();
} }
private void categoriasToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ActiveMdiChild != null)
{
ActiveMdiChild.Close();
}
var Frm = new FrmCategorias();
Frm.MdiParent = this;
Frm.Show();
}
} }
} }

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
@@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@@ -48,7 +48,7 @@
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter

View File

@@ -13,91 +13,8 @@ namespace Vista
{ {
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
PrecargarDatos();
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new PantallaPrincipal()); Application.Run(new PantallaPrincipal());
} }
private static void PrecargarDatos()
{
Proveedor proveedor = new Proveedor
{
Cuit = 157618923,
Direccion = "La Rioja 6412",
Nombre = "Outlet Riojano",
Habilitado = true,
RazonSocial = "Vende Ropa"
};
ControladoraProveedores.Instance.A<EFBFBD>adir(proveedor);
Proveedor proveedor2 = new Proveedor
{
Cuit = 357618653,
Direccion = "San Martin 2261",
Nombre = "Arrollito Deport",
Habilitado = true,
RazonSocial = "Vende Ropa Deportiva"
};
ControladoraProveedores.Instance.A<EFBFBD>adir(proveedor2);
ControladoraClientes.Instance.A<EFBFBD>adir(new Cliente{
Cuit = 23453659239,
Apellido = "Polidoro",
Nombre = "Federico",
Correo = "federico.nicolas.polidoro@gmail.com",
Direccion = "nose",
Habilitado = true
});
ControladoraClientes.Instance.A<EFBFBD>adir(new Cliente{
Cuit = 17385912736,
Apellido = "Diana",
Nombre = "Ignacio",
Correo = "Ignaciodiana@gmail.com",
Direccion = "nose",
Habilitado = true
});
ControladoraCategorias.Instance.A<EFBFBD>adir(new Entidades.Categoria{
Id = 1,
Descripcion = "Indumentaria"
});
ControladoraCategorias.Instance.A<EFBFBD>adir(new Entidades.Categoria
{
Id = 2,
Descripcion = "Perfumeria"
});
ProductoNoPercedero producto = new ProductoNoPercedero
{
Id = 1,
Categoria = ControladoraCategorias.Instance.Listar()[0],
Habilitado = true,
Nombre = "Pantalones Vaqueros",
Precio = 2000.2,
TipoDeEnvase = EnvaseTipo.NoTiene,
EsPerecedero = false
};
producto.A<EFBFBD>adirProveedor(proveedor);
ControladoraProductos.Instance.A<EFBFBD>adir(producto);
Presupuesto presupuesto = new Presupuesto
{
Id = 1,
Aceptado = true,
Habilitado = true,
Fecha = DateTime.Now,
Proveedor = proveedor,
};
presupuesto.A<EFBFBD>adirDetalle(new DetallePresupuesto
{
Id = 1,
Cantidad = 2,
IdPresupuesto = 1,
MontoCUPropuesto = 1000,
Producto = producto,
});
ControladoraPresupuestos.Instance.A<EFBFBD>adir(presupuesto);
}
} }
} }

View File

@@ -1,5 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Entidades\Entidades.csproj" /> <ProjectReference Include="..\Entidades\Entidades.csproj" />
<ProjectReference Include="..\Controladora\Controladora.csproj" /> <ProjectReference Include="..\Controladora\Controladora.csproj" />

View File

@@ -2,7 +2,10 @@
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup /> <PropertyGroup />
<ItemGroup> <ItemGroup>
<Compile Update="AddCategoria.cs"> <Compile Update="FrmCategoria.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FrmCategorias.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="FrmCliente.cs"> <Compile Update="FrmCliente.cs">

View File

@@ -333,6 +333,14 @@
"frameworks": { "frameworks": {
"net8.0-windows7.0": { "net8.0-windows7.0": {
"targetAlias": "net8.0-windows", "targetAlias": "net8.0-windows",
"dependencies": {
"Microsoft.EntityFrameworkCore.Design": {
"include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
"suppressParent": "All",
"target": "Package",
"version": "[8.0.8, )"
}
},
"imports": [ "imports": [
"net461", "net461",
"net462", "net462",

View File

@@ -14,8 +14,10 @@
</ItemGroup> </ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.8\buildTransitive\net8.0\Microsoft.EntityFrameworkCore.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.8\buildTransitive\net8.0\Microsoft.EntityFrameworkCore.props')" /> <Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.8\buildTransitive\net8.0\Microsoft.EntityFrameworkCore.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore\8.0.8\buildTransitive\net8.0\Microsoft.EntityFrameworkCore.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.entityframeworkcore.design\8.0.8\build\net8.0\Microsoft.EntityFrameworkCore.Design.props" Condition="Exists('$(NuGetPackageRoot)microsoft.entityframeworkcore.design\8.0.8\build\net8.0\Microsoft.EntityFrameworkCore.Design.props')" />
</ImportGroup> </ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgMicrosoft_Web_WebView2 Condition=" '$(PkgMicrosoft_Web_WebView2)' == '' ">C:\Users\fedpo\.nuget\packages\microsoft.web.webview2\1.0.864.35</PkgMicrosoft_Web_WebView2> <PkgMicrosoft_Web_WebView2 Condition=" '$(PkgMicrosoft_Web_WebView2)' == '' ">C:\Users\fedpo\.nuget\packages\microsoft.web.webview2\1.0.864.35</PkgMicrosoft_Web_WebView2>
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\fedpo\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.3</PkgMicrosoft_CodeAnalysis_Analyzers>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' "> <ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)system.text.json\8.0.4\buildTransitive\net6.0\System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json\8.0.4\buildTransitive\net6.0\System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.options\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Options.targets')" /> <Import Project="$(NuGetPackageRoot)microsoft.extensions.options\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Options.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.options\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Options.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets')" /> <Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\8.0.0\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
</ImportGroup> </ImportGroup>

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,25 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "nuHziLAVMU4=", "dgSpecHash": "RZQdbCeghbw=",
"success": true, "success": true,
"projectFilePath": "C:\\Users\\fedpo\\source\\repos\\Final_Das\\Vista\\Vista.csproj", "projectFilePath": "C:\\Users\\fedpo\\source\\repos\\Final_Das\\Vista\\Vista.csproj",
"expectedPackageFiles": [ "expectedPackageFiles": [
"C:\\Users\\fedpo\\.nuget\\packages\\azure.core\\1.35.0\\azure.core.1.35.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\azure.core\\1.35.0\\azure.core.1.35.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\azure.identity\\1.10.3\\azure.identity.1.10.3.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\azure.identity\\1.10.3\\azure.identity.1.10.3.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\1.1.1\\microsoft.bcl.asyncinterfaces.1.1.1.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\humanizer.core\\2.14.1\\humanizer.core.2.14.1.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\6.0.0\\microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.codeanalysis.analyzers\\3.3.3\\microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.codeanalysis.common\\4.5.0\\microsoft.codeanalysis.common.4.5.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.codeanalysis.csharp\\4.5.0\\microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.codeanalysis.csharp.workspaces\\4.5.0\\microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.codeanalysis.workspaces.common\\4.5.0\\microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.csharp\\4.5.0\\microsoft.csharp.4.5.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.csharp\\4.5.0\\microsoft.csharp.4.5.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.data.sqlclient\\5.1.5\\microsoft.data.sqlclient.5.1.5.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.data.sqlclient\\5.1.5\\microsoft.data.sqlclient.5.1.5.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.data.sqlclient.sni.runtime\\5.1.1\\microsoft.data.sqlclient.sni.runtime.5.1.1.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.data.sqlclient.sni.runtime\\5.1.1\\microsoft.data.sqlclient.sni.runtime.5.1.1.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.8\\microsoft.entityframeworkcore.8.0.8.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.8\\microsoft.entityframeworkcore.8.0.8.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.8\\microsoft.entityframeworkcore.abstractions.8.0.8.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.8\\microsoft.entityframeworkcore.abstractions.8.0.8.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.8\\microsoft.entityframeworkcore.analyzers.8.0.8.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.8\\microsoft.entityframeworkcore.analyzers.8.0.8.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.design\\8.0.8\\microsoft.entityframeworkcore.design.8.0.8.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.8\\microsoft.entityframeworkcore.relational.8.0.8.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.8\\microsoft.entityframeworkcore.relational.8.0.8.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.sqlserver\\8.0.8\\microsoft.entityframeworkcore.sqlserver.8.0.8.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.entityframeworkcore.sqlserver\\8.0.8\\microsoft.entityframeworkcore.sqlserver.8.0.8.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
@@ -20,6 +27,7 @@
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.0\\microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.0\\microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.0\\microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.0\\microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.dependencymodel\\8.0.1\\microsoft.extensions.dependencymodel.8.0.1.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.logging\\8.0.0\\microsoft.extensions.logging.8.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.logging\\8.0.0\\microsoft.extensions.logging.8.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.0\\microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.0\\microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.options\\8.0.0\\microsoft.extensions.options.8.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.extensions.options\\8.0.0\\microsoft.extensions.options.8.0.0.nupkg.sha512",
@@ -38,15 +46,26 @@
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.sqlserver.server\\1.0.0\\microsoft.sqlserver.server.1.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.sqlserver.server\\1.0.0\\microsoft.sqlserver.server.1.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.web.webview2\\1.0.864.35\\microsoft.web.webview2.1.0.864.35.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.web.webview2\\1.0.864.35\\microsoft.web.webview2.1.0.864.35.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\microsoft.win32.systemevents\\6.0.0\\microsoft.win32.systemevents.6.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\microsoft.win32.systemevents\\6.0.0\\microsoft.win32.systemevents.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\mono.texttemplating\\2.2.1\\mono.texttemplating.2.2.1.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.codedom\\4.4.0\\system.codedom.4.4.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.collections.immutable\\6.0.0\\system.collections.immutable.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.composition\\6.0.0\\system.composition.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.composition.attributedmodel\\6.0.0\\system.composition.attributedmodel.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.composition.convention\\6.0.0\\system.composition.convention.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.composition.hosting\\6.0.0\\system.composition.hosting.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.composition.runtime\\6.0.0\\system.composition.runtime.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.composition.typedparts\\6.0.0\\system.composition.typedparts.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.configuration.configurationmanager\\6.0.1\\system.configuration.configurationmanager.6.0.1.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.configuration.configurationmanager\\6.0.1\\system.configuration.configurationmanager.6.0.1.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.diagnostics.diagnosticsource\\6.0.1\\system.diagnostics.diagnosticsource.6.0.1.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.diagnostics.diagnosticsource\\6.0.1\\system.diagnostics.diagnosticsource.6.0.1.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.drawing.common\\6.0.0\\system.drawing.common.6.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.drawing.common\\6.0.0\\system.drawing.common.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.formats.asn1\\5.0.0\\system.formats.asn1.5.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.formats.asn1\\5.0.0\\system.formats.asn1.5.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.identitymodel.tokens.jwt\\6.35.0\\system.identitymodel.tokens.jwt.6.35.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.identitymodel.tokens.jwt\\6.35.0\\system.identitymodel.tokens.jwt.6.35.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.io.filesystem.accesscontrol\\5.0.0\\system.io.filesystem.accesscontrol.5.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.io.filesystem.accesscontrol\\5.0.0\\system.io.filesystem.accesscontrol.5.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.io.pipelines\\6.0.3\\system.io.pipelines.6.0.3.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.memory\\4.5.4\\system.memory.4.5.4.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.memory\\4.5.4\\system.memory.4.5.4.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.memory.data\\1.0.2\\system.memory.data.1.0.2.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.memory.data\\1.0.2\\system.memory.data.1.0.2.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.numerics.vectors\\4.5.0\\system.numerics.vectors.4.5.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.numerics.vectors\\4.5.0\\system.numerics.vectors.4.5.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.reflection.metadata\\6.0.1\\system.reflection.metadata.6.0.1.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.runtime\\4.3.0\\system.runtime.4.3.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.runtime\\4.3.0\\system.runtime.4.3.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.runtime.caching\\6.0.0\\system.runtime.caching.6.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.runtime.caching\\6.0.0\\system.runtime.caching.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.0.0\\system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.0.0\\system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512",
@@ -57,8 +76,9 @@
"C:\\Users\\fedpo\\.nuget\\packages\\system.security.principal.windows\\5.0.0\\system.security.principal.windows.5.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.security.principal.windows\\5.0.0\\system.security.principal.windows.5.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.text.encoding\\4.3.0\\system.text.encoding.4.3.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.text.encoding\\4.3.0\\system.text.encoding.4.3.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.text.encoding.codepages\\6.0.0\\system.text.encoding.codepages.6.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.text.encoding.codepages\\6.0.0\\system.text.encoding.codepages.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.text.encodings.web\\6.0.0\\system.text.encodings.web.6.0.0.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.text.encodings.web\\8.0.0\\system.text.encodings.web.8.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.text.json\\4.7.2\\system.text.json.4.7.2.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.text.json\\8.0.4\\system.text.json.8.0.4.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.threading.channels\\6.0.0\\system.threading.channels.6.0.0.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.threading.tasks.extensions\\4.5.4\\system.threading.tasks.extensions.4.5.4.nupkg.sha512", "C:\\Users\\fedpo\\.nuget\\packages\\system.threading.tasks.extensions\\4.5.4\\system.threading.tasks.extensions.4.5.4.nupkg.sha512",
"C:\\Users\\fedpo\\.nuget\\packages\\system.windows.extensions\\6.0.0\\system.windows.extensions.6.0.0.nupkg.sha512" "C:\\Users\\fedpo\\.nuget\\packages\\system.windows.extensions\\6.0.0\\system.windows.extensions.6.0.0.nupkg.sha512"
], ],

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("testing")] [assembly: System.Reflection.AssemblyCompanyAttribute("testing")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+247a19b84a1348e4030866339365b56d2238ff24")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+670190c44b669009d2d84e1f849117de0d18586f")]
[assembly: System.Reflection.AssemblyProductAttribute("testing")] [assembly: System.Reflection.AssemblyProductAttribute("testing")]
[assembly: System.Reflection.AssemblyTitleAttribute("testing")] [assembly: System.Reflection.AssemblyTitleAttribute("testing")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
68c38b4a0e7c06b2a664cf471ebf6d34ffbde25c40830becb56ea6ac7c22e481 11e3546ad2295b54deb0ec86f31e7dbd3c3c2b4ce531b9f1388e97287778ffe5

Binary file not shown.

Binary file not shown.