From b130f559338a646ee055399c28fc0b51cba26247 Mon Sep 17 00:00:00 2001 From: fede Date: Tue, 3 Sep 2024 23:47:16 -0300 Subject: [PATCH] a ver si no me olcideo de commitear otra vez --- Aspnet/AlquilaFacil.csproj | 1 + Aspnet/Controllers/HomeController.cs | 12 +- Aspnet/Controllers/InquilinoController.cs | 5 +- Aspnet/Models/ErrorViewModel.cs | 11 - Aspnet/Views/Home/Inquilino.cshtml | 34 +- Aspnet/Views/Home/InquilinoForm.cshtml | 36 ++ Aspnet/Views/Shared/Error.cshtml | 25 -- Aspnet/Views/_ViewImports.cshtml | 1 - Entidades/AlquilaFacilContext.cs | 478 ++++++++++++++++++++++ Entidades/Canon.cs | 21 + Entidades/Contrato.cs | 35 ++ Entidades/Defecto.cs | 19 + Entidades/Entidades.csproj | 8 + Entidades/Garante.cs | 31 ++ Entidades/Grupo.cs | 19 + Entidades/Inquilino.cs | 40 +- Entidades/Propiedad.cs | 25 ++ Entidades/Propietario.cs | 29 ++ Entidades/Recibo.cs | 15 + Entidades/Rol.cs | 13 + Entidades/Servicio.cs | 11 + Entidades/ServicioPropiedade.cs | 15 + Modelo/Class1.cs | 6 - Modelo/RepositorioBase.cs | 36 ++ makefile | 2 + 25 files changed, 820 insertions(+), 108 deletions(-) delete mode 100644 Aspnet/Models/ErrorViewModel.cs create mode 100644 Aspnet/Views/Home/InquilinoForm.cshtml delete mode 100644 Aspnet/Views/Shared/Error.cshtml create mode 100644 Entidades/AlquilaFacilContext.cs create mode 100644 Entidades/Canon.cs create mode 100644 Entidades/Contrato.cs create mode 100644 Entidades/Defecto.cs create mode 100644 Entidades/Garante.cs create mode 100644 Entidades/Grupo.cs create mode 100644 Entidades/Propiedad.cs create mode 100644 Entidades/Propietario.cs create mode 100644 Entidades/Recibo.cs create mode 100644 Entidades/Rol.cs create mode 100644 Entidades/Servicio.cs create mode 100644 Entidades/ServicioPropiedade.cs delete mode 100644 Modelo/Class1.cs create mode 100644 Modelo/RepositorioBase.cs create mode 100644 makefile diff --git a/Aspnet/AlquilaFacil.csproj b/Aspnet/AlquilaFacil.csproj index 00745b4..074d644 100644 --- a/Aspnet/AlquilaFacil.csproj +++ b/Aspnet/AlquilaFacil.csproj @@ -12,6 +12,7 @@ + diff --git a/Aspnet/Controllers/HomeController.cs b/Aspnet/Controllers/HomeController.cs index fef41ab..f920a09 100644 --- a/Aspnet/Controllers/HomeController.cs +++ b/Aspnet/Controllers/HomeController.cs @@ -1,6 +1,5 @@ using System.Diagnostics; using Microsoft.AspNetCore.Mvc; -using Modelo; namespace AlquilaFacil.Controllers; @@ -21,17 +20,16 @@ public class HomeController : Controller public IActionResult Inquilino(){ return View(); } + + public IActionResult Privacy() { return View(); } - [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] - public IActionResult Error() + public IActionResult InquilinoForm(long? id = 0) { - return View( - //new ErrorViewModel { RequestId = Activity.Class1 }; - new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier } - ); + return View(); } + } diff --git a/Aspnet/Controllers/InquilinoController.cs b/Aspnet/Controllers/InquilinoController.cs index 97b2108..00b4814 100644 --- a/Aspnet/Controllers/InquilinoController.cs +++ b/Aspnet/Controllers/InquilinoController.cs @@ -26,9 +26,10 @@ public class InquilinoController: ControllerBase [HttpPost] public IActionResult Post([FromForm] Inquilino inq){ if (inq == null) return BadRequest("Inquilino inválido."); - if (inq.Dni == "0" || inq.Dni == null) return BadRequest("No se especifico dni"); + if (inq.Dni == 0 ) return BadRequest("No se especifico dni"); + if (inq.Dni < 0 ) return BadRequest("Dni Invalido"); + - inquilinos.Add(inq); return Content($"

Inquilino {inq.Nombre} agregado exitosamente.

", "text/html"); } diff --git a/Aspnet/Models/ErrorViewModel.cs b/Aspnet/Models/ErrorViewModel.cs deleted file mode 100644 index f282415..0000000 --- a/Aspnet/Models/ErrorViewModel.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace Modelo -{ - public class ErrorViewModel - { - public string? RequestId { get; set; } - - public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); - } - -} diff --git a/Aspnet/Views/Home/Inquilino.cshtml b/Aspnet/Views/Home/Inquilino.cshtml index 4b120be..f7cb8a8 100644 --- a/Aspnet/Views/Home/Inquilino.cshtml +++ b/Aspnet/Views/Home/Inquilino.cshtml @@ -20,37 +20,7 @@ -

Dar de alta

-
- - -
- - - -
+ - - -
+
- - -
- - - -
- - - -
- - - - -
- - - \ No newline at end of file diff --git a/Aspnet/Views/Home/InquilinoForm.cshtml b/Aspnet/Views/Home/InquilinoForm.cshtml new file mode 100644 index 0000000..16816be --- /dev/null +++ b/Aspnet/Views/Home/InquilinoForm.cshtml @@ -0,0 +1,36 @@ +
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
\ No newline at end of file diff --git a/Aspnet/Views/Shared/Error.cshtml b/Aspnet/Views/Shared/Error.cshtml deleted file mode 100644 index 41a6939..0000000 --- a/Aspnet/Views/Shared/Error.cshtml +++ /dev/null @@ -1,25 +0,0 @@ -@model Modelo.ErrorViewModel -@{ - ViewData["Title"] = "Error"; -} - -

Error.

-

An error occurred while processing your request.

- -@if (Model.ShowRequestId) -{ -

- Request ID: @Model.RequestId -

-} - -

Development Mode

-

- Swapping to Development environment will display more detailed information about the error that occurred. -

-

- The Development environment shouldn't be enabled for deployed applications. - It can result in displaying sensitive information from exceptions to end users. - For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development - and restarting the app. -

diff --git a/Aspnet/Views/_ViewImports.cshtml b/Aspnet/Views/_ViewImports.cshtml index e90891a..4327995 100644 --- a/Aspnet/Views/_ViewImports.cshtml +++ b/Aspnet/Views/_ViewImports.cshtml @@ -1,3 +1,2 @@ @using AlquilaFacil -@using Modelo @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/Entidades/AlquilaFacilContext.cs b/Entidades/AlquilaFacilContext.cs new file mode 100644 index 0000000..b175efd --- /dev/null +++ b/Entidades/AlquilaFacilContext.cs @@ -0,0 +1,478 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore; + +namespace Entidades; + +public partial class AlquilaFacilContext : DbContext +{ + public AlquilaFacilContext() + { + } + + public AlquilaFacilContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Canons { get; set; } + + public virtual DbSet Contratos { get; set; } + + public virtual DbSet Defectos { get; set; } + + public virtual DbSet Garantia { get; set; } + + public virtual DbSet Grupos { get; set; } + + public virtual DbSet Inquilinos { get; set; } + + public virtual DbSet Propiedades { get; set; } + + public virtual DbSet Propietarios { get; set; } + + public virtual DbSet Recibos { get; set; } + + public virtual DbSet Rols { get; set; } + + public virtual DbSet Servicios { get; set; } + + public virtual DbSet ServicioPropiedades { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +//#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. + => optionsBuilder.UseSqlServer("Server=fedesrv.ddns.net,1433;Database=AlquilaFacil;User Id=AlquilaFacil;Password=.n@9c2ve*0,b1ETv].Kipa/~pR~V;Trusted_Connection=False;Encrypt=False;Connection Timeout=5;\n"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__CANON__3214EC27DAD9CBBD"); + + entity.ToTable("CANON"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Idrecibo).HasColumnName("IDRECIBO"); + entity.Property(e => e.Mes).HasColumnName("MES"); + entity.Property(e => e.Monto) + .HasColumnType("decimal(12, 2)") + .HasColumnName("MONTO"); + entity.Property(e => e.Pagado).HasColumnName("PAGADO"); + + entity.HasOne(d => d.IdreciboNavigation).WithMany(p => p.Canons) + .HasForeignKey(d => d.Idrecibo) + .HasConstraintName("FK__CANON__IDRECIBO__540C7B00"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__CONTRATO__3214EC27314E1A88"); + + entity.ToTable("CONTRATO"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Dniinquilino).HasColumnName("DNIINQUILINO"); + entity.Property(e => e.Dnipropietario).HasColumnName("DNIPROPIETARIO"); + entity.Property(e => e.Duracionmeses).HasColumnName("DURACIONMESES"); + entity.Property(e => e.Fechainicio) + .HasColumnType("datetime") + .HasColumnName("FECHAINICIO"); + entity.Property(e => e.Idpropiedad).HasColumnName("IDPROPIEDAD"); + entity.Property(e => e.Indiceactualizacion) + .HasColumnType("decimal(12, 2)") + .HasColumnName("INDICEACTUALIZACION"); + entity.Property(e => e.Monto) + .HasColumnType("decimal(12, 2)") + .HasColumnName("MONTO"); + + entity.HasOne(d => d.DniinquilinoNavigation).WithMany(p => p.Contratos) + .HasForeignKey(d => d.Dniinquilino) + .HasConstraintName("FK__CONTRATO__DNIINQ__01142BA1"); + + entity.HasOne(d => d.DnipropietarioNavigation).WithMany(p => p.Contratos) + .HasForeignKey(d => d.Dnipropietario) + .HasConstraintName("FK__CONTRATO__DNIPRO__02084FDA"); + + entity.HasOne(d => d.IdpropiedadNavigation).WithMany(p => p.Contratos) + .HasForeignKey(d => d.Idpropiedad) + .HasConstraintName("FK__CONTRATO__IDPROP__02FC7413"); + + entity.HasMany(d => d.Dnigarantia).WithMany(p => p.Idcontratos) + .UsingEntity>( + "ContratoGarantium", + r => r.HasOne().WithMany() + .HasForeignKey("Dnigarantia") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__CONTRATO___DNIGA__282DF8C2"), + l => l.HasOne().WithMany() + .HasForeignKey("Idcontrato") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__CONTRATO___IDCON__2739D489"), + j => + { + j.HasKey("Idcontrato", "Dnigarantia").HasName("PK__CONTRATO__08D9A618A2AF4EE5"); + j.ToTable("CONTRATO_GARANTIA"); + j.IndexerProperty("Idcontrato").HasColumnName("IDCONTRATO"); + j.IndexerProperty("Dnigarantia").HasColumnName("DNIGARANTIA"); + }); + + entity.HasMany(d => d.Idcanons).WithMany(p => p.Idcontratos) + .UsingEntity>( + "ContratoCanon", + r => r.HasOne().WithMany() + .HasForeignKey("Idcanon") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__CONTRATO___IDCAN__3493CFA7"), + l => l.HasOne().WithMany() + .HasForeignKey("Idcontrato") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__CONTRATO___IDCON__339FAB6E"), + j => + { + j.HasKey("Idcontrato", "Idcanon").HasName("PK__CONTRATO__EAB1D189E5C1886B"); + j.ToTable("CONTRATO_CANON"); + j.IndexerProperty("Idcontrato").HasColumnName("IDCONTRATO"); + j.IndexerProperty("Idcanon").HasColumnName("IDCANON"); + }); + + entity.HasMany(d => d.Iddefectos).WithMany(p => p.Idcontratos) + .UsingEntity>( + "ContratoDefecto", + r => r.HasOne().WithMany() + .HasForeignKey("Iddefecto") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__CONTRATO___IDDEF__2BFE89A6"), + l => l.HasOne().WithMany() + .HasForeignKey("Idcontrato") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__CONTRATO___IDCON__2B0A656D"), + j => + { + j.HasKey("Idcontrato", "Iddefecto").HasName("PK__CONTRATO__3A449B2F445D3682"); + j.ToTable("CONTRATO_DEFECTO"); + j.IndexerProperty("Idcontrato").HasColumnName("IDCONTRATO"); + j.IndexerProperty("Iddefecto").HasColumnName("IDDEFECTO"); + }); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__DEFECTO__3214EC27E043B726"); + + entity.ToTable("DEFECTO"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Costo) + .HasColumnType("decimal(12, 2)") + .HasColumnName("COSTO"); + entity.Property(e => e.Descripcion) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("DESCRIPCION"); + entity.Property(e => e.Estaarreglado).HasColumnName("ESTAARREGLADO"); + entity.Property(e => e.Pagainquilino).HasColumnName("PAGAINQUILINO"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Dni).HasName("PK__GARANTIA__C035B8DC8E6BAB11"); + + entity.ToTable("GARANTIA"); + + entity.HasIndex(e => e.Email, "UQ__GARANTIA__161CF724C0013CA1").IsUnique(); + + entity.HasIndex(e => e.Celular, "UQ__GARANTIA__6758673E51796017").IsUnique(); + + entity.HasIndex(e => e.Cuil, "UQ__GARANTIA__F46C15900DA7BBE1").IsUnique(); + + entity.Property(e => e.Dni).HasColumnName("DNI"); + entity.Property(e => e.Apellido) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("APELLIDO"); + entity.Property(e => e.Celular) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("CELULAR"); + entity.Property(e => e.Contrasena) + .HasMaxLength(64) + .HasColumnName("CONTRASENA"); + entity.Property(e => e.Cuil).HasColumnName("CUIL"); + entity.Property(e => e.Domicilio) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("DOMICILIO"); + entity.Property(e => e.Domiciliolaboral) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("DOMICILIOLABORAL"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("EMAIL"); + entity.Property(e => e.Lugartrabajo) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("LUGARTRABAJO"); + entity.Property(e => e.Nombre) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("NOMBRE"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__GRUPO__3214EC2778FB625D"); + + entity.ToTable("GRUPO"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Nombre) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("NOMBRE"); + + entity.HasMany(d => d.Dnigarantia).WithMany(p => p.Idgrupos) + .UsingEntity>( + "GrupoGarantium", + r => r.HasOne().WithMany() + .HasForeignKey("Dnigarantia") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_GAR__DNIGA__46B27FE2"), + l => l.HasOne().WithMany() + .HasForeignKey("Idgrupo") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_GAR__IDGRU__45BE5BA9"), + j => + { + j.HasKey("Idgrupo", "Dnigarantia").HasName("PK__GRUPO_GA__F9F1F0A3A5F02DDF"); + j.ToTable("GRUPO_GARANTIA"); + j.IndexerProperty("Idgrupo").HasColumnName("IDGRUPO"); + j.IndexerProperty("Dnigarantia").HasColumnName("DNIGARANTIA"); + }); + + entity.HasMany(d => d.Dniinquilinos).WithMany(p => p.Idgrupos) + .UsingEntity>( + "GrupoInquilino", + r => r.HasOne().WithMany() + .HasForeignKey("Dniinquilino") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_INQ__DNIIN__40058253"), + l => l.HasOne().WithMany() + .HasForeignKey("Idgrupo") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_INQ__IDGRU__3F115E1A"), + j => + { + j.HasKey("Idgrupo", "Dniinquilino").HasName("PK__GRUPO_IN__FC8CB8C5DC668E46"); + j.ToTable("GRUPO_INQUILINO"); + j.IndexerProperty("Idgrupo").HasColumnName("IDGRUPO"); + j.IndexerProperty("Dniinquilino").HasColumnName("DNIINQUILINO"); + }); + + entity.HasMany(d => d.Dnipropietarios).WithMany(p => p.Idgrupos) + .UsingEntity>( + "GrupoPropietario", + r => r.HasOne().WithMany() + .HasForeignKey("Dnipropietario") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_PRO__DNIPR__4A8310C6"), + l => l.HasOne().WithMany() + .HasForeignKey("Idgrupo") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_PRO__IDGRU__498EEC8D"), + j => + { + j.HasKey("Idgrupo", "Dnipropietario").HasName("PK__GRUPO_PR__D5806AB6196637D1"); + j.ToTable("GRUPO_PROPIETARIO"); + j.IndexerProperty("Idgrupo").HasColumnName("IDGRUPO"); + j.IndexerProperty("Dnipropietario").HasColumnName("DNIPROPIETARIO"); + }); + + entity.HasMany(d => d.Idrols).WithMany(p => p.Idgrupos) + .UsingEntity>( + "GrupoRol", + r => r.HasOne().WithMany() + .HasForeignKey("Idrol") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_ROL__IDROL__3C34F16F"), + l => l.HasOne().WithMany() + .HasForeignKey("Idgrupo") + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("FK__GRUPO_ROL__IDGRU__3B40CD36"), + j => + { + j.HasKey("Idgrupo", "Idrol").HasName("PK__GRUPO_RO__5035D4A88EFB1AF1"); + j.ToTable("GRUPO_ROL"); + j.IndexerProperty("Idgrupo").HasColumnName("IDGRUPO"); + j.IndexerProperty("Idrol").HasColumnName("IDROL"); + }); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Dni).HasName("PK__INQUILIN__C035B8DC051D254F"); + + entity.ToTable("INQUILINO"); + + entity.HasIndex(e => e.Email, "UQ__INQUILIN__161CF724192A8FBF").IsUnique(); + + entity.HasIndex(e => e.Celular, "UQ__INQUILIN__6758673EB3CC90D6").IsUnique(); + + entity.HasIndex(e => e.Cuil, "UQ__INQUILIN__F46C1590EF9A325E").IsUnique(); + + entity.Property(e => e.Dni).HasColumnName("DNI"); + entity.Property(e => e.Apellido) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("APELLIDO"); + entity.Property(e => e.Celular) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("CELULAR"); + entity.Property(e => e.Contrasena) + .HasMaxLength(64) + .HasColumnName("CONTRASENA"); + entity.Property(e => e.Cuil).HasColumnName("CUIL"); + entity.Property(e => e.Domicilio) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("DOMICILIO"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("EMAIL"); + entity.Property(e => e.Nombre) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("NOMBRE"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__PROPIEDA__3214EC2739D8661A"); + + entity.ToTable("PROPIEDADES"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Canthabitaciones).HasColumnName("CANTHABITACIONES"); + entity.Property(e => e.Dni).HasColumnName("DNI"); + entity.Property(e => e.Letra) + .HasMaxLength(2) + .IsUnicode(false) + .HasColumnName("LETRA"); + entity.Property(e => e.Piso).HasColumnName("PISO"); + entity.Property(e => e.Tienecocina).HasColumnName("TIENECOCINA"); + entity.Property(e => e.Ubicacion) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("UBICACION"); + + entity.HasOne(d => d.DniNavigation).WithMany(p => p.Propiedades) + .HasForeignKey(d => d.Dni) + .HasConstraintName("FK__PROPIEDADES__DNI__44FF419A"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Dni).HasName("PK__PROPIETA__C035B8DC136518F4"); + + entity.ToTable("PROPIETARIO"); + + entity.HasIndex(e => e.Email, "UQ__PROPIETA__161CF7246E3AA1B6").IsUnique(); + + entity.HasIndex(e => e.Celular, "UQ__PROPIETA__6758673E211BCB21").IsUnique(); + + entity.HasIndex(e => e.Cuil, "UQ__PROPIETA__F46C15901A8D2463").IsUnique(); + + entity.Property(e => e.Dni).HasColumnName("DNI"); + entity.Property(e => e.Apellido) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("APELLIDO"); + entity.Property(e => e.Celular) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("CELULAR"); + entity.Property(e => e.Contrasena) + .HasMaxLength(64) + .HasColumnName("CONTRASENA"); + entity.Property(e => e.Cuil).HasColumnName("CUIL"); + entity.Property(e => e.Domicilio) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("DOMICILIO"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("EMAIL"); + entity.Property(e => e.Nombre) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("NOMBRE"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__RECIBO__3214EC277135BC90"); + + entity.ToTable("RECIBO"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Mes).HasColumnName("MES"); + entity.Property(e => e.Monto) + .HasColumnType("decimal(12, 2)") + .HasColumnName("MONTO"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__ROL__3214EC27DE6A34BE"); + + entity.ToTable("ROL"); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Descipcion) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("DESCIPCION"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__SERVICIO__3214EC27468ADAA2"); + + entity.ToTable("SERVICIO"); + + entity.HasIndex(e => e.Descripcion, "UQ__SERVICIO__794449EF1A4F44FF").IsUnique(); + + entity.Property(e => e.Id).HasColumnName("ID"); + entity.Property(e => e.Descripcion) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("DESCRIPCION"); + }); + + modelBuilder.Entity(entity => + { + entity + .HasNoKey() + .ToTable("SERVICIO_PROPIEDADES"); + + entity.Property(e => e.Idpropiedad).HasColumnName("IDPROPIEDAD"); + entity.Property(e => e.Idservicio).HasColumnName("IDSERVICIO"); + + entity.HasOne(d => d.IdpropiedadNavigation).WithMany() + .HasForeignKey(d => d.Idpropiedad) + .HasConstraintName("FK__SERVICIO___IDPRO__49C3F6B7"); + + entity.HasOne(d => d.IdservicioNavigation).WithMany() + .HasForeignKey(d => d.Idservicio) + .HasConstraintName("FK__SERVICIO___IDSER__4AB81AF0"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/Entidades/Canon.cs b/Entidades/Canon.cs new file mode 100644 index 0000000..05fd492 --- /dev/null +++ b/Entidades/Canon.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Canon +{ + public int Id { get; set; } + + public int Mes { get; set; } + + public decimal Monto { get; set; } + + public bool Pagado { get; set; } + + public int? Idrecibo { get; set; } + + public virtual Recibo? IdreciboNavigation { get; set; } + + public virtual ICollection Idcontratos { get; set; } = new List(); +} diff --git a/Entidades/Contrato.cs b/Entidades/Contrato.cs new file mode 100644 index 0000000..ae3d5af --- /dev/null +++ b/Entidades/Contrato.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Contrato +{ + public int Id { get; set; } + + public DateTime Fechainicio { get; set; } + + public decimal Indiceactualizacion { get; set; } + + public decimal Monto { get; set; } + + public int Duracionmeses { get; set; } + + public long? Dniinquilino { get; set; } + + public long? Dnipropietario { get; set; } + + public int? Idpropiedad { get; set; } + + public virtual Inquilino? DniinquilinoNavigation { get; set; } + + public virtual Propietario? DnipropietarioNavigation { get; set; } + + public virtual Propiedad? IdpropiedadNavigation { get; set; } + + public virtual ICollection Dnigarantia { get; set; } = new List(); + + public virtual ICollection Idcanons { get; set; } = new List(); + + public virtual ICollection Iddefectos { get; set; } = new List(); +} diff --git a/Entidades/Defecto.cs b/Entidades/Defecto.cs new file mode 100644 index 0000000..046c012 --- /dev/null +++ b/Entidades/Defecto.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Defecto +{ + public int Id { get; set; } + + public string Descripcion { get; set; } = null!; + + public bool Estaarreglado { get; set; } + + public decimal Costo { get; set; } + + public bool Pagainquilino { get; set; } + + public virtual ICollection Idcontratos { get; set; } = new List(); +} diff --git a/Entidades/Entidades.csproj b/Entidades/Entidades.csproj index fa71b7a..e7cfbc5 100644 --- a/Entidades/Entidades.csproj +++ b/Entidades/Entidades.csproj @@ -6,4 +6,12 @@ enable + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/Entidades/Garante.cs b/Entidades/Garante.cs new file mode 100644 index 0000000..b03b572 --- /dev/null +++ b/Entidades/Garante.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Garante +{ + public long Dni { get; set; } + + public long Cuil { get; set; } + + public string Nombre { get; set; } = null!; + + public string Apellido { get; set; } = null!; + + public string Email { get; set; } = null!; + + public string Celular { get; set; } = null!; + + public string Domicilio { get; set; } = null!; + + public string Lugartrabajo { get; set; } = null!; + + public string Domiciliolaboral { get; set; } = null!; + + public byte[]? Contrasena { get; set; } + + public virtual ICollection Idcontratos { get; set; } = new List(); + + public virtual ICollection Idgrupos { get; set; } = new List(); +} diff --git a/Entidades/Grupo.cs b/Entidades/Grupo.cs new file mode 100644 index 0000000..4827d1f --- /dev/null +++ b/Entidades/Grupo.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Grupo +{ + public int Id { get; set; } + + public string Nombre { get; set; } = null!; + + public virtual ICollection Dnigarantia { get; set; } = new List(); + + public virtual ICollection Dniinquilinos { get; set; } = new List(); + + public virtual ICollection Dnipropietarios { get; set; } = new List(); + + public virtual ICollection Idrols { get; set; } = new List(); +} diff --git a/Entidades/Inquilino.cs b/Entidades/Inquilino.cs index 31223be..f16bda7 100644 --- a/Entidades/Inquilino.cs +++ b/Entidades/Inquilino.cs @@ -1,35 +1,27 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.Collections.Generic; -namespace Entidades{ +namespace Entidades; -public class Inquilino +public partial class Inquilino { - public string Dni{ get; set; } + public long Dni { get; set; } - public string Cuil{get; set;} + public long Cuil { get; set; } - public string Nombre{get; set;} + public string Nombre { get; set; } = null!; - public string Apellido {get; set;} + public string Apellido { get; set; } = null!; - public string Email { - get - { - return _email; - } - set - { - if (value.Contains("@")) - { + public string Email { get; set; } = null!; - _email =value; - } - } - } + public string Celular { get; set; } = null!; - public Int64 Celular{get; set;} + public string Domicilio { get; set; } = null!; - public string Domicilio {get; set;} - private string _email; -} + public byte[]? Contrasena { get; set; } + + public virtual ICollection Contratos { get; set; } = new List(); + + public virtual ICollection Idgrupos { get; set; } = new List(); } diff --git a/Entidades/Propiedad.cs b/Entidades/Propiedad.cs new file mode 100644 index 0000000..7de230a --- /dev/null +++ b/Entidades/Propiedad.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Propiedad +{ + public int Id { get; set; } + + public long? Dni { get; set; } + + public string Ubicacion { get; set; } = null!; + + public int? Canthabitaciones { get; set; } + + public bool? Tienecocina { get; set; } + + public int? Piso { get; set; } + + public string? Letra { get; set; } + + public virtual ICollection Contratos { get; set; } = new List(); + + public virtual Propietario? DniNavigation { get; set; } +} diff --git a/Entidades/Propietario.cs b/Entidades/Propietario.cs new file mode 100644 index 0000000..e21c7c7 --- /dev/null +++ b/Entidades/Propietario.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Propietario +{ + public long Dni { get; set; } + + public long Cuil { get; set; } + + public string Nombre { get; set; } = null!; + + public string Apellido { get; set; } = null!; + + public string Email { get; set; } = null!; + + public string Celular { get; set; } = null!; + + public string Domicilio { get; set; } = null!; + + public byte[]? Contrasena { get; set; } + + public virtual ICollection Contratos { get; set; } = new List(); + + public virtual ICollection Propiedades { get; set; } = new List(); + + public virtual ICollection Idgrupos { get; set; } = new List(); +} diff --git a/Entidades/Recibo.cs b/Entidades/Recibo.cs new file mode 100644 index 0000000..5260632 --- /dev/null +++ b/Entidades/Recibo.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Recibo +{ + public int Id { get; set; } + + public int Mes { get; set; } + + public decimal Monto { get; set; } + + public virtual ICollection Canons { get; set; } = new List(); +} diff --git a/Entidades/Rol.cs b/Entidades/Rol.cs new file mode 100644 index 0000000..9f474a1 --- /dev/null +++ b/Entidades/Rol.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Rol +{ + public int Id { get; set; } + + public string Descipcion { get; set; } = null!; + + public virtual ICollection Idgrupos { get; set; } = new List(); +} diff --git a/Entidades/Servicio.cs b/Entidades/Servicio.cs new file mode 100644 index 0000000..3e5bd86 --- /dev/null +++ b/Entidades/Servicio.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class Servicio +{ + public int Id { get; set; } + + public string Descripcion { get; set; } = null!; +} diff --git a/Entidades/ServicioPropiedade.cs b/Entidades/ServicioPropiedade.cs new file mode 100644 index 0000000..307339b --- /dev/null +++ b/Entidades/ServicioPropiedade.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Entidades; + +public partial class ServicioPropiedade +{ + public int? Idpropiedad { get; set; } + + public int? Idservicio { get; set; } + + public virtual Propiedad? IdpropiedadNavigation { get; set; } + + public virtual Servicio? IdservicioNavigation { get; set; } +} diff --git a/Modelo/Class1.cs b/Modelo/Class1.cs deleted file mode 100644 index 2b26e0e..0000000 --- a/Modelo/Class1.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Modelo; - -public class Class1 -{ - -} diff --git a/Modelo/RepositorioBase.cs b/Modelo/RepositorioBase.cs new file mode 100644 index 0000000..78e51c8 --- /dev/null +++ b/Modelo/RepositorioBase.cs @@ -0,0 +1,36 @@ +using Entidades; +using Microsoft.EntityFrameworkCore; + +namespace Modelo; + +public abstract class RepositorioBase where T : class, new() +{ + private AlquilaFacilContext Context { get; set; } = new AlquilaFacilContext(); + + public void Add(T t){ + Context.Add(t); + } + public void Mod(T t){ + Context.Update(t); + } + public void Del(T t){ + + Context.Remove(t); + } + + public bool Guardar(){ + bool ret = false; + try + { + Context.SaveChanges(); + Context.Dispose(); + Context = new AlquilaFacilContext(); + ret = true; + } catch (DbUpdateException ex) + { + Console.Error.WriteLine(ex.Message); + } + return ret; + } + +} diff --git a/makefile b/makefile new file mode 100644 index 0000000..fda237e --- /dev/null +++ b/makefile @@ -0,0 +1,2 @@ +run: + dotnet run --project Aspnet/AlquilaFacil.csproj