From ccb6128c7297d6c01731ee872e3a440b3a722083 Mon Sep 17 00:00:00 2001 From: Maier Stephan SI Date: Thu, 28 Sep 2023 15:17:59 +0200 Subject: [PATCH] Sicherung --- .../Controllers/OrganizationController.cs | 18 +- .../Controllers/PlantController.cs | 83 ++++ .../Controllers/ProjectController.cs | 258 ++++++------- .../20230919061443_addedInitDbSet.Designer.cs | 355 ------------------ .../20230920052441_addedOrganizationDbSet.cs | 48 --- ....cs => 20230928130340_Initial.Designer.cs} | 41 +- ...InitDbSet.cs => 20230928130340_Initial.cs} | 58 ++- .../ApplicationDbContextModelSnapshot.cs | 37 +- FSI.Prj.Mgt/FSI.Prj.Mgt/Helper.cs | 31 ++ .../FSI.Prj.Mgt/Models/Organization.cs | 37 +- FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Plant.cs | 15 +- FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs | 36 +- .../Views/Organization/AddOrEdit.cshtml | 54 +++ .../Views/Organization/Index.cshtml | 49 ++- .../Views/Organization/_ViewAll.cshtml | 89 +++++ .../FSI.Prj.Mgt/Views/Plant/AddOrEdit.cshtml | 46 +++ .../FSI.Prj.Mgt/Views/Plant/Index.cshtml | 25 ++ .../FSI.Prj.Mgt/Views/Plant/_ViewAll.cshtml | 83 ++++ .../Views/Project/AddOrEdit.cshtml | 54 +++ .../Views/Project/CreateEdit.cshtml | 65 ---- .../FSI.Prj.Mgt/Views/Project/Index.cshtml | 76 +--- .../FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml | 89 +++++ .../FSI.Prj.Mgt/Views/Shared/_Layout.cshtml | 17 + FSI.Prj.Mgt/FSI.Prj.Mgt/wwwroot/js/site.js | 42 +++ 24 files changed, 978 insertions(+), 728 deletions(-) create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/PlantController.cs delete mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230919061443_addedInitDbSet.Designer.cs delete mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230920052441_addedOrganizationDbSet.cs rename FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/{20230920052441_addedOrganizationDbSet.Designer.cs => 20230928130340_Initial.Designer.cs} (93%) rename FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/{20230919061443_addedInitDbSet.cs => 20230928130340_Initial.cs} (53%) create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Helper.cs create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/AddOrEdit.cshtml create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/Index.cshtml create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/_ViewAll.cshtml create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml delete mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/CreateEdit.cshtml create mode 100644 FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs index ba4b20d..4db5861 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/OrganizationController.cs @@ -17,9 +17,22 @@ namespace FSI.Prj.Mgt.Controllers _context = context; } - public IActionResult Index() + public async Task Index(string searchString, int? page) { + IQueryable items = _context.Organizations.Include(x => x.Parent); + + + if (!string.IsNullOrEmpty(searchString)) + { + items = items.Where(x => x.Name!.Contains(searchString) || x.Description!.Contains(searchString)); + } + + return View(await items.ToPagedListAsync(page ?? 1, 10)); + + + + List nodes = new(); // Loop and add the Parent Nodes @@ -45,8 +58,7 @@ namespace FSI.Prj.Mgt.Controllers } } ViewBag.Json = JsonConvert.SerializeObject(nodes); - - return View(); + } [HttpPost] diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/PlantController.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/PlantController.cs new file mode 100644 index 0000000..63956d2 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/PlantController.cs @@ -0,0 +1,83 @@ +using FSI.Prj.Mgt.Data; +using FSI.Prj.Mgt.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using X.PagedList; + +namespace FSI.Prj.Mgt.Controllers +{ + public class PlantController : Controller + { + private readonly ApplicationDbContext _context; + + public PlantController(ApplicationDbContext context) + { + _context = context; + } + + public async Task Index(string searchString, int? page) + { + IQueryable items = _context.Plants; + + if (!string.IsNullOrEmpty(searchString)) + { + items = items.Where(x => x.Name!.ToString().Contains(searchString)); + } + + return View(await items.ToPagedListAsync(page ?? 1, 10)); + } + + public async Task AddOrEdit(int id = 0) + { + if (id == 0) + { + return View(new Plant()); + } + else + { + var item = await _context.Plants.FindAsync(id); + + if (item == null) + { + return NotFound(); + } + return View(item); + } + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task AddOrEdit(int id, Plant item) + { + if (ModelState.IsValid) + { + + if (id == 0) // Insert + { + _context.Add(item); + await _context.SaveChangesAsync(); + } + else // Update + { + try + { + _context.Update(item); + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + + } + } + + return Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_ViewAll", await ((IQueryable)_context.Plants).ToPagedListAsync(1, 10)) }); + } + else + { + var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception)); + } + return Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "AddOrEdit", item) }); + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs index e0d4f75..769cac7 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/ProjectController.cs @@ -2,6 +2,8 @@ using FSI.Prj.Mgt.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Migrations; +using System.ComponentModel.DataAnnotations; using X.PagedList; namespace FSI.Prj.Mgt.Controllers @@ -17,95 +19,135 @@ namespace FSI.Prj.Mgt.Controllers public async Task Index(string searchString, int? page) { + IQueryable items = _context.Projects.Include(x => x.Plant); - IQueryable projects = _context.Projects.Include(x => x.Plant); - - + if (!string.IsNullOrEmpty(searchString)) { - projects = projects.Where(x => x.No!.ToString().Contains(searchString) || x.Name!.Contains(searchString) || x.Description!.Contains(searchString)); - + items = items.Where(x => x.No!.ToString().Contains(searchString) || x.Name!.Contains(searchString) || x.Description!.Contains(searchString)); } - return View(await projects.ToPagedListAsync(page ?? 1, 10)); + return View(await items.ToPagedListAsync(page ?? 1, 10)); } - public IActionResult CreateEdit(int id) + public async Task AddOrEdit(int id = 0) { - ViewBag.Plants = _context.Plants; + + // ViewBag.Plants = _context.Plants; if (id == 0) { - return View(); + var item = new Project(); + item.Plants = _context.Plants.ToList(); + + return View(item); } + else + { + var item = await _context.Projects.FindAsync(id); + - var project = _context.Projects.Find(id); + if (item == null) + { + return NotFound(); + } - if (project == null) + item.Plants = _context.Plants.ToList(); + return View(item); + } + } + + [HttpPost] + //[ValidateAntiForgeryToken] + public async Task AddOrEdit(int id, Project item) + { + ModelState.Remove("Plants"); + ModelState.Remove("Plant"); + + if (ModelState.IsValid) + { + + if (id == 0) // Insert + { + _context.Add(item); + await _context.SaveChangesAsync(); + } + else // Update + { + try + { + _context.Update(item); + await _context.SaveChangesAsync(); + } + catch(DbUpdateConcurrencyException) + { + + } + } + return Json(new { isValid = true, html = Helper.RenderRazorViewToString(this, "_ViewAll", _context.Projects.ToList()) }); + } + else + { + var errors = ModelState.SelectMany(x => x.Value.Errors.Select(z => z.Exception)); + } + return Json(new { isValid = false, html = Helper.RenderRazorViewToString(this, "AddOrEdit", item) }); + } + + //if (ModelState.IsValid) + //{ + // if (project.Id == 0) + // { + // var highestPrjNo = 0; + // int prjYear = 0; + // int prjNo = 0; + + // if (_context.Projects.Count() > 0) + // { + // highestPrjNo = _context.Projects.Max(x => x.No); + // prjYear = highestPrjNo; + + // // Projekt Jahr freistellen + // while (prjYear >= 100) + // prjYear /= 10; + + // // Laufende Nr. des Jahres freistellen + // prjNo = highestPrjNo >= 1000 ? highestPrjNo % 1000 : highestPrjNo; + // } + + // // Neue Projekt Nummer berechnen + // if (prjYear == int.Parse(DateTime.Now.ToString("yy"))) + // { + // project.No = prjYear * 1000 + prjNo + 1; + // } + // else + // { + // project.No = int.Parse(DateTime.Now.ToString("yy")) * 1000 + 1; + // } + + // _context.Projects.Add(project); + // } + // else + // { + // _context.Projects.Update(project); + + // } + + + // await _context.SaveChangesAsync(); + //} + //return RedirectToAction("Index"); + + + + + public async Task DeleteProject(int? id) + { + if (id == null) { return NotFound(); } - return View(project); - } - - [HttpPost] - public IActionResult CreateEditProject(Project project) - { - //for (int i = 0; i <= 100000; i++) - //{ - // project = new Project() - // { - // Name = i.ToString(), - // Description = i.ToString(), - // }; - - if (project.Id == 0) - { - var highestPrjNo = 0; - int prjYear = 0; - int prjNo = 0; - - if (_context.Projects.Count() > 0) - { - highestPrjNo = _context.Projects.Max(x => x.No); - prjYear = highestPrjNo; - - // Projekt Jahr freistellen - while (prjYear >= 100) - prjYear /= 10; - - // Laufende Nr. des Jahres freistellen - prjNo = highestPrjNo >= 1000 ? highestPrjNo % 1000 : highestPrjNo; - } - - // Neue Projekt Nummer berechnen - if (prjYear == int.Parse(DateTime.Now.ToString("yy"))) - { - project.No = prjYear * 1000 + prjNo + 1; - } - else - { - project.No = int.Parse(DateTime.Now.ToString("yy")) * 1000 + 1; - } - - _context.Projects.Add(project); - } - else - { - _context.Projects.Update(project); - - } - //} - - _context.SaveChanges(); - - return RedirectToAction("Index"); - } - - public IActionResult DeleteProject(int id) - { - var project = _context.Projects.Find(id); + var project = await _context.Projects.FirstOrDefaultAsync(x => x.Id == id); if (project == null) { @@ -117,79 +159,5 @@ namespace FSI.Prj.Mgt.Controllers return RedirectToAction("Index"); } - - - - [HttpGet] - public IActionResult Create() - { - //ViewBag.Plants = _context.Plants; - - //if (id == 0) - //{ - Project prj = new Project(); - - return PartialView("_CreateEditPartial", prj); - //} - - //var project = _context.Projects.Find(id); - - //if (project == null) - //{ - // return NotFound(); - //} - - //return PartialView("_CreateEditPartial", project); - } - - [HttpPost] - public IActionResult Create(Project project) - { - if (project.Id == 0) - { - var highestPrjNo = 0; - int prjYear = 0; - int prjNo = 0; - - if (_context.Projects.Count() > 0) - { - highestPrjNo = _context.Projects.Max(x => x.No); - prjYear = highestPrjNo; - - // Projekt Jahr freistellen - while (prjYear >= 100) - prjYear /= 10; - - // Laufende Nr. des Jahres freistellen - prjNo = highestPrjNo >= 1000 ? highestPrjNo % 1000 : highestPrjNo; - } - - // Neue Projekt Nummer berechnen - if (prjYear == int.Parse(DateTime.Now.ToString("yy"))) - { - project.No = prjYear * 1000 + prjNo + 1; - } - else - { - project.No = int.Parse(DateTime.Now.ToString("yy")) * 1000 + 1; - } - - _context.Projects.Add(project); - } - else - { - _context.Projects.Update(project); - - } - - _context.SaveChanges(); - - return RedirectToAction("Index"); - } - - public async Task OnGetCreateOrEditAsync(int id, Project customer) - { - return new JsonResult(new { isValid = true, html = "" }); - } } } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230919061443_addedInitDbSet.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230919061443_addedInitDbSet.Designer.cs deleted file mode 100644 index 7093a88..0000000 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230919061443_addedInitDbSet.Designer.cs +++ /dev/null @@ -1,355 +0,0 @@ -// -using System; -using FSI.Prj.Mgt.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace FSI.Prj.Mgt.Data.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20230919061443_addedInitDbSet")] - partial class addedInitDbSet - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("FSI.Prj.Mgt.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ShortName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubPlantName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubPlantShortName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Description") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("No") - .HasColumnType("int"); - - b.Property("PlantId") - .HasColumnType("int"); - - b.Property("Status") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("PlantId"); - - b.ToTable("Projects"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("ProviderKey") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .IsRequired() - .HasColumnType("nvarchar(450)"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("nvarchar(450)"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("nvarchar(450)"); - - b.Property("LoginProvider") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Name") - .HasMaxLength(128) - .HasColumnType("nvarchar(128)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => - { - b.HasOne("FSI.Prj.Mgt.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230920052441_addedOrganizationDbSet.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230920052441_addedOrganizationDbSet.cs deleted file mode 100644 index d72caf1..0000000 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230920052441_addedOrganizationDbSet.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace FSI.Prj.Mgt.Data.Migrations -{ - /// - public partial class addedOrganizationDbSet : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Organizations", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Name = table.Column(type: "nvarchar(max)", nullable: false), - ShortName = table.Column(type: "nvarchar(max)", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: false), - ParentId = table.Column(type: "int", nullable: true), - OrganizationId = table.Column(type: "int", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Organizations", x => x.Id); - table.ForeignKey( - name: "FK_Organizations_Organizations_OrganizationId", - column: x => x.OrganizationId, - principalTable: "Organizations", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_Organizations_OrganizationId", - table: "Organizations", - column: "OrganizationId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Organizations"); - } - } -} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230920052441_addedOrganizationDbSet.Designer.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230928130340_Initial.Designer.cs similarity index 93% rename from FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230920052441_addedOrganizationDbSet.Designer.cs rename to FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230928130340_Initial.Designer.cs index 0e1c949..00d7be8 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230920052441_addedOrganizationDbSet.Designer.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230928130340_Initial.Designer.cs @@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace FSI.Prj.Mgt.Data.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20230920052441_addedOrganizationDbSet")] - partial class addedOrganizationDbSet + [Migration("20230928130340_Initial")] + partial class Initial { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -41,9 +41,6 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("OrganizationId") - .HasColumnType("int"); - b.Property("ParentId") .HasColumnType("int"); @@ -51,9 +48,12 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("Type") + .HasColumnType("int"); + b.HasKey("Id"); - b.HasIndex("OrganizationId"); + b.HasIndex("ParentId"); b.ToTable("Organizations"); }); @@ -70,6 +70,9 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("ProjectId") + .HasColumnType("int"); + b.Property("ShortName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -84,6 +87,8 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasKey("Id"); + b.HasIndex("ProjectId"); + b.ToTable("Plants"); }); @@ -106,7 +111,7 @@ namespace FSI.Prj.Mgt.Data.Migrations b.Property("No") .HasColumnType("int"); - b.Property("PlantId") + b.Property("PlantId") .HasColumnType("int"); b.Property("Status") @@ -323,18 +328,25 @@ namespace FSI.Prj.Mgt.Data.Migrations modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => { - b.HasOne("FSI.Prj.Mgt.Models.Organization", null) + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") .WithMany("Organizations") - .HasForeignKey("OrganizationId"); + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Plant", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Project", null) + .WithMany("Plants") + .HasForeignKey("ProjectId"); }); modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => { b.HasOne("FSI.Prj.Mgt.Models.Plant", "Plant") .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("PlantId"); b.Navigation("Plant"); }); @@ -394,6 +406,11 @@ namespace FSI.Prj.Mgt.Data.Migrations { b.Navigation("Organizations"); }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Navigation("Plants"); + }); #pragma warning restore 612, 618 } } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230919061443_addedInitDbSet.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230928130340_Initial.cs similarity index 53% rename from FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230919061443_addedInitDbSet.cs rename to FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230928130340_Initial.cs index 625df72..800cddf 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230919061443_addedInitDbSet.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/20230928130340_Initial.cs @@ -5,11 +5,33 @@ namespace FSI.Prj.Mgt.Data.Migrations { /// - public partial class addedInitDbSet : Migration + public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { + migrationBuilder.CreateTable( + name: "Organizations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + ShortName = table.Column(type: "nvarchar(max)", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: false), + ParentId = table.Column(type: "int", nullable: true), + Type = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Organizations", x => x.Id); + table.ForeignKey( + name: "FK_Organizations_Organizations_ParentId", + column: x => x.ParentId, + principalTable: "Organizations", + principalColumn: "Id"); + }); + migrationBuilder.CreateTable( name: "Plants", columns: table => new @@ -19,7 +41,8 @@ namespace FSI.Prj.Mgt.Data.Migrations ShortName = table.Column(type: "nvarchar(max)", nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: false), SubPlantShortName = table.Column(type: "nvarchar(max)", nullable: false), - SubPlantName = table.Column(type: "nvarchar(max)", nullable: false) + SubPlantName = table.Column(type: "nvarchar(max)", nullable: false), + ProjectId = table.Column(type: "int", nullable: true) }, constraints: table => { @@ -33,10 +56,10 @@ namespace FSI.Prj.Mgt.Data.Migrations Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), No = table.Column(type: "int", nullable: false), - PlantId = table.Column(type: "int", nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: false), - Status = table.Column(type: "int", nullable: false) + Status = table.Column(type: "int", nullable: false), + PlantId = table.Column(type: "int", nullable: true) }, constraints: table => { @@ -45,19 +68,42 @@ namespace FSI.Prj.Mgt.Data.Migrations name: "FK_Projects_Plants_PlantId", column: x => x.PlantId, principalTable: "Plants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); + migrationBuilder.CreateIndex( + name: "IX_Organizations_ParentId", + table: "Organizations", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_Plants_ProjectId", + table: "Plants", + column: "ProjectId"); + migrationBuilder.CreateIndex( name: "IX_Projects_PlantId", table: "Projects", column: "PlantId"); + + migrationBuilder.AddForeignKey( + name: "FK_Plants_Projects_ProjectId", + table: "Plants", + column: "ProjectId", + principalTable: "Projects", + principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { + migrationBuilder.DropForeignKey( + name: "FK_Plants_Projects_ProjectId", + table: "Plants"); + + migrationBuilder.DropTable( + name: "Organizations"); + migrationBuilder.DropTable( name: "Projects"); diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs index 35ad73d..8e1cffb 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -38,9 +38,6 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("OrganizationId") - .HasColumnType("int"); - b.Property("ParentId") .HasColumnType("int"); @@ -48,9 +45,12 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("Type") + .HasColumnType("int"); + b.HasKey("Id"); - b.HasIndex("OrganizationId"); + b.HasIndex("ParentId"); b.ToTable("Organizations"); }); @@ -67,6 +67,9 @@ namespace FSI.Prj.Mgt.Data.Migrations .IsRequired() .HasColumnType("nvarchar(max)"); + b.Property("ProjectId") + .HasColumnType("int"); + b.Property("ShortName") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -81,6 +84,8 @@ namespace FSI.Prj.Mgt.Data.Migrations b.HasKey("Id"); + b.HasIndex("ProjectId"); + b.ToTable("Plants"); }); @@ -103,7 +108,7 @@ namespace FSI.Prj.Mgt.Data.Migrations b.Property("No") .HasColumnType("int"); - b.Property("PlantId") + b.Property("PlantId") .HasColumnType("int"); b.Property("Status") @@ -320,18 +325,25 @@ namespace FSI.Prj.Mgt.Data.Migrations modelBuilder.Entity("FSI.Prj.Mgt.Models.Organization", b => { - b.HasOne("FSI.Prj.Mgt.Models.Organization", null) + b.HasOne("FSI.Prj.Mgt.Models.Organization", "Parent") .WithMany("Organizations") - .HasForeignKey("OrganizationId"); + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Plant", b => + { + b.HasOne("FSI.Prj.Mgt.Models.Project", null) + .WithMany("Plants") + .HasForeignKey("ProjectId"); }); modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => { b.HasOne("FSI.Prj.Mgt.Models.Plant", "Plant") .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("PlantId"); b.Navigation("Plant"); }); @@ -391,6 +403,11 @@ namespace FSI.Prj.Mgt.Data.Migrations { b.Navigation("Organizations"); }); + + modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b => + { + b.Navigation("Plants"); + }); #pragma warning restore 612, 618 } } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Helper.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Helper.cs new file mode 100644 index 0000000..da0a5cb --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Helper.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.ViewEngines; +using Microsoft.AspNetCore.Mvc.ViewFeatures; +using Microsoft.AspNetCore.Mvc; + +namespace FSI.Prj.Mgt +{ + public class Helper + { + public static string RenderRazorViewToString(Controller controller, string viewName, object model = null) + { + controller.ViewData.Model = model; + using (var sw = new StringWriter()) + { + IViewEngine viewEngine = controller.HttpContext.RequestServices.GetService(typeof(ICompositeViewEngine)) as ICompositeViewEngine; + ViewEngineResult viewResult = viewEngine.FindView(controller.ControllerContext, viewName, false); + + ViewContext viewContext = new ViewContext( + controller.ControllerContext, + viewResult.View, + controller.ViewData, + controller.TempData, + sw, + new HtmlHelperOptions() + ); + viewResult.View.RenderAsync(viewContext); + return sw.GetStringBuilder().ToString(); + } + } + } +} diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs index eadede4..3eb75b6 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Organization.cs @@ -1,18 +1,49 @@ -using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; namespace FSI.Prj.Mgt.Models { public class Organization { + [Key] public int Id { get; set; } - + + [DisplayName("Name")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] public string Name { get; set; } + [DisplayName("Kurzname")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] public string ShortName { get; set; } + [DisplayName("Beschreibung")] public string Description { get; set; } + [ForeignKey("Id")] + [DisplayName("übergeordnetes Element")] public int? ParentId { get; set; } - public virtual List Organizations{ get; set; } + + public virtual Organization Parent { get; set; } + public virtual List Parents{ get; set; } + + [DisplayName("Type")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + public OrganizationType Type { get; set; } } + + public enum OrganizationType + { + [Display(Name = "Firma")] + company, + [Display(Name = "Werk")] + factory, + [Display(Name = "Bereich")] + area, + [Display(Name = "Anlage")] + plant, + [Display(Name = "Teilanlage")] + subPlant, + } + } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Plant.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Plant.cs index 7ac239f..63307cb 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Plant.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Plant.cs @@ -1,17 +1,29 @@ -using System.Runtime.CompilerServices; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; namespace FSI.Prj.Mgt.Models { public class Plant { + [Key] public int Id { get; set; } + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + [DisplayName("Anlage Kurzname")] public string ShortName { get; set; } + + [DisplayName("Anlage")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] public string Name { get; set; } + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + [DisplayName("Teilanlage Kurzname")] public string SubPlantShortName { get; set; } + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + [DisplayName("Teilanlage")] public string SubPlantName { get; set; } public string OutSh @@ -22,4 +34,5 @@ namespace FSI.Prj.Mgt.Models } } } + } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs index e3cfdc3..7bca69d 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Models/Project.cs @@ -1,23 +1,43 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace FSI.Prj.Mgt.Models { public class Project { + public Project() + { + Plants = new HashSet(); + } + + [Key] public int Id { get; set; } - public int No{ get; set; } - - [ForeignKey(nameof(Plant))] - public int PlantId { get; set; } - public virtual Plant Plant { get; set; } - + [DisplayName("Projekt-Nr")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] + public int No{ get; set; } + + [DisplayName("Name")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] public string Name { get; set; } - + + [DisplayName("Beschreibung")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] public string Description { get; set; } + + [DisplayName("Status")] + [Required(ErrorMessage = "Dieses Feld wird benötigt.")] public ProjectStatus Status { get; set; } + + [ForeignKey("Id")] + [DisplayName("Anlage, Teilanlage, ...")] + public int? PlantId { get; set; } + + public virtual Plant Plant { get; set; } + + public virtual ICollection Plants { get; set; } } diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml new file mode 100644 index 0000000..5e06f76 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml @@ -0,0 +1,54 @@ +@{ + ViewData["Title"] = "Organisation erstellen/bearbeiten"; + Layout = null; +} + +@model FSI.Prj.Mgt.Models.Organization + + +
+ +
+ +
+ + + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
+ +
+ +
+ +
+ diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml index 684c68a..616f7cb 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/Index.cshtml @@ -1,4 +1,51 @@ - +@using X.PagedList; +@using X.PagedList.Mvc.Core; +@using X.PagedList.Web.Common; + +@model IPagedList + +@{ + ViewData["Title"] = "Organisationen"; +} + +

Projekt-Übersicht

+ +
+ +
+

+ Suchen nach: + +

+
+ +
+ @await Html.PartialAsync("_ViewAll", Model) +
+ + + + + + + + + + + + + + + + + + + + + + + + @using (Html.BeginForm("Index", "Organization", FormMethod.Post)) { diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml new file mode 100644 index 0000000..6331f92 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml @@ -0,0 +1,89 @@ +@using X.PagedList; +@using X.PagedList.Mvc.Core; +@using X.PagedList.Web.Common; + +@model IPagedList + + + + + + + + + + + + + + + @{ + foreach (var item in Model) + { + + + + + + + + + + } + } + + +
+ @Html.DisplayNameFor(x => x.GetEnumerator().Current.Name) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.ShortName) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Description) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Type) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Parent) + + + + neues Organisation + +
+ @Html.DisplayFor(modelItem => item.Name) + + @Html.DisplayFor(modelItem => item.ShortName) + + @Html.DisplayFor(modelItem => @item.Description) + + @Html.DisplayFor(modelItem => @item.Type) + + @Html.DisplayFor(modelItem => @item.Parent.Name) @Html.DisplayFor(modelItem => @item.Parent.ShortName) + +
+ + + + + @* + *@ +
+
+ + + diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/AddOrEdit.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/AddOrEdit.cshtml new file mode 100644 index 0000000..0fb5364 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/AddOrEdit.cshtml @@ -0,0 +1,46 @@ +@{ + ViewData["Title"] = "Anlagen/Teilanlagen erstellen/bearbeiten"; + Layout = null; +} + +@model FSI.Prj.Mgt.Models.Plant + +
+ +
+ +
+ + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ +
+ +
+ +
\ No newline at end of file diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/Index.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/Index.cshtml new file mode 100644 index 0000000..a3a0371 --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/Index.cshtml @@ -0,0 +1,25 @@ +@using X.PagedList; +@using X.PagedList.Mvc.Core; +@using X.PagedList.Web.Common; + +@model IPagedList + +@{ + ViewData["Title"] = "Anlagen-Übersicht"; +} + +

Anlagen-Übersicht

+ +
+ +
+

+ Suchen nach: + +

+
+ +
+ @await Html.PartialAsync("_ViewAll", Model) +
+ diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/_ViewAll.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/_ViewAll.cshtml new file mode 100644 index 0000000..d3ea75b --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/_ViewAll.cshtml @@ -0,0 +1,83 @@ +@using X.PagedList; +@using X.PagedList.Mvc.Core; +@using X.PagedList.Web.Common; + +@model IPagedList + + + + + + + + + + + + + + + @{ + foreach (var item in Model) + { + + + + + + + + + } + } + + +
+ @Html.DisplayNameFor(x => x.GetEnumerator().Current.ShortName) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Name) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.SubPlantShortName) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.SubPlantName) + + + + neue Anlage/Teilanlage erstellen + +
+ @Html.DisplayFor(modelItem => item.ShortName) + + @Html.DisplayFor(modelItem => @item.Name) + + @Html.DisplayFor(modelItem => @item.SubPlantShortName) + + @Html.DisplayFor(modelItem => @item.SubPlantName) + +
+ + + + + @* + *@ +
+
+ + * \ No newline at end of file diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml new file mode 100644 index 0000000..7f9648c --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml @@ -0,0 +1,54 @@ +@{ + ViewData["Title"] = "Projekt erstellen/bearbeiten"; + Layout = null; +} + +@model FSI.Prj.Mgt.Models.Project + + +
+ +
+ +
+ + + + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ +
+ +
+ +
+ +
+ diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/CreateEdit.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/CreateEdit.cshtml deleted file mode 100644 index d060c98..0000000 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/CreateEdit.cshtml +++ /dev/null @@ -1,65 +0,0 @@ -@{ - ViewData["Title"] = "Porjekt erstellen/bearbeiten"; -} - -@model FSI.Prj.Mgt.Models.Project - - -
- -
-
Erstellen/Bearbeiten
-
- -
- -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- -
-
- -
-
- - - -
-
\ No newline at end of file diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/Index.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/Index.cshtml index 1f82022..28495c7 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/Index.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/Index.cshtml @@ -4,18 +4,14 @@ @model IPagedList - @{ - ViewData["Title"] = "Porjekt-Übersicht"; + ViewData["Title"] = "Projekt-Übersicht"; }

Projekt-Übersicht

-
- -
-
+

Suchen nach: @@ -23,69 +19,7 @@

- - - - - - - - - - - - - - - @{ - foreach (var project in Model) - { - - - - - - - - - - } - } - - -
Nr.AnlageNameBezeichnungStatusAktionen
- @project.No - - @project.Plant.Name @project.Plant.SubPlantShortName - - @project.Name - - @project.Description - - @Html.DisplayFor(x => @project.Status) - -
- - -
-
- - - +
+ @await Html.PartialAsync("_ViewAll", Model) +
diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml new file mode 100644 index 0000000..95bc92a --- /dev/null +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml @@ -0,0 +1,89 @@ +@using X.PagedList; +@using X.PagedList.Mvc.Core; +@using X.PagedList.Web.Common; + +@model IPagedList + + + + + + + + + + + + + + + @{ + foreach (var item in Model) + { + + + + + + + + + + } + } + + +
+ @Html.DisplayNameFor(x => x.GetEnumerator().Current.No) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Plant) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Name) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Description) + + @Html.DisplayNameFor(x => x.GetEnumerator().Current.Status) + + + + neues Projekt erstellen + +
+ @Html.DisplayFor(modelItem => item.No) + + @Html.DisplayFor(modelItem => @item.Plant.Name) @Html.DisplayFor(modelItem => @item.Plant.SubPlantShortName) + + @Html.DisplayFor(modelItem => @item.Name) + + @Html.DisplayFor(modelItem => @item.Description) + + @Html.DisplayFor(modelItem => @item.Status) + +
+ + + + + @* + *@ +
+
+ + + diff --git a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml index 094a99d..bf4514b 100644 --- a/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml +++ b/FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Shared/_Layout.cshtml @@ -30,6 +30,9 @@ + @@ -42,6 +45,20 @@ + +