From 76d9b597d6c38e52841526743f08446f54258c73 Mon Sep 17 00:00:00 2001 From: fedpo Date: Tue, 1 Oct 2024 02:48:17 +0100 Subject: [PATCH] =?UTF-8?q?m=C3=A1s=20cambios=20ahora=20funciona=20el=20te?= =?UTF-8?q?ma=20de=20las=20facturas=20pero=20no=20el=20emailer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controladora/ControladoraFacturas.cs | 14 +- Controladora/ControladoraLotes.cs | 7 +- Entidades/DetalleFactura.cs | 8 + Entidades/Factura.cs | 57 +- Entidades/Remito.cs | 2 +- .../20240812181354_Initial.Designer.cs | 29 - .../.Migrations_old/20240812181354_Initial.cs | 22 - ...0240826212726_nuevasrelaciones.Designer.cs | 591 --------- .../20240826212726_nuevasrelaciones.cs | 443 ------- ...3_fixrelacionproductocategoria.Designer.cs | 591 --------- ...0826213353_fixrelacionproductocategoria.cs | 22 - ...0826222040_cambiadapkcompuesta.Designer.cs | 591 --------- .../20240826222040_cambiadapkcompuesta.cs | 54 - ...827025739_CuitNotGenerateValue.Designer.cs | 585 --------- .../20240827025739_CuitNotGenerateValue.cs | 163 --- .../20240907203054_funcatodo.Designer.cs | 576 --------- .../20240907203054_funcatodo.cs | 95 -- ...60636_eliminadocamporedundante.Designer.cs | 573 --------- ...20240908160636_eliminadocamporedundante.cs | 29 - .../20240908162248_mepaseasqlite.cs | 1109 ----------------- ...08172708_Cambie_nombre_de_key2.Designer.cs | 556 --------- .../20240908172708_Cambie_nombre_de_key2.cs | 437 ------- ...40930233807_initial-migration.Designer.cs} | 4 +- ...cs => 20240930233807_initial-migration.cs} | 2 +- .../ContextModelSnapshot.cs | 0 Modelo/RepositorioFactura.cs | 26 +- Modelo/RepositorioLote.cs | 60 +- Vista/FrmFactura.cs | 55 +- Vista/FrmFacturas.cs | 71 +- Vista/FrmProductos.Designer.cs | 1 + 30 files changed, 156 insertions(+), 6617 deletions(-) delete mode 100644 Modelo/.Migrations_old/20240812181354_Initial.Designer.cs delete mode 100644 Modelo/.Migrations_old/20240812181354_Initial.cs delete mode 100644 Modelo/.Migrations_old/20240826212726_nuevasrelaciones.Designer.cs delete mode 100644 Modelo/.Migrations_old/20240826212726_nuevasrelaciones.cs delete mode 100644 Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.Designer.cs delete mode 100644 Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.cs delete mode 100644 Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.Designer.cs delete mode 100644 Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.cs delete mode 100644 Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.Designer.cs delete mode 100644 Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.cs delete mode 100644 Modelo/.Migrations_old/20240907203054_funcatodo.Designer.cs delete mode 100644 Modelo/.Migrations_old/20240907203054_funcatodo.cs delete mode 100644 Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.Designer.cs delete mode 100644 Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.cs delete mode 100644 Modelo/.Migrations_old/20240908162248_mepaseasqlite.cs delete mode 100644 Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.Designer.cs delete mode 100644 Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.cs rename Modelo/{.Migrations_old/20240908162248_mepaseasqlite.Designer.cs => Migrations/20240930233807_initial-migration.Designer.cs} (99%) rename Modelo/Migrations/{20240908162625_mepaseasqlite.cs => 20240930233807_initial-migration.cs} (99%) rename Modelo/{.Migrations_old => Migrations}/ContextModelSnapshot.cs (100%) diff --git a/Controladora/ControladoraFacturas.cs b/Controladora/ControladoraFacturas.cs index c1f33b6..551eb97 100644 --- a/Controladora/ControladoraFacturas.cs +++ b/Controladora/ControladoraFacturas.cs @@ -12,16 +12,10 @@ namespace Controladora repositorioFacturas = new(new Context()); } - private bool ExistePorId(int id) - { - var fac = repositorioFacturas.ObtenerPorId(id); - return (fac.Id == id); - } public string Añadir(Factura t) { if (t == null) return "La Factura es nula, fallo la carga"; - if (ExistePorId(t.Id)) return $"La Factura con el ID {t.Id} ya existe"; if (t.Cliente == null || t.Cliente.Cuit == 0) return "Debe seleccionar un cliente antes de agregar la factura"; string checkstock = ""; @@ -41,7 +35,8 @@ namespace Controladora { repositorioFacturas.Add(t); bool resultado = repositorioFacturas.Guardar(); - string resultadolote = ControladoraLotes.Instance.DisminuirStock(t.MostrarDetalles()); + t = ObtenerPorId(t); + string resultadolote = ControladoraLotes.Instance.DisminuirStock(t); // Convierte ReadOnlyCollection a List var detallesList = new List(t.MostrarDetalles()); @@ -78,6 +73,11 @@ namespace Controladora .AsReadOnly(); } + public Factura ObtenerPorId(Factura fac) + { + return repositorioFacturas.ObtenerPorId(fac); + } + public ReadOnlyCollection ListarDetallesFactura(Factura factura) { Factura facturaalistar = ControladoraFacturas.Instance.Listar().First(x => x.Id == factura.Id); diff --git a/Controladora/ControladoraLotes.cs b/Controladora/ControladoraLotes.cs index f4f253f..56808ec 100644 --- a/Controladora/ControladoraLotes.cs +++ b/Controladora/ControladoraLotes.cs @@ -18,18 +18,17 @@ namespace Controladora repositorioLotes = new(new Context()); } - public string DisminuirStock(ReadOnlyCollection detalleFactura) + public string DisminuirStock(Factura factura) { - var ret = false; - foreach (var detalle in detalleFactura) + foreach (var detalle in factura.Detalles) { if (detalle == null) return "El detalle es nulo"; if (detalle.Producto.Id < 0) return "Esta mal cargada la Id de producto"; var productos = ControladoraProductos.Instance.Listar(); if (!productos.Any(x => x.Id == detalle.Producto.Id)) return "No hay Productos con esa id"; - ret = repositorioLotes.DisminuirStock(detalle); } + var ret = repositorioLotes.DisminuirStock(factura); repositorioLotes.Guardar(); return (ret) ? "Se Descontaron los productos": diff --git a/Entidades/DetalleFactura.cs b/Entidades/DetalleFactura.cs index 05882ca..966aa2b 100644 --- a/Entidades/DetalleFactura.cs +++ b/Entidades/DetalleFactura.cs @@ -14,5 +14,13 @@ namespace Entidades return Producto.Precio * Cantidad; } } + + public string NombreProducto + { + get + { + return Producto.Nombre; + } + } } } diff --git a/Entidades/Factura.cs b/Entidades/Factura.cs index edb2789..4d4ac8c 100644 --- a/Entidades/Factura.cs +++ b/Entidades/Factura.cs @@ -4,32 +4,45 @@ namespace Entidades { public class Factura { - public int Id { get; set; } - public double Total { get; set; } - public DateTime Fecha { get; set; } + public int Id { get; set; } + public double Total { get; set; } + public DateTime Fecha { get; set; } - public long IdCliente { get; set; } - public Cliente Cliente { get; set; } + public long IdCliente { get; set; } + public Cliente Cliente { get; set; } - private List detalles = new List(); - public ReadOnlyCollection Detalles => detalles.AsReadOnly(); - + public List Detalles = new List(); - public void AñadirDetalle(DetalleFactura detalle) + public string NombreCliente + { + get { - detalles.Add(detalle); - } - - public bool EliminarDetalle(DetalleFactura detalle) - { - var aeliminar = detalles.Find(x => x.Id == detalle.Id); - if (aeliminar == null) return false; - return detalles.Remove(aeliminar); - } - - public ReadOnlyCollection MostrarDetalles() - { - return detalles.AsReadOnly(); + return Cliente.NombreCompleto; } } + public long Cuit + { + get + { + return Cliente.Cuit; + } + } + + public void AñadirDetalle(DetalleFactura detalle) + { + Detalles.Add(detalle); + } + + public bool EliminarDetalle(DetalleFactura detalle) + { + var aeliminar = Detalles.Find(x => x.Id == detalle.Id); + if (aeliminar == null) return false; + return Detalles.Remove(aeliminar); + } + + public ReadOnlyCollection MostrarDetalles() + { + return Detalles.AsReadOnly(); + } } +} diff --git a/Entidades/Remito.cs b/Entidades/Remito.cs index 384f8f2..7e14ad8 100644 --- a/Entidades/Remito.cs +++ b/Entidades/Remito.cs @@ -8,7 +8,7 @@ public int Id { get; set; } public Proveedor Proveedor { get; set; } - + public List Lotes = new List(); public void AñadirLote(Lote lote) { diff --git a/Modelo/.Migrations_old/20240812181354_Initial.Designer.cs b/Modelo/.Migrations_old/20240812181354_Initial.Designer.cs deleted file mode 100644 index 1f55a0c..0000000 --- a/Modelo/.Migrations_old/20240812181354_Initial.Designer.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -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("20240812181354_Initial")] - partial class Initial - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); -#pragma warning restore 612, 618 - } - } -} diff --git a/Modelo/.Migrations_old/20240812181354_Initial.cs b/Modelo/.Migrations_old/20240812181354_Initial.cs deleted file mode 100644 index 40bd803..0000000 --- a/Modelo/.Migrations_old/20240812181354_Initial.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Modelo/.Migrations_old/20240826212726_nuevasrelaciones.Designer.cs b/Modelo/.Migrations_old/20240826212726_nuevasrelaciones.Designer.cs deleted file mode 100644 index b55a205..0000000 --- a/Modelo/.Migrations_old/20240826212726_nuevasrelaciones.Designer.cs +++ /dev/null @@ -1,591 +0,0 @@ -// -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 - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descripcion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Categoria", (string)null); - }); - - modelBuilder.Entity("Entidades.Cliente", b => - { - b.Property("Cuit") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Cuit")); - - b.Property("Apellido") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Correo") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("nvarchar(150)"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.HasKey("Cuit"); - - b.ToTable("Clientes", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleFactura", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdFactura") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("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("Id") - .HasColumnType("int"); - - b.Property("IdOrdenDeCompra") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCU") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdOrdenDeCompra"); - - b.HasIndex("IdOrdenDeCompra"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetalleOrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.DetallePresupuesto", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCUPropuesto") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdPresupuesto"); - - b.HasIndex("IdPresupuesto"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallePresupuestos"); - }); - - modelBuilder.Entity("Entidades.Factura", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClienteCuit") - .HasColumnType("bigint"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("bigint"); - - b.Property("Total") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("ClienteCuit"); - - b.ToTable("Facturas", (string)null); - }); - - modelBuilder.Entity("Entidades.Lote", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdRemito") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdRemito"); - - b.HasIndex("IdRemito"); - - b.HasIndex("ProductoId"); - - b.ToTable("Lotes"); - }); - - modelBuilder.Entity("Entidades.OrdenDeCompra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Entregado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("OrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.Presupuesto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Aceptado") - .HasColumnType("bit"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Presupuestos"); - }); - - modelBuilder.Entity("Entidades.Producto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("nvarchar(21)"); - - b.Property("EsPerecedero") - .HasColumnType("bit"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Precio") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Producto"); - - b.HasDiscriminator().HasValue("Producto"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Entidades.Proveedor", b => - { - b.Property("Cuit") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Cuit")); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("RazonSocial") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.HasKey("Cuit"); - - b.ToTable("Proveedores"); - }); - - modelBuilder.Entity("Entidades.Remito", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("IdProveedor") - .HasColumnType("int"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Remitos"); - }); - - modelBuilder.Entity("ProductoCategoria", b => - { - b.Property("CategoriaId") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("CategoriaId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoCategoria"); - }); - - modelBuilder.Entity("ProductoProveedor", b => - { - b.Property("ProductoId") - .HasColumnType("int"); - - b.Property("ProveedorId") - .HasColumnType("bigint"); - - b.HasKey("ProductoId", "ProveedorId"); - - b.HasIndex("ProveedorId"); - - b.ToTable("ProductoProveedor"); - }); - - modelBuilder.Entity("Entidades.ProductoNoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("TipoDeEnvase") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasDiscriminator().HasValue("ProductoNoPercedero"); - }); - - modelBuilder.Entity("Entidades.ProductoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("MesesHastaConsumoPreferente") - .HasColumnType("int"); - - b.Property("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 - } - } -} diff --git a/Modelo/.Migrations_old/20240826212726_nuevasrelaciones.cs b/Modelo/.Migrations_old/20240826212726_nuevasrelaciones.cs deleted file mode 100644 index aeb35cd..0000000 --- a/Modelo/.Migrations_old/20240826212726_nuevasrelaciones.cs +++ /dev/null @@ -1,443 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class nuevasrelaciones : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Categoria", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Descripcion = table.Column(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(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nombre = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - Apellido = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - Direccion = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Correo = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: false), - Habilitado = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nombre = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - Precio = table.Column(type: "float", nullable: false), - Habilitado = table.Column(type: "bit", nullable: false, defaultValue: true), - EsPerecedero = table.Column(type: "bit", nullable: false), - Discriminator = table.Column(type: "nvarchar(21)", maxLength: 21, nullable: false), - TipoDeEnvase = table.Column(type: "nvarchar(max)", nullable: true), - MesesHastaConsumoPreferente = table.Column(type: "int", nullable: true), - MesesHastaVencimiento = table.Column(type: "int", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Producto", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Proveedores", - columns: table => new - { - Cuit = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nombre = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - RazonSocial = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), - Direccion = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), - Habilitado = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Total = table.Column(type: "float", nullable: false), - Fecha = table.Column(type: "datetime2", nullable: false), - IdCliente = table.Column(type: "bigint", nullable: false), - ClienteCuit = table.Column(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(type: "int", nullable: false), - ProductoId = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProveedorCuit = table.Column(type: "bigint", nullable: false), - IdProveedor = table.Column(type: "bigint", nullable: false), - Entregado = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Fecha = table.Column(type: "datetime2", nullable: false), - Habilitado = table.Column(type: "bit", nullable: false), - Aceptado = table.Column(type: "bit", nullable: false), - ProveedorCuit = table.Column(type: "bigint", nullable: false), - IdProveedor = table.Column(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(type: "int", nullable: false), - ProveedorId = table.Column(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(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProveedorCuit = table.Column(type: "bigint", nullable: false), - IdProveedor = table.Column(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(type: "int", nullable: false), - IdFactura = table.Column(type: "int", nullable: false), - Cantidad = table.Column(type: "int", nullable: false), - IdProducto = table.Column(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(type: "int", nullable: false), - IdOrdenDeCompra = table.Column(type: "int", nullable: false), - MontoCU = table.Column(type: "float", nullable: false), - IdPresupuesto = table.Column(type: "int", nullable: false), - Cantidad = table.Column(type: "int", nullable: false), - ProductoId = table.Column(type: "int", nullable: false), - IdProducto = table.Column(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(type: "int", nullable: false), - IdPresupuesto = table.Column(type: "int", nullable: false), - MontoCUPropuesto = table.Column(type: "float", nullable: false), - Cantidad = table.Column(type: "int", nullable: false), - ProductoId = table.Column(type: "int", nullable: false), - IdProducto = table.Column(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(type: "int", nullable: false), - IdRemito = table.Column(type: "int", nullable: false), - Fecha = table.Column(type: "datetime2", nullable: false), - Habilitado = table.Column(type: "bit", nullable: false), - Cantidad = table.Column(type: "int", nullable: false), - ProductoId = table.Column(type: "int", nullable: false), - IdProducto = table.Column(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"); - } - - /// - 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"); - } - } -} diff --git a/Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.Designer.cs b/Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.Designer.cs deleted file mode 100644 index 0373f40..0000000 --- a/Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.Designer.cs +++ /dev/null @@ -1,591 +0,0 @@ -// -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 - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descripcion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Categoria", (string)null); - }); - - modelBuilder.Entity("Entidades.Cliente", b => - { - b.Property("Cuit") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Cuit")); - - b.Property("Apellido") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Correo") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("nvarchar(150)"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.HasKey("Cuit"); - - b.ToTable("Clientes", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleFactura", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdFactura") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("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("Id") - .HasColumnType("int"); - - b.Property("IdOrdenDeCompra") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCU") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdOrdenDeCompra"); - - b.HasIndex("IdOrdenDeCompra"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetalleOrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.DetallePresupuesto", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCUPropuesto") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdPresupuesto"); - - b.HasIndex("IdPresupuesto"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallePresupuestos"); - }); - - modelBuilder.Entity("Entidades.Factura", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClienteCuit") - .HasColumnType("bigint"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("bigint"); - - b.Property("Total") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("ClienteCuit"); - - b.ToTable("Facturas", (string)null); - }); - - modelBuilder.Entity("Entidades.Lote", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdRemito") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdRemito"); - - b.HasIndex("IdRemito"); - - b.HasIndex("ProductoId"); - - b.ToTable("Lotes"); - }); - - modelBuilder.Entity("Entidades.OrdenDeCompra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Entregado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("OrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.Presupuesto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Aceptado") - .HasColumnType("bit"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Presupuestos"); - }); - - modelBuilder.Entity("Entidades.Producto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("nvarchar(21)"); - - b.Property("EsPerecedero") - .HasColumnType("bit"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Precio") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Producto"); - - b.HasDiscriminator().HasValue("Producto"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Entidades.Proveedor", b => - { - b.Property("Cuit") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Cuit")); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("RazonSocial") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.HasKey("Cuit"); - - b.ToTable("Proveedores"); - }); - - modelBuilder.Entity("Entidades.Remito", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("IdProveedor") - .HasColumnType("int"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Remitos"); - }); - - modelBuilder.Entity("ProductoCategoria", b => - { - b.Property("CategoriaId") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("CategoriaId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoCategoria"); - }); - - modelBuilder.Entity("ProductoProveedor", b => - { - b.Property("ProductoId") - .HasColumnType("int"); - - b.Property("ProveedorId") - .HasColumnType("bigint"); - - b.HasKey("ProductoId", "ProveedorId"); - - b.HasIndex("ProveedorId"); - - b.ToTable("ProductoProveedor"); - }); - - modelBuilder.Entity("Entidades.ProductoNoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("TipoDeEnvase") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasDiscriminator().HasValue("ProductoNoPercedero"); - }); - - modelBuilder.Entity("Entidades.ProductoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("MesesHastaConsumoPreferente") - .HasColumnType("int"); - - b.Property("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 - } - } -} diff --git a/Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.cs b/Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.cs deleted file mode 100644 index f4b64de..0000000 --- a/Modelo/.Migrations_old/20240826213353_fixrelacionproductocategoria.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class fixrelacionproductocategoria : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.Designer.cs b/Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.Designer.cs deleted file mode 100644 index 5843692..0000000 --- a/Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.Designer.cs +++ /dev/null @@ -1,591 +0,0 @@ -// -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 - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descripcion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Categoria", (string)null); - }); - - modelBuilder.Entity("Entidades.Cliente", b => - { - b.Property("Cuit") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Cuit")); - - b.Property("Apellido") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Correo") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("nvarchar(150)"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.HasKey("Cuit"); - - b.ToTable("Clientes", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleFactura", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdFactura") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("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("Id") - .HasColumnType("int"); - - b.Property("IdOrdenDeCompra") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCU") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdOrdenDeCompra"); - - b.HasIndex("IdOrdenDeCompra"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetalleOrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.DetallePresupuesto", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCUPropuesto") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdPresupuesto"); - - b.HasIndex("IdPresupuesto"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallePresupuestos"); - }); - - modelBuilder.Entity("Entidades.Factura", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClienteCuit") - .HasColumnType("bigint"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("bigint"); - - b.Property("Total") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("ClienteCuit"); - - b.ToTable("Facturas", (string)null); - }); - - modelBuilder.Entity("Entidades.Lote", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdRemito") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdRemito"); - - b.HasIndex("IdRemito"); - - b.HasIndex("ProductoId"); - - b.ToTable("Lotes"); - }); - - modelBuilder.Entity("Entidades.OrdenDeCompra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Entregado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("OrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.Presupuesto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Aceptado") - .HasColumnType("bit"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Presupuestos"); - }); - - modelBuilder.Entity("Entidades.Producto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("nvarchar(21)"); - - b.Property("EsPerecedero") - .HasColumnType("bit"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Precio") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Producto"); - - b.HasDiscriminator().HasValue("Producto"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Entidades.Proveedor", b => - { - b.Property("Cuit") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Cuit")); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("RazonSocial") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.HasKey("Cuit"); - - b.ToTable("Proveedores"); - }); - - modelBuilder.Entity("Entidades.Remito", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("IdProveedor") - .HasColumnType("int"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Remitos"); - }); - - modelBuilder.Entity("ProductoCategoria", b => - { - b.Property("CategoriaId") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("CategoriaId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoCategoria"); - }); - - modelBuilder.Entity("ProductoProveedor", b => - { - b.Property("ProveedorId") - .HasColumnType("bigint"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("ProveedorId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoProveedor"); - }); - - modelBuilder.Entity("Entidades.ProductoNoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("TipoDeEnvase") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasDiscriminator().HasValue("ProductoNoPercedero"); - }); - - modelBuilder.Entity("Entidades.ProductoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("MesesHastaConsumoPreferente") - .HasColumnType("int"); - - b.Property("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 - } - } -} diff --git a/Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.cs b/Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.cs deleted file mode 100644 index fa1dcbe..0000000 --- a/Modelo/.Migrations_old/20240826222040_cambiadapkcompuesta.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class cambiadapkcompuesta : Migration - { - /// - 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"); - } - - /// - 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"); - } - } -} diff --git a/Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.Designer.cs b/Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.Designer.cs deleted file mode 100644 index 7e8ffbd..0000000 --- a/Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.Designer.cs +++ /dev/null @@ -1,585 +0,0 @@ -// -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 - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descripcion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Categoria", (string)null); - }); - - modelBuilder.Entity("Entidades.Cliente", b => - { - b.Property("Cuit") - .HasColumnType("bigint"); - - b.Property("Apellido") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Correo") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("nvarchar(150)"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.HasKey("Cuit"); - - b.ToTable("Clientes", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleFactura", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdFactura") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("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("Id") - .HasColumnType("int"); - - b.Property("IdOrdenDeCompra") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCU") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdOrdenDeCompra"); - - b.HasIndex("IdOrdenDeCompra"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetalleOrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.DetallePresupuesto", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("MontoCUPropuesto") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdPresupuesto"); - - b.HasIndex("IdPresupuesto"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallePresupuestos"); - }); - - modelBuilder.Entity("Entidades.Factura", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClienteCuit") - .HasColumnType("bigint"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("bigint"); - - b.Property("Total") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("ClienteCuit"); - - b.ToTable("Facturas", (string)null); - }); - - modelBuilder.Entity("Entidades.Lote", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdRemito") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProducto") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdRemito"); - - b.HasIndex("IdRemito"); - - b.HasIndex("ProductoId"); - - b.ToTable("Lotes"); - }); - - modelBuilder.Entity("Entidades.OrdenDeCompra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Entregado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("OrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.Presupuesto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Aceptado") - .HasColumnType("bit"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Presupuestos"); - }); - - modelBuilder.Entity("Entidades.Producto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("nvarchar(21)"); - - b.Property("EsPerecedero") - .HasColumnType("bit"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Precio") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Producto"); - - b.HasDiscriminator().HasValue("Producto"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Entidades.Proveedor", b => - { - b.Property("Cuit") - .HasColumnType("bigint"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("RazonSocial") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.HasKey("Cuit"); - - b.ToTable("Proveedores"); - }); - - modelBuilder.Entity("Entidades.Remito", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("IdProveedor") - .HasColumnType("int"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Remitos"); - }); - - modelBuilder.Entity("ProductoCategoria", b => - { - b.Property("CategoriaId") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("CategoriaId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoCategoria"); - }); - - modelBuilder.Entity("ProductoProveedor", b => - { - b.Property("ProveedorId") - .HasColumnType("bigint"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("ProveedorId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoProveedor"); - }); - - modelBuilder.Entity("Entidades.ProductoNoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("TipoDeEnvase") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasDiscriminator().HasValue("ProductoNoPercedero"); - }); - - modelBuilder.Entity("Entidades.ProductoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("MesesHastaConsumoPreferente") - .HasColumnType("int"); - - b.Property("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 - } - } -} diff --git a/Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.cs b/Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.cs deleted file mode 100644 index a9e2f14..0000000 --- a/Modelo/.Migrations_old/20240827025739_CuitNotGenerateValue.cs +++ /dev/null @@ -1,163 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class CuitNotGenerateValue : Migration - { - /// - 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( - name: "Cuit", - table: "Clientes", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddPrimaryKey( - name: "PK_Clientes", - table: "Clientes", - column: "Cuit"); - - migrationBuilder.AddColumn( - 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); - - } - - /// - 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( - name: "Cuit", - table: "Proveedores", - type: "bigint", - nullable: false, - defaultValue: 0L) - .Annotation("SqlServer:Identity", "1, 1"); - - migrationBuilder.AddColumn( - 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"); - - } - } -} diff --git a/Modelo/.Migrations_old/20240907203054_funcatodo.Designer.cs b/Modelo/.Migrations_old/20240907203054_funcatodo.Designer.cs deleted file mode 100644 index e06d38b..0000000 --- a/Modelo/.Migrations_old/20240907203054_funcatodo.Designer.cs +++ /dev/null @@ -1,576 +0,0 @@ -// -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("20240907203054_funcatodo")] - partial class funcatodo - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descripcion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Categoria", (string)null); - }); - - modelBuilder.Entity("Entidades.Cliente", b => - { - b.Property("Cuit") - .HasColumnType("bigint"); - - b.Property("Apellido") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Correo") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("nvarchar(150)"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.HasKey("Cuit"); - - b.ToTable("Clientes", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleFactura", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdFactura") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdFactura"); - - b.HasIndex("IdFactura"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallesFacturas", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdOrdenDeCompra") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("MontoCU") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdOrdenDeCompra"); - - b.HasIndex("IdOrdenDeCompra"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetalleOrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.DetallePresupuesto", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("MontoCUPropuesto") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdPresupuesto"); - - b.HasIndex("IdPresupuesto"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallePresupuestos"); - }); - - modelBuilder.Entity("Entidades.Factura", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClienteCuit") - .HasColumnType("bigint"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("bigint"); - - b.Property("Total") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("ClienteCuit"); - - b.ToTable("Facturas", (string)null); - }); - - modelBuilder.Entity("Entidades.Lote", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdRemito") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdRemito"); - - b.HasIndex("IdRemito"); - - b.HasIndex("ProductoId"); - - b.ToTable("Lotes"); - }); - - modelBuilder.Entity("Entidades.OrdenDeCompra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Entregado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("OrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.Presupuesto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Aceptado") - .HasColumnType("bit"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Presupuestos"); - }); - - modelBuilder.Entity("Entidades.Producto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("nvarchar(21)"); - - b.Property("EsPerecedero") - .HasColumnType("bit"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Precio") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Producto"); - - b.HasDiscriminator().HasValue("Producto"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Entidades.Proveedor", b => - { - b.Property("Cuit") - .HasColumnType("bigint"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("RazonSocial") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.HasKey("Cuit"); - - b.ToTable("Proveedores"); - }); - - modelBuilder.Entity("Entidades.Remito", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("IdProveedor") - .HasColumnType("int"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Remitos"); - }); - - modelBuilder.Entity("ProductoCategoria", b => - { - b.Property("CategoriaId") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("CategoriaId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoCategoria"); - }); - - modelBuilder.Entity("ProductoProveedor", b => - { - b.Property("ProveedorId") - .HasColumnType("bigint"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("ProveedorId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoProveedor"); - }); - - modelBuilder.Entity("Entidades.ProductoNoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("TipoDeEnvase") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasDiscriminator().HasValue("ProductoNoPercedero"); - }); - - modelBuilder.Entity("Entidades.ProductoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("MesesHastaConsumoPreferente") - .HasColumnType("int"); - - b.Property("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("ProductoId") - .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 - } - } -} diff --git a/Modelo/.Migrations_old/20240907203054_funcatodo.cs b/Modelo/.Migrations_old/20240907203054_funcatodo.cs deleted file mode 100644 index 0633ffd..0000000 --- a/Modelo/.Migrations_old/20240907203054_funcatodo.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class funcatodo : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_DetallesFacturas_Producto_IdProducto", - table: "DetallesFacturas"); - - migrationBuilder.DropColumn( - name: "IdProducto", - table: "Lotes"); - - migrationBuilder.DropColumn( - name: "IdProducto", - table: "DetallePresupuestos"); - - migrationBuilder.DropColumn( - name: "IdProducto", - table: "DetalleOrdenDeCompras"); - - migrationBuilder.RenameColumn( - name: "IdProducto", - table: "DetallesFacturas", - newName: "ProductoId"); - - migrationBuilder.RenameIndex( - name: "IX_DetallesFacturas_IdProducto", - table: "DetallesFacturas", - newName: "IX_DetallesFacturas_ProductoId"); - - migrationBuilder.AddForeignKey( - name: "FK_DetallesFacturas_Producto_ProductoId", - table: "DetallesFacturas", - column: "ProductoId", - principalTable: "Producto", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_DetallesFacturas_Producto_ProductoId", - table: "DetallesFacturas"); - - migrationBuilder.RenameColumn( - name: "ProductoId", - table: "DetallesFacturas", - newName: "IdProducto"); - - migrationBuilder.RenameIndex( - name: "IX_DetallesFacturas_ProductoId", - table: "DetallesFacturas", - newName: "IX_DetallesFacturas_IdProducto"); - - migrationBuilder.AddColumn( - name: "IdProducto", - table: "Lotes", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "IdProducto", - table: "DetallePresupuestos", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "IdProducto", - table: "DetalleOrdenDeCompras", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddForeignKey( - name: "FK_DetallesFacturas_Producto_IdProducto", - table: "DetallesFacturas", - column: "IdProducto", - principalTable: "Producto", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.Designer.cs b/Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.Designer.cs deleted file mode 100644 index 0124cba..0000000 --- a/Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.Designer.cs +++ /dev/null @@ -1,573 +0,0 @@ -// -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("20240908160636_eliminadocamporedundante")] - partial class eliminadocamporedundante - { - /// - 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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descripcion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.ToTable("Categoria", (string)null); - }); - - modelBuilder.Entity("Entidades.Cliente", b => - { - b.Property("Cuit") - .HasColumnType("bigint"); - - b.Property("Apellido") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Correo") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("nvarchar(150)"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.HasKey("Cuit"); - - b.ToTable("Clientes", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleFactura", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdFactura") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdFactura"); - - b.HasIndex("IdFactura"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallesFacturas", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdOrdenDeCompra") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("MontoCU") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdOrdenDeCompra"); - - b.HasIndex("IdOrdenDeCompra"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetalleOrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.DetallePresupuesto", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdPresupuesto") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("MontoCUPropuesto") - .HasColumnType("float"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdPresupuesto"); - - b.HasIndex("IdPresupuesto"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallePresupuestos"); - }); - - modelBuilder.Entity("Entidades.Factura", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClienteCuit") - .HasColumnType("bigint"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("bigint"); - - b.Property("Total") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.HasIndex("ClienteCuit"); - - b.ToTable("Facturas", (string)null); - }); - - modelBuilder.Entity("Entidades.Lote", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("IdRemito") - .HasColumnType("int"); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("Id", "IdRemito"); - - b.HasIndex("IdRemito"); - - b.HasIndex("ProductoId"); - - b.ToTable("Lotes"); - }); - - modelBuilder.Entity("Entidades.OrdenDeCompra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Entregado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("OrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.Presupuesto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Aceptado") - .HasColumnType("bit"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdProveedor") - .HasColumnType("bigint"); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Presupuestos"); - }); - - modelBuilder.Entity("Entidades.Producto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("nvarchar(21)"); - - b.Property("EsPerecedero") - .HasColumnType("bit"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("Precio") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Producto"); - - b.HasDiscriminator().HasValue("Producto"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Entidades.Proveedor", b => - { - b.Property("Cuit") - .HasColumnType("bigint"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("RazonSocial") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.HasKey("Cuit"); - - b.ToTable("Proveedores"); - }); - - modelBuilder.Entity("Entidades.Remito", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ProveedorCuit") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Remitos"); - }); - - modelBuilder.Entity("ProductoCategoria", b => - { - b.Property("CategoriaId") - .HasColumnType("int"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("CategoriaId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoCategoria"); - }); - - modelBuilder.Entity("ProductoProveedor", b => - { - b.Property("ProveedorId") - .HasColumnType("bigint"); - - b.Property("ProductoId") - .HasColumnType("int"); - - b.HasKey("ProveedorId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoProveedor"); - }); - - modelBuilder.Entity("Entidades.ProductoNoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("TipoDeEnvase") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasDiscriminator().HasValue("ProductoNoPercedero"); - }); - - modelBuilder.Entity("Entidades.ProductoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("MesesHastaConsumoPreferente") - .HasColumnType("int"); - - b.Property("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("ProductoId") - .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 - } - } -} diff --git a/Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.cs b/Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.cs deleted file mode 100644 index fcea0a2..0000000 --- a/Modelo/.Migrations_old/20240908160636_eliminadocamporedundante.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class eliminadocamporedundante : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IdProveedor", - table: "Remitos"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IdProveedor", - table: "Remitos", - type: "int", - nullable: false, - defaultValue: 0); - } - } -} diff --git a/Modelo/.Migrations_old/20240908162248_mepaseasqlite.cs b/Modelo/.Migrations_old/20240908162248_mepaseasqlite.cs deleted file mode 100644 index d0a9797..0000000 --- a/Modelo/.Migrations_old/20240908162248_mepaseasqlite.cs +++ /dev/null @@ -1,1109 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class mepaseasqlite : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ProveedorCuit", - table: "Remitos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Remitos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "RazonSocial", - table: "Proveedores", - type: "TEXT", - maxLength: 60, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(60)", - oldMaxLength: 60); - - migrationBuilder.AlterColumn( - name: "Nombre", - table: "Proveedores", - type: "TEXT", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(30)", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Proveedores", - type: "INTEGER", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "bit", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "Direccion", - table: "Proveedores", - type: "TEXT", - maxLength: 60, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(60)", - oldMaxLength: 60); - - migrationBuilder.AlterColumn( - name: "Cuit", - table: "Proveedores", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "ProductoProveedor", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "ProveedorId", - table: "ProductoProveedor", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "ProductoCategoria", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "CategoriaId", - table: "ProductoCategoria", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "TipoDeEnvase", - table: "Producto", - type: "TEXT", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Nombre", - table: "Producto", - type: "TEXT", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(30)", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "MesesHastaVencimiento", - table: "Producto", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "int", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MesesHastaConsumoPreferente", - table: "Producto", - type: "INTEGER", - nullable: true, - oldClrType: typeof(int), - oldType: "int", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Producto", - type: "INTEGER", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "bit", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "EsPerecedero", - table: "Producto", - type: "INTEGER", - nullable: false, - oldClrType: typeof(bool), - oldType: "bit"); - - migrationBuilder.AlterColumn( - name: "Discriminator", - table: "Producto", - type: "TEXT", - maxLength: 21, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(21)", - oldMaxLength: 21); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Producto", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProveedorCuit", - table: "Presupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "IdProveedor", - table: "Presupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Presupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(bool), - oldType: "bit"); - - migrationBuilder.AlterColumn( - name: "Fecha", - table: "Presupuestos", - type: "TEXT", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime2"); - - migrationBuilder.AlterColumn( - name: "Aceptado", - table: "Presupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(bool), - oldType: "bit"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Presupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProveedorCuit", - table: "OrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "IdProveedor", - table: "OrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "Entregado", - table: "OrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(bool), - oldType: "bit"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "OrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "Lotes", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Lotes", - type: "INTEGER", - nullable: false, - oldClrType: typeof(bool), - oldType: "bit"); - - migrationBuilder.AlterColumn( - name: "Fecha", - table: "Lotes", - type: "TEXT", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime2"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "Lotes", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "IdRemito", - table: "Lotes", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Lotes", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Total", - table: "Facturas", - type: "REAL", - nullable: false, - oldClrType: typeof(double), - oldType: "float"); - - migrationBuilder.AlterColumn( - name: "IdCliente", - table: "Facturas", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "Fecha", - table: "Facturas", - type: "TEXT", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "datetime2"); - - migrationBuilder.AlterColumn( - name: "ClienteCuit", - table: "Facturas", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Facturas", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "DetallesFacturas", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "DetallesFacturas", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "IdFactura", - table: "DetallesFacturas", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "DetallesFacturas", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "DetallePresupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "MontoCUPropuesto", - table: "DetallePresupuestos", - type: "REAL", - nullable: false, - oldClrType: typeof(double), - oldType: "float"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "DetallePresupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "IdPresupuesto", - table: "DetallePresupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "DetallePresupuestos", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "DetalleOrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "MontoCU", - table: "DetalleOrdenDeCompras", - type: "REAL", - nullable: false, - oldClrType: typeof(double), - oldType: "float"); - - migrationBuilder.AlterColumn( - name: "IdPresupuesto", - table: "DetalleOrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "DetalleOrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "IdOrdenDeCompra", - table: "DetalleOrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "DetalleOrdenDeCompras", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int"); - - migrationBuilder.AlterColumn( - name: "Nombre", - table: "Clientes", - type: "TEXT", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(30)", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Clientes", - type: "INTEGER", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "bit", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "Direccion", - table: "Clientes", - type: "TEXT", - maxLength: 50, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(50)", - oldMaxLength: 50); - - migrationBuilder.AlterColumn( - name: "Correo", - table: "Clientes", - type: "TEXT", - maxLength: 150, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(150)", - oldMaxLength: 150); - - migrationBuilder.AlterColumn( - name: "Apellido", - table: "Clientes", - type: "TEXT", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(30)", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "Cuit", - table: "Clientes", - type: "INTEGER", - nullable: false, - oldClrType: typeof(long), - oldType: "bigint"); - - migrationBuilder.AlterColumn( - name: "Descripcion", - table: "Categoria", - type: "TEXT", - maxLength: 50, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(50)", - oldMaxLength: 50); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Categoria", - type: "INTEGER", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "ProveedorCuit", - table: "Remitos", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Remitos", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "RazonSocial", - table: "Proveedores", - type: "nvarchar(60)", - maxLength: 60, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 60); - - migrationBuilder.AlterColumn( - name: "Nombre", - table: "Proveedores", - type: "nvarchar(30)", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Proveedores", - type: "bit", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "INTEGER", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "Direccion", - table: "Proveedores", - type: "nvarchar(60)", - maxLength: 60, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 60); - - migrationBuilder.AlterColumn( - name: "Cuit", - table: "Proveedores", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "ProductoProveedor", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "ProveedorId", - table: "ProductoProveedor", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "ProductoCategoria", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "CategoriaId", - table: "ProductoCategoria", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "TipoDeEnvase", - table: "Producto", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "TEXT", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Nombre", - table: "Producto", - type: "nvarchar(30)", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "MesesHastaVencimiento", - table: "Producto", - type: "int", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MesesHastaConsumoPreferente", - table: "Producto", - type: "int", - nullable: true, - oldClrType: typeof(int), - oldType: "INTEGER", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Producto", - type: "bit", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "INTEGER", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "EsPerecedero", - table: "Producto", - type: "bit", - nullable: false, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Discriminator", - table: "Producto", - type: "nvarchar(21)", - maxLength: 21, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 21); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Producto", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProveedorCuit", - table: "Presupuestos", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "IdProveedor", - table: "Presupuestos", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Presupuestos", - type: "bit", - nullable: false, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Fecha", - table: "Presupuestos", - type: "datetime2", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "TEXT"); - - migrationBuilder.AlterColumn( - name: "Aceptado", - table: "Presupuestos", - type: "bit", - nullable: false, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Presupuestos", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProveedorCuit", - table: "OrdenDeCompras", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "IdProveedor", - table: "OrdenDeCompras", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Entregado", - table: "OrdenDeCompras", - type: "bit", - nullable: false, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "OrdenDeCompras", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "Lotes", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Lotes", - type: "bit", - nullable: false, - oldClrType: typeof(bool), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Fecha", - table: "Lotes", - type: "datetime2", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "TEXT"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "Lotes", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "IdRemito", - table: "Lotes", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Lotes", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Total", - table: "Facturas", - type: "float", - nullable: false, - oldClrType: typeof(double), - oldType: "REAL"); - - migrationBuilder.AlterColumn( - name: "IdCliente", - table: "Facturas", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Fecha", - table: "Facturas", - type: "datetime2", - nullable: false, - oldClrType: typeof(DateTime), - oldType: "TEXT"); - - migrationBuilder.AlterColumn( - name: "ClienteCuit", - table: "Facturas", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Facturas", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "DetallesFacturas", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "DetallesFacturas", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "IdFactura", - table: "DetallesFacturas", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "DetallesFacturas", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "DetallePresupuestos", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "MontoCUPropuesto", - table: "DetallePresupuestos", - type: "float", - nullable: false, - oldClrType: typeof(double), - oldType: "REAL"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "DetallePresupuestos", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "IdPresupuesto", - table: "DetallePresupuestos", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "DetallePresupuestos", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "ProductoId", - table: "DetalleOrdenDeCompras", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "MontoCU", - table: "DetalleOrdenDeCompras", - type: "float", - nullable: false, - oldClrType: typeof(double), - oldType: "REAL"); - - migrationBuilder.AlterColumn( - name: "IdPresupuesto", - table: "DetalleOrdenDeCompras", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Cantidad", - table: "DetalleOrdenDeCompras", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "IdOrdenDeCompra", - table: "DetalleOrdenDeCompras", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Id", - table: "DetalleOrdenDeCompras", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Nombre", - table: "Clientes", - type: "nvarchar(30)", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "Habilitado", - table: "Clientes", - type: "bit", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "INTEGER", - oldDefaultValue: true); - - migrationBuilder.AlterColumn( - name: "Direccion", - table: "Clientes", - type: "nvarchar(50)", - maxLength: 50, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 50); - - migrationBuilder.AlterColumn( - name: "Correo", - table: "Clientes", - type: "nvarchar(150)", - maxLength: 150, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 150); - - migrationBuilder.AlterColumn( - name: "Apellido", - table: "Clientes", - type: "nvarchar(30)", - maxLength: 30, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 30); - - migrationBuilder.AlterColumn( - name: "Cuit", - table: "Clientes", - type: "bigint", - nullable: false, - oldClrType: typeof(long), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "Descripcion", - table: "Categoria", - type: "nvarchar(50)", - maxLength: 50, - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT", - oldMaxLength: 50); - - migrationBuilder.AlterColumn( - name: "Id", - table: "Categoria", - type: "int", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER") - .Annotation("Sqlite:Autoincrement", true) - .OldAnnotation("Sqlite:Autoincrement", true); - } - } -} diff --git a/Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.Designer.cs b/Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.Designer.cs deleted file mode 100644 index 4651bf9..0000000 --- a/Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.Designer.cs +++ /dev/null @@ -1,556 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Modelo; - -#nullable disable - -namespace Modelo.Migrations -{ - [DbContext(typeof(Context))] - [Migration("20240908172708_Cambie_nombre_de_key2")] - partial class Cambie_nombre_de_key2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "8.0.8"); - - modelBuilder.Entity("Entidades.Categoria", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Descripcion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Categoria", (string)null); - }); - - modelBuilder.Entity("Entidades.Cliente", b => - { - b.Property("Cuit") - .HasColumnType("INTEGER"); - - b.Property("Apellido") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Correo") - .IsRequired() - .HasMaxLength(150) - .HasColumnType("TEXT"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("TEXT"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.HasKey("Cuit"); - - b.ToTable("Clientes", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleFactura", b => - { - b.Property("Id") - .HasColumnType("INTEGER"); - - b.Property("IdFactura") - .HasColumnType("INTEGER"); - - b.Property("Cantidad") - .HasColumnType("INTEGER"); - - b.Property("ProductoId") - .HasColumnType("INTEGER"); - - b.HasKey("Id", "IdFactura"); - - b.HasIndex("IdFactura"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallesFacturas", (string)null); - }); - - modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b => - { - b.Property("Id") - .HasColumnType("INTEGER"); - - b.Property("IdOrdenDeCompra") - .HasColumnType("INTEGER"); - - b.Property("Cantidad") - .HasColumnType("INTEGER"); - - b.Property("IdPresupuesto") - .HasColumnType("INTEGER"); - - b.Property("MontoCU") - .HasColumnType("REAL"); - - b.Property("ProductoId") - .HasColumnType("INTEGER"); - - b.HasKey("Id", "IdOrdenDeCompra"); - - b.HasIndex("IdOrdenDeCompra"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetalleOrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.DetallePresupuesto", b => - { - b.Property("Id") - .HasColumnType("INTEGER"); - - b.Property("IdPresupuesto") - .HasColumnType("INTEGER"); - - b.Property("Cantidad") - .HasColumnType("INTEGER"); - - b.Property("MontoCUPropuesto") - .HasColumnType("REAL"); - - b.Property("ProductoId") - .HasColumnType("INTEGER"); - - b.HasKey("Id", "IdPresupuesto"); - - b.HasIndex("IdPresupuesto"); - - b.HasIndex("ProductoId"); - - b.ToTable("DetallePresupuestos"); - }); - - modelBuilder.Entity("Entidades.Factura", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ClienteCuit") - .HasColumnType("INTEGER"); - - b.Property("Fecha") - .HasColumnType("TEXT"); - - b.Property("IdCliente") - .HasColumnType("INTEGER"); - - b.Property("Total") - .HasColumnType("REAL"); - - b.HasKey("Id"); - - b.HasIndex("ClienteCuit"); - - b.ToTable("Facturas", (string)null); - }); - - modelBuilder.Entity("Entidades.Lote", b => - { - b.Property("Id") - .HasColumnType("INTEGER"); - - b.Property("IdRemito") - .HasColumnType("INTEGER"); - - b.Property("Cantidad") - .HasColumnType("INTEGER"); - - b.Property("Fecha") - .HasColumnType("TEXT"); - - b.Property("Habilitado") - .HasColumnType("INTEGER"); - - b.Property("ProductoId") - .HasColumnType("INTEGER"); - - b.HasKey("Id", "IdRemito"); - - b.HasIndex("IdRemito"); - - b.HasIndex("ProductoId"); - - b.ToTable("Lotes"); - }); - - modelBuilder.Entity("Entidades.OrdenDeCompra", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Entregado") - .HasColumnType("INTEGER"); - - b.Property("IdProveedor") - .HasColumnType("INTEGER"); - - b.Property("ProveedorCuit") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("OrdenDeCompras"); - }); - - modelBuilder.Entity("Entidades.Presupuesto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Aceptado") - .HasColumnType("INTEGER"); - - b.Property("Fecha") - .HasColumnType("TEXT"); - - b.Property("Habilitado") - .HasColumnType("INTEGER"); - - b.Property("IdProveedor") - .HasColumnType("INTEGER"); - - b.Property("ProveedorCuit") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Presupuestos"); - }); - - modelBuilder.Entity("Entidades.Producto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("TEXT"); - - b.Property("EsPerecedero") - .HasColumnType("INTEGER"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("Precio") - .HasColumnType("float"); - - b.HasKey("Id"); - - b.ToTable("Producto"); - - b.HasDiscriminator().HasValue("Producto"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("Entidades.Proveedor", b => - { - b.Property("Cuit") - .HasColumnType("INTEGER"); - - b.Property("Direccion") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("TEXT"); - - b.Property("Habilitado") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER") - .HasDefaultValue(true); - - b.Property("Nombre") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("TEXT"); - - b.Property("RazonSocial") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("TEXT"); - - b.HasKey("Cuit"); - - b.ToTable("Proveedores"); - }); - - modelBuilder.Entity("Entidades.Remito", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("ProveedorCuit") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.HasIndex("ProveedorCuit"); - - b.ToTable("Remitos"); - }); - - modelBuilder.Entity("ProductoCategoria", b => - { - b.Property("CategoriaId") - .HasColumnType("INTEGER"); - - b.Property("ProductoId") - .HasColumnType("INTEGER"); - - b.HasKey("CategoriaId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoCategoria"); - }); - - modelBuilder.Entity("ProductoProveedor", b => - { - b.Property("ProveedorId") - .HasColumnType("INTEGER"); - - b.Property("ProductoId") - .HasColumnType("INTEGER"); - - b.HasKey("ProveedorId", "ProductoId"); - - b.HasIndex("ProductoId"); - - b.ToTable("ProductoProveedor"); - }); - - modelBuilder.Entity("Entidades.ProductoNoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("TipoDeEnvase") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasDiscriminator().HasValue("ProductoNoPercedero"); - }); - - modelBuilder.Entity("Entidades.ProductoPercedero", b => - { - b.HasBaseType("Entidades.Producto"); - - b.Property("MesesHastaConsumoPreferente") - .HasColumnType("INTEGER"); - - b.Property("MesesHastaVencimiento") - .HasColumnType("INTEGER"); - - 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("ProductoId") - .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 - } - } -} diff --git a/Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.cs b/Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.cs deleted file mode 100644 index b6f6370..0000000 --- a/Modelo/Migrations/20240908172708_Cambie_nombre_de_key2.cs +++ /dev/null @@ -1,437 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Modelo.Migrations -{ - /// - public partial class Cambie_nombre_de_key2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Categoria", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Descripcion = table.Column(type: "TEXT", maxLength: 50, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Categoria", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Clientes", - columns: table => new - { - Cuit = table.Column(type: "INTEGER", nullable: false), - Nombre = table.Column(type: "TEXT", maxLength: 30, nullable: false), - Apellido = table.Column(type: "TEXT", maxLength: 30, nullable: false), - Direccion = table.Column(type: "TEXT", maxLength: 50, nullable: false), - Correo = table.Column(type: "TEXT", maxLength: 150, nullable: false), - Habilitado = table.Column(type: "INTEGER", nullable: false, defaultValue: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Clientes", x => x.Cuit); - }); - - migrationBuilder.CreateTable( - name: "Producto", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Nombre = table.Column(type: "TEXT", maxLength: 30, nullable: false), - Precio = table.Column(type: "float", nullable: false), - Habilitado = table.Column(type: "INTEGER", nullable: false, defaultValue: true), - EsPerecedero = table.Column(type: "INTEGER", nullable: false), - Discriminator = table.Column(type: "TEXT", maxLength: 21, nullable: false), - TipoDeEnvase = table.Column(type: "TEXT", nullable: true), - MesesHastaConsumoPreferente = table.Column(type: "INTEGER", nullable: true), - MesesHastaVencimiento = table.Column(type: "INTEGER", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Producto", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Proveedores", - columns: table => new - { - Cuit = table.Column(type: "INTEGER", nullable: false), - Nombre = table.Column(type: "TEXT", maxLength: 30, nullable: false), - RazonSocial = table.Column(type: "TEXT", maxLength: 60, nullable: false), - Direccion = table.Column(type: "TEXT", maxLength: 60, nullable: false), - Habilitado = table.Column(type: "INTEGER", nullable: false, defaultValue: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Proveedores", x => x.Cuit); - }); - - migrationBuilder.CreateTable( - name: "Facturas", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Total = table.Column(type: "REAL", nullable: false), - Fecha = table.Column(type: "TEXT", nullable: false), - IdCliente = table.Column(type: "INTEGER", nullable: false), - ClienteCuit = table.Column(type: "INTEGER", 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(type: "INTEGER", nullable: false), - ProductoId = table.Column(type: "INTEGER", 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(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ProveedorCuit = table.Column(type: "INTEGER", nullable: false), - IdProveedor = table.Column(type: "INTEGER", nullable: false), - Entregado = table.Column(type: "INTEGER", 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(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Fecha = table.Column(type: "TEXT", nullable: false), - Habilitado = table.Column(type: "INTEGER", nullable: false), - Aceptado = table.Column(type: "INTEGER", nullable: false), - ProveedorCuit = table.Column(type: "INTEGER", nullable: false), - IdProveedor = table.Column(type: "INTEGER", 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 - { - ProveedorId = table.Column(type: "INTEGER", nullable: false), - ProductoId = table.Column(type: "INTEGER", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ProductoProveedor", x => new { x.ProveedorId, x.ProductoId }); - 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(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ProveedorCuit = table.Column(type: "INTEGER", 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(type: "INTEGER", nullable: false), - IdFactura = table.Column(type: "INTEGER", nullable: false), - Cantidad = table.Column(type: "INTEGER", nullable: false), - ProductoId = table.Column(type: "INTEGER", 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_ProductoId", - column: x => x.ProductoId, - principalTable: "Producto", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "DetalleOrdenDeCompras", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false), - IdOrdenDeCompra = table.Column(type: "INTEGER", nullable: false), - MontoCU = table.Column(type: "REAL", nullable: false), - IdPresupuesto = table.Column(type: "INTEGER", nullable: false), - Cantidad = table.Column(type: "INTEGER", nullable: false), - ProductoId = table.Column(type: "INTEGER", 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(type: "INTEGER", nullable: false), - IdPresupuesto = table.Column(type: "INTEGER", nullable: false), - MontoCUPropuesto = table.Column(type: "REAL", nullable: false), - Cantidad = table.Column(type: "INTEGER", nullable: false), - ProductoId = table.Column(type: "INTEGER", 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(type: "INTEGER", nullable: false), - IdRemito = table.Column(type: "INTEGER", nullable: false), - Fecha = table.Column(type: "TEXT", nullable: false), - Habilitado = table.Column(type: "INTEGER", nullable: false), - Cantidad = table.Column(type: "INTEGER", nullable: false), - ProductoId = table.Column(type: "INTEGER", 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_ProductoId", - table: "DetallesFacturas", - column: "ProductoId"); - - 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_ProductoId", - table: "ProductoProveedor", - column: "ProductoId"); - - migrationBuilder.CreateIndex( - name: "IX_Remitos_ProveedorCuit", - table: "Remitos", - column: "ProveedorCuit"); - } - - /// - 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"); - } - } -} diff --git a/Modelo/.Migrations_old/20240908162248_mepaseasqlite.Designer.cs b/Modelo/Migrations/20240930233807_initial-migration.Designer.cs similarity index 99% rename from Modelo/.Migrations_old/20240908162248_mepaseasqlite.Designer.cs rename to Modelo/Migrations/20240930233807_initial-migration.Designer.cs index 84fddff..704f6da 100644 --- a/Modelo/.Migrations_old/20240908162248_mepaseasqlite.Designer.cs +++ b/Modelo/Migrations/20240930233807_initial-migration.Designer.cs @@ -11,8 +11,8 @@ using Modelo; namespace Modelo.Migrations { [DbContext(typeof(Context))] - [Migration("20240908162248_mepaseasqlite")] - partial class mepaseasqlite + [Migration("20240930233807_initial-migration")] + partial class initialmigration { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/Modelo/Migrations/20240908162625_mepaseasqlite.cs b/Modelo/Migrations/20240930233807_initial-migration.cs similarity index 99% rename from Modelo/Migrations/20240908162625_mepaseasqlite.cs rename to Modelo/Migrations/20240930233807_initial-migration.cs index 0c0e86f..8b18e95 100644 --- a/Modelo/Migrations/20240908162625_mepaseasqlite.cs +++ b/Modelo/Migrations/20240930233807_initial-migration.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace Modelo.Migrations { /// - public partial class mepaseasqlite : Migration + public partial class initialmigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) diff --git a/Modelo/.Migrations_old/ContextModelSnapshot.cs b/Modelo/Migrations/ContextModelSnapshot.cs similarity index 100% rename from Modelo/.Migrations_old/ContextModelSnapshot.cs rename to Modelo/Migrations/ContextModelSnapshot.cs diff --git a/Modelo/RepositorioFactura.cs b/Modelo/RepositorioFactura.cs index 084c41b..14725b7 100644 --- a/Modelo/RepositorioFactura.cs +++ b/Modelo/RepositorioFactura.cs @@ -15,17 +15,22 @@ namespace Modelo { return context.Facturas .AsNoTracking() + .Include(x=>x.Detalles) + .Include(x=>x.Cliente) .ToList(); } - public Factura ObtenerPorId(int Tid) - { - Factura fac = context.Facturas.First(x => x.Id == Tid); - return fac ?? new Factura(); - } - public override void Add(Factura t) { + t.Cliente = context.Clientes.FirstOrDefault(x => x.Cuit == t.Cliente.Cuit); + + foreach (var detalle in t.Detalles) + { + detalle.Producto = (detalle.Producto.EsPerecedero) ? + context.ProductoPercederos.FirstOrDefault(x => x.Id == detalle.Producto.Id) : + context.ProductoNoPercederos.FirstOrDefault(x => x.Id == detalle.Producto.Id) ; + } + context.Facturas.Add(t); } @@ -41,6 +46,13 @@ namespace Modelo context.Facturas.Update(t); } - + public Factura ObtenerPorId(Factura fac) + { + var factura = context.Facturas + .Include(x=>x.Detalles) + .ThenInclude(x=>x.Producto) + .FirstOrDefault(x => x.Id == fac.Id); + return factura; + } } } diff --git a/Modelo/RepositorioLote.cs b/Modelo/RepositorioLote.cs index 27c7e5a..dedb80a 100644 --- a/Modelo/RepositorioLote.cs +++ b/Modelo/RepositorioLote.cs @@ -53,37 +53,45 @@ namespace Modelo context.Lotes.Update(t); } - public bool DisminuirStock(DetalleFactura detalleFactura) + public bool DisminuirStock(Factura fac) { - var detalle = context.DetalleFacturas.First(x => x.Id == detalleFactura.Id); - bool ret = false; int cantidad = detalle.Cantidad; - while (cantidad > 0) + bool ret = false; + foreach (var detalle in fac.Detalles) { - var elementoAdisminuir = context.Lotes.Where(x => x.Habilitado == true) - .First(x => x.Producto.Id == detalle.Producto.Id); - - cantidad -= elementoAdisminuir.Cantidad; - - if (cantidad > 0) + int cantidad = detalle.Cantidad; + while (cantidad > 0) { - elementoAdisminuir.Cantidad = 0; - elementoAdisminuir.Habilitado = false; - } - else if (cantidad == 0) - { - elementoAdisminuir.Cantidad = 0; - elementoAdisminuir.Habilitado = false; - ret = true; - } - else - { - elementoAdisminuir.Cantidad = -cantidad; - ret = true; - } - context.Lotes.Update(elementoAdisminuir); + var elementoAdisminuir = context.Lotes.Where(x => x.Habilitado == true) + .FirstOrDefault(x => x.Producto.Id == detalle.Producto.Id); + if (elementoAdisminuir.Cantidad == 0) { + elementoAdisminuir.Habilitado = false; + context.SaveChanges(); + } + + cantidad -= elementoAdisminuir.Cantidad; + + if (cantidad > 0) + { + elementoAdisminuir.Cantidad = 0; + elementoAdisminuir.Habilitado = false; + } + else if (cantidad == 0) + { + elementoAdisminuir.Cantidad = 0; + elementoAdisminuir.Habilitado = false; + ret = true; + context.Lotes.Update(elementoAdisminuir); + } + else + { + elementoAdisminuir.Cantidad = -cantidad; + ret = true; + context.Lotes.Update(elementoAdisminuir); + } + } } - context.DetalleFacturas.Update(detalle); + //context.DetalleFacturas.Update(detalleFactura); return ret; } diff --git a/Vista/FrmFactura.cs b/Vista/FrmFactura.cs index b8b1144..4aa634c 100644 --- a/Vista/FrmFactura.cs +++ b/Vista/FrmFactura.cs @@ -30,37 +30,25 @@ namespace Vista dgvProductos.DataSource = null; dgvProductos.DataSource = ControladoraFacturas.Instance.ListarProductos(); - dgvDetalles.AutoGenerateColumns = false; + dgvClientes.DataSource = null; + dgvClientes.DataSource = ControladoraFacturas.Instance.ListarClientes(); - // Definir las columnas manualmente - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn + + foreach (DataGridViewColumn column in dgvDetalles.Columns) { - DataPropertyName = "Id", // Usa la propiedad NombreProducto - HeaderText = "Id", - Name = "Id" - }); - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn + column.Visible = column.Name == "Id" || column.Name == "Producto" || column.Name == "Cantidad" + || column.Name == "PrecioUnitario" || column.Name == "Subtotal"; + } + + foreach (DataGridViewColumn column in dgvClientes.Columns) { - DataPropertyName = "Producto", // Usa la propiedad NombreProducto - HeaderText = "Producto", - Name = "Producto" - }); - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn + column.Visible = column.Name == "Cuit" || column.Name == "NombreCompleto" || column.Name == "Correo"; + } + + foreach (DataGridViewColumn column in dgvProductos.Columns) { - DataPropertyName = "CantidadDeProductos", - HeaderText = "Cantidad", - Name = "CantidadDeProductos" - }); - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn - { - DataPropertyName = "PrecioUnitario", - HeaderText = "PrecioUnitario" - }); - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn - { - DataPropertyName = "Subtotal", - HeaderText = "Subtotal" - }); + column.Visible = column.Name == "Id" || column.Name == "Nombre" || column.Name == "Precio"; + } } @@ -100,7 +88,7 @@ namespace Vista string devolucion = ""; if (string.IsNullOrEmpty(numid.Text)) devolucion += "El ID no puede ser nulo o vacío\n"; - //if (cmbCliente.SelectedIndex == -1) devolucion += "Debe seleccionar un cliente\n"; + //if (dgvClientes.Enabled == true) devolucion += "Debe seleccionar un cliente\n"; if (devolucion == "") { @@ -120,8 +108,7 @@ namespace Vista { factura.Total = Convert.ToDouble(numtotal.Value); factura.Fecha = datepick.Value; - factura.Id = Convert.ToInt32(numid.Value); - + factura.Cliente = new Cliente { Cuit = (long)dgvClientes.SelectedRows[0].Cells["Cuit"].Value }; string mensaje = ControladoraFacturas.Instance.Añadir(factura); MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -131,7 +118,10 @@ namespace Vista private void btnAddDetalle_Click(object sender, EventArgs e) { - // Validar los datos antes de crear el detalle + + // No quiero que cambien de cliente una vez que ya empezaron a armar la factura + dgvClientes.Enabled = false; + if (ValidarDatosdetalle()) return; if (dgvProductos.SelectedRows.Count > 0) { @@ -147,9 +137,8 @@ namespace Vista factura.AñadirDetalle(new DetalleFactura { - Id = int.Parse(detalleid++.ToString()), + Cantidad = (int)numCantidad.Value, - IdFactura = factura.Id, Producto = ControladoraProductos.Instance.Listar().First(x => x.Id == producto.Id), }); ActualizarGrillaDetalles(); diff --git a/Vista/FrmFacturas.cs b/Vista/FrmFacturas.cs index b38a55a..a0c56ec 100644 --- a/Vista/FrmFacturas.cs +++ b/Vista/FrmFacturas.cs @@ -10,73 +10,48 @@ namespace Vista public FrmFacturas() { InitializeComponent(); - ConfigurarDataGridViewDetalle(); - ActualizarGrilla(); + + ActualizarGrillas(); } - private void ActualizarGrilla() + private void ActualizarGrillas() { dgvFacturas.DataSource = null; dgvFacturas.DataSource = ControladoraFacturas.Instance.Listar(); + + foreach (DataGridViewColumn column in dgvFacturas.Columns) + { + column.Visible = column.Name == "Total" || column.Name == "Fecha" + || column.Name == "NombreCliente" || column.Name == "Cuit"; + } + } private void BtnAdd_Click(object sender, EventArgs e) { var form = new FrmFactura(); form.ShowDialog(); - ActualizarGrilla(); + ActualizarGrillas(); } - private void ConfigurarDataGridViewDetalle() - { - dgvDetalles.AutoGenerateColumns = false; - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn - { - DataPropertyName = "Producto", - HeaderText = "Producto", - Name = "Producto" - }); - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn - { - DataPropertyName = "Cantidad", - HeaderText = "Cantidad", - Name = "Cantidad" - - }); - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn - { - DataPropertyName = "PrecioUnitario", - HeaderText = "PrecioUnitario", - Name = "PrecioUnitario" - }); - dgvDetalles.Columns.Add(new DataGridViewTextBoxColumn - { - DataPropertyName = "Subtotal", - HeaderText = "Subtotal", - Name = "Subtotal" - }); - } - private void ActualizarGrillaDetalles(ReadOnlyCollection detalles) + + private void ActualizarGrillaDetalles(Factura fac) { dgvDetalles.DataSource = null; - if (detalles.Any()) - { - var loteDatos = detalles.Select(detalle => new - { - Producto = detalle.Producto.Nombre, - Cantidad = detalle.Cantidad, - Subtotal = detalle.Subtotal, - PrecioUnitario = detalle.Producto.Precio, - }).ToList(); + dgvDetalles.DataSource = fac.Detalles; - dgvDetalles.DataSource = loteDatos; + foreach (DataGridViewColumn column in dgvDetalles.Columns) + { + column.Visible = column.Name == "Cantidad" || column.Name == "NombreProducto" + || column.Name == "PrecioUnitario" || column.Name == "Subtotal"; } + + } private void dgvFacturas_CellClick(object sender, DataGridViewCellEventArgs e) { - if (e.RowIndex >= 0) + if (dgvFacturas.SelectedRows.Count > 0 ) { - var selectedFactura = (Factura)dgvFacturas.Rows[e.RowIndex].DataBoundItem; - var detalles = ControladoraFacturas.Instance.ListarDetallesFactura(selectedFactura); - ActualizarGrillaDetalles(detalles); + var factura = ControladoraFacturas.Instance.ObtenerPorId((Factura)dgvFacturas.SelectedRows[0].DataBoundItem); + ActualizarGrillaDetalles(factura); } } diff --git a/Vista/FrmProductos.Designer.cs b/Vista/FrmProductos.Designer.cs index 110b02a..c3a8001 100644 --- a/Vista/FrmProductos.Designer.cs +++ b/Vista/FrmProductos.Designer.cs @@ -80,6 +80,7 @@ // numStock.Enabled = false; numStock.Location = new Point(317, 269); + numStock.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 }); numStock.Name = "numStock"; numStock.Size = new Size(120, 23); numStock.TabIndex = 13;