Sicherung
This commit is contained in:
@@ -17,9 +17,22 @@ namespace FSI.Prj.Mgt.Controllers
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
public async Task<IActionResult> Index(string searchString, int? page)
|
||||
{
|
||||
|
||||
IQueryable<Organization> 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<TreeViewNode> nodes = new();
|
||||
|
||||
// Loop and add the Parent Nodes
|
||||
@@ -46,7 +59,6 @@ namespace FSI.Prj.Mgt.Controllers
|
||||
}
|
||||
ViewBag.Json = JsonConvert.SerializeObject(nodes);
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
83
FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/PlantController.cs
Normal file
83
FSI.Prj.Mgt/FSI.Prj.Mgt/Controllers/PlantController.cs
Normal file
@@ -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<IActionResult> Index(string searchString, int? page)
|
||||
{
|
||||
IQueryable<Plant> 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<IActionResult> 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<IActionResult> 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<Plant>)_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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<IActionResult> Index(string searchString, int? page)
|
||||
{
|
||||
|
||||
IQueryable<Project> projects = _context.Projects.Include(x => x.Plant);
|
||||
IQueryable<Project> items = _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<IActionResult> 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 (project == null)
|
||||
if (item == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(project);
|
||||
item.Plants = _context.Plants.ToList();
|
||||
return View(item);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult CreateEditProject(Project project)
|
||||
//[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> AddOrEdit(int id, Project item)
|
||||
{
|
||||
//for (int i = 0; i <= 100000; i++)
|
||||
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)
|
||||
//{
|
||||
// project = new Project()
|
||||
// if (project.Id == 0)
|
||||
// {
|
||||
// Name = i.ToString(),
|
||||
// Description = i.ToString(),
|
||||
// };
|
||||
// var highestPrjNo = 0;
|
||||
// int prjYear = 0;
|
||||
// int prjNo = 0;
|
||||
|
||||
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;
|
||||
|
||||
if (_context.Projects.Count() > 0)
|
||||
{
|
||||
highestPrjNo = _context.Projects.Max(x => x.No);
|
||||
prjYear = highestPrjNo;
|
||||
// // Projekt Jahr freistellen
|
||||
// while (prjYear >= 100)
|
||||
// prjYear /= 10;
|
||||
|
||||
// Projekt Jahr freistellen
|
||||
while (prjYear >= 100)
|
||||
prjYear /= 10;
|
||||
// // Laufende Nr. des Jahres freistellen
|
||||
// prjNo = highestPrjNo >= 1000 ? highestPrjNo % 1000 : highestPrjNo;
|
||||
// }
|
||||
|
||||
// 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;
|
||||
// }
|
||||
|
||||
// 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.Projects.Add(project);
|
||||
}
|
||||
else
|
||||
{
|
||||
_context.Projects.Update(project);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
//}
|
||||
//return RedirectToAction("Index");
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index");
|
||||
|
||||
|
||||
public async Task<IActionResult> DeleteProject(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
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<JsonResult> OnGetCreateOrEditAsync(int id, Project customer)
|
||||
{
|
||||
return new JsonResult(new { isValid = true, html = "" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,355 +0,0 @@
|
||||
// <auto-generated />
|
||||
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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ShortName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SubPlantName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SubPlantShortName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Plants");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FSI.Prj.Mgt.Models.Project", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("No")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlantId");
|
||||
|
||||
b.ToTable("Projects");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("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<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("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<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("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<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("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<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", 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<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FSI.Prj.Mgt.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addedOrganizationDbSet : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Organizations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ParentId = table.Column<int>(type: "int", nullable: true),
|
||||
OrganizationId = table.Column<int>(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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Organizations");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -41,9 +41,6 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("OrganizationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -51,9 +48,12 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("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<int?>("ProjectId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("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<int>("No")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
b.Property<int?>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("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
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,33 @@
|
||||
namespace FSI.Prj.Mgt.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addedInitDbSet : Migration
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Organizations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ParentId = table.Column<int>(type: "int", nullable: true),
|
||||
Type = table.Column<int>(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<string>(type: "nvarchar(max)", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
SubPlantShortName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
SubPlantName = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
SubPlantName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ProjectId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@@ -33,10 +56,10 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
No = table.Column<int>(type: "int", nullable: false),
|
||||
PlantId = table.Column<int>(type: "int", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false)
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
PlantId = table.Column<int>(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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Plants_Projects_ProjectId",
|
||||
table: "Plants");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Organizations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Projects");
|
||||
|
||||
@@ -38,9 +38,6 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("OrganizationId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -48,9 +45,12 @@ namespace FSI.Prj.Mgt.Data.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("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<int?>("ProjectId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("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<int>("No")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PlantId")
|
||||
b.Property<int?>("PlantId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("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
|
||||
}
|
||||
}
|
||||
|
||||
31
FSI.Prj.Mgt/FSI.Prj.Mgt/Helper.cs
Normal file
31
FSI.Prj.Mgt/FSI.Prj.Mgt/Helper.cs
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Organization> Organizations{ get; set; }
|
||||
|
||||
public virtual Organization Parent { get; set; }
|
||||
public virtual List<Organization> 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,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,44 @@
|
||||
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<Plant>();
|
||||
}
|
||||
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Projekt-Nr")]
|
||||
[Required(ErrorMessage = "Dieses Feld wird benötigt.")]
|
||||
public int No{ get; set; }
|
||||
|
||||
[ForeignKey(nameof(Plant))]
|
||||
public int PlantId { get; set; }
|
||||
public virtual Plant Plant { 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<Plant> Plants { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public enum ProjectStatus
|
||||
|
||||
54
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml
Normal file
54
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/AddOrEdit.cshtml
Normal file
@@ -0,0 +1,54 @@
|
||||
@{
|
||||
ViewData["Title"] = "Organisation erstellen/bearbeiten";
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
@model FSI.Prj.Mgt.Models.Organization
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
|
||||
<form asp-action="AddOrEdit" asp-route-id="@Model.Id" onsubmit="return jQueryAjaxPost(this);">
|
||||
|
||||
<input hidden asp-for="Id" placeholder="ID" class="form-control" />
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="ShortName" class="control-label"></label>
|
||||
<input asp-for="ShortName" placeholder="Kurzname" class="form-control" />
|
||||
<span asp-validation-for="ShortName" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="control-label"></label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Description" class="control-label"></label>
|
||||
<input asp-for="Description" class="form-control" />
|
||||
<span asp-validation-for="Description" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Type" class="control-label"></label>
|
||||
<select asp-for="Type" asp-items="Html.GetEnumSelectList<FSI.Prj.Mgt.Models.OrganizationType>()" class="form-control"></select>
|
||||
<span asp-validation-for="Type" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="ParentId" class="control-label"></label>
|
||||
<select asp-for="ParentId" asp-items="@(new SelectList(Model.Parents, "Id", "OutSh"))" class="form-control"></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Submit" class="btn btn-primary btn-block" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,51 @@
|
||||
|
||||
@using X.PagedList;
|
||||
@using X.PagedList.Mvc.Core;
|
||||
@using X.PagedList.Web.Common;
|
||||
|
||||
@model IPagedList<Organization>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Organisationen";
|
||||
}
|
||||
|
||||
<h1> Projekt-Übersicht</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<form asp-action="Index" method="get">
|
||||
<p>
|
||||
Suchen nach: <input type="text" name="SearchString" value="" />
|
||||
<input type="submit" value="suchen" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<div id="view-all">
|
||||
@await Html.PartialAsync("_ViewAll", Model)
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@using (Html.BeginForm("Index", "Organization", FormMethod.Post))
|
||||
{
|
||||
|
||||
89
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml
Normal file
89
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Organization/_ViewAll.cshtml
Normal file
@@ -0,0 +1,89 @@
|
||||
@using X.PagedList;
|
||||
@using X.PagedList.Mvc.Core;
|
||||
@using X.PagedList.Web.Common;
|
||||
|
||||
@model IPagedList<Organization>
|
||||
|
||||
<table class="table table-striped table-hover"
|
||||
data-filter-control="true"
|
||||
data-show-search-clear-button="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.ShortName)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Description)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Type)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Parent)
|
||||
</th>
|
||||
<th>
|
||||
<a onclick="showInPopup('@Url.Action("AddOrEdit", "Organization", null, Context.Request.Scheme)','neue Organisation erstellen')" class="btn btn-success text-white">
|
||||
<i class="bi bi-plus-square"></i>
|
||||
neues Organisation
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@{
|
||||
foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td hidden>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ShortName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.Description)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.Type)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.Parent.Name) @Html.DisplayFor(modelItem => @item.Parent.ShortName)
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group" style="flex-direction:row">
|
||||
<a onclick="showInPopup('@Url.Action("AddOrEdit", "Project",new {id = item.Id}, Context.Request.Scheme)','Projekt bearbeiten')" class="btn btn-success text-white">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
<a asp-action="Delete" asp-asp-route-id="@item.Id"><i class="bi bi-trash"></i></a>
|
||||
@* <button class="btn btn-success" onclick="location.href='@Url.Action("CreateEdit", new {@item.Id})'"><i class="bi bi-pencil-square"></i></button>
|
||||
<button class="btn btn-danger" onclick="location.href='@Url.Action("DeleteProject", new {@item.Id})'"><i class="bi bi-trash"></i></button>*@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<nav>
|
||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page }), new PagedListRenderOptions()
|
||||
{
|
||||
ActiveLiElementClass = "active",
|
||||
PageClasses = new[]{ "page-link"},
|
||||
LiElementClasses=new[] { "page-item" },
|
||||
UlElementClasses = new[] { "pagination","justify-content-center", "mt-3" },
|
||||
LinkToNextPageFormat = ">",
|
||||
LinkToPreviousPageFormat = "<",
|
||||
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
|
||||
DisplayLinkToNextPage = PagedListDisplayMode.Always
|
||||
})
|
||||
</nav>
|
||||
46
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/AddOrEdit.cshtml
Normal file
46
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/AddOrEdit.cshtml
Normal file
@@ -0,0 +1,46 @@
|
||||
@{
|
||||
ViewData["Title"] = "Anlagen/Teilanlagen erstellen/bearbeiten";
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
@model FSI.Prj.Mgt.Models.Plant
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
|
||||
<form asp-action="AddOrEdit" asp-route-id="@Model.Id" onsubmit="return jQueryAjaxPost(this);">
|
||||
|
||||
<input hidden asp-for="Id" placeholder="ID" class="form-control" />
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="ShortName" class="control-label"></label>
|
||||
<input asp-for="ShortName" placeholder="Name" class="form-control" />
|
||||
<span asp-validation-for="ShortName" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="control-label"></label>
|
||||
<input asp-for="Name" placeholder="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="SubPlantShortName" class="control-label"></label>
|
||||
<input asp-for="SubPlantShortName" placeholder="Name" class="form-control" />
|
||||
<span asp-validation-for="SubPlantShortName" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="SubPlantName" class="control-label"></label>
|
||||
<input asp-for="SubPlantName" placeholder="Name" class="form-control" />
|
||||
<span asp-validation-for="SubPlantName" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Submit" class="btn btn-primary btn-block" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
25
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/Index.cshtml
Normal file
25
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/Index.cshtml
Normal file
@@ -0,0 +1,25 @@
|
||||
@using X.PagedList;
|
||||
@using X.PagedList.Mvc.Core;
|
||||
@using X.PagedList.Web.Common;
|
||||
|
||||
@model IPagedList<Plant>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Anlagen-Übersicht";
|
||||
}
|
||||
|
||||
<h1> Anlagen-Übersicht</h1>
|
||||
|
||||
<hr />
|
||||
|
||||
<form asp-action="Index" method="get">
|
||||
<p>
|
||||
Suchen nach: <input type="text" name="SearchString" value="" />
|
||||
<input type="submit" value="suchen" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<div id="view-all">
|
||||
@await Html.PartialAsync("_ViewAll", Model)
|
||||
</div>
|
||||
|
||||
83
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/_ViewAll.cshtml
Normal file
83
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Plant/_ViewAll.cshtml
Normal file
@@ -0,0 +1,83 @@
|
||||
@using X.PagedList;
|
||||
@using X.PagedList.Mvc.Core;
|
||||
@using X.PagedList.Web.Common;
|
||||
|
||||
@model IPagedList<Plant>
|
||||
|
||||
|
||||
<table class="table table-striped table-hover"
|
||||
data-filter-control="true"
|
||||
data-show-search-clear-button="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.ShortName)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.SubPlantShortName)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.SubPlantName)
|
||||
</th>
|
||||
<th>
|
||||
<a onclick="showInPopup('@Url.Action("AddOrEdit", "Plant",null, Context.Request.Scheme)','neue Anlage/Teilanlage')" class="btn btn-success text-white">
|
||||
<i class="bi bi-plus-square"></i>
|
||||
neue Anlage/Teilanlage erstellen
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@{
|
||||
foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td hidden>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ShortName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.SubPlantShortName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.SubPlantName)
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group" style="flex-direction:row">
|
||||
<a onclick="showInPopup('@Url.Action("AddOrEdit", "Plant",new {id = item.Id}, Context.Request.Scheme)','Anlage bearbeiten')" class="btn btn-success text-white">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
<a asp-action="Delete" asp-asp-route-id="@item.Id"><i class="bi bi-trash"></i></a>
|
||||
@* <button class="btn btn-success" onclick="location.href='@Url.Action("CreateEdit", new {@item.Id})'"><i class="bi bi-pencil-square"></i></button>
|
||||
<button class="btn btn-danger" onclick="location.href='@Url.Action("DeleteProject", new {@item.Id})'"><i class="bi bi-trash"></i></button>*@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<nav>
|
||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page }), new PagedListRenderOptions()
|
||||
{
|
||||
ActiveLiElementClass = "active",
|
||||
PageClasses = new[]{ "page-link"},
|
||||
LiElementClasses=new[] { "page-item" },
|
||||
UlElementClasses = new[] { "pagination","justify-content-center", "mt-3" },
|
||||
LinkToNextPageFormat = ">",
|
||||
LinkToPreviousPageFormat = "<",
|
||||
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
|
||||
DisplayLinkToNextPage = PagedListDisplayMode.Always
|
||||
})
|
||||
</nav> *
|
||||
54
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml
Normal file
54
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/AddOrEdit.cshtml
Normal file
@@ -0,0 +1,54 @@
|
||||
@{
|
||||
ViewData["Title"] = "Projekt erstellen/bearbeiten";
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
@model FSI.Prj.Mgt.Models.Project
|
||||
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
|
||||
<form asp-action="AddOrEdit" asp-route-id="@Model.Id" onsubmit="return jQueryAjaxPost(this);">
|
||||
|
||||
<input hidden asp-for="Id" placeholder="ID" class="form-control" />
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="No" class="control-label"></label>
|
||||
<input asp-for="No" placeholder="Projekt-Nr." class="form-control" />
|
||||
<span asp-validation-for="No" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="control-label"></label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Description" class="control-label"></label>
|
||||
<input asp-for="Description" class="form-control" />
|
||||
<span asp-validation-for="Description" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Status" class="control-label"></label>
|
||||
<select asp-for="Status" asp-items="Html.GetEnumSelectList<FSI.Prj.Mgt.Models.ProjectStatus>()" class="form-control"></select>
|
||||
<span asp-validation-for="Status" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="PlantId" class="control-label"></label>
|
||||
<select asp-for="PlantId" asp-items="@(new SelectList(Model.Plants, "Id", "OutSh"))" class="form-control"></select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Submit" class="btn btn-primary btn-block" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
@{
|
||||
ViewData["Title"] = "Porjekt erstellen/bearbeiten";
|
||||
}
|
||||
|
||||
@model FSI.Prj.Mgt.Models.Project
|
||||
|
||||
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
<h5>Erstellen/Bearbeiten</h5>
|
||||
</div>
|
||||
|
||||
<form asp-action="CreateEditProject" method="post">
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input hidden asp-for="Id" placeholder="ID" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input hidden asp-for="No" placeholder="Projekt-Nr." class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<select asp-for="PlantId" class="form-control" asp-items="@(new SelectList(@ViewBag.Plants, "Id", "OutSh"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input asp-for="Name" placeholder="Name" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<input asp-for="Description" placeholder="Beschreibung" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<select asp-for="Status" asp-items="Html.GetEnumSelectList<FSI.Prj.Mgt.Models.ProjectStatus>()" class="form-control"></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col mb-3">
|
||||
<select asp-for="PlantId" class="form-control" asp-items="@(new SelectList(@ViewBag.Plants, "Id", "OutSh"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-footer">
|
||||
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -4,18 +4,14 @@
|
||||
|
||||
@model IPagedList<Project>
|
||||
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Porjekt-Übersicht";
|
||||
ViewData["Title"] = "Projekt-Übersicht";
|
||||
}
|
||||
|
||||
<h1> Projekt-Übersicht</h1>
|
||||
|
||||
<form asp-action="CreateEdit">
|
||||
<button type="submit" class="btn btn-primary"><i class="bi bi-plus-square"></i> neues Projekt erstellen</button>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
<form asp-action="Index" method="get">
|
||||
<p>
|
||||
Suchen nach: <input type="text" name="SearchString" value="" />
|
||||
@@ -23,69 +19,7 @@
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<table class="table table-striped table-hover"
|
||||
data-filter-control="true"
|
||||
data-show-search-clear-button="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th hidden>Id</th>
|
||||
<th>Nr.</th>
|
||||
<th>Anlage</th>
|
||||
<th style="width:20%">Name</th>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Status</th>
|
||||
<th>Aktionen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@{
|
||||
foreach (var project in Model)
|
||||
{
|
||||
<tr>
|
||||
<td hidden>
|
||||
@project.Id
|
||||
</td>
|
||||
<td>
|
||||
@project.No
|
||||
</td>
|
||||
<td>
|
||||
@project.Plant.Name @project.Plant.SubPlantShortName
|
||||
</td>
|
||||
<td>
|
||||
@project.Name
|
||||
</td>
|
||||
<td>
|
||||
@project.Description
|
||||
</td>
|
||||
<td class="text-@(project.Status == ProjectStatus.started ? "success" : "danger")">
|
||||
@Html.DisplayFor(x => @project.Status)
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group" style="flex-direction:row">
|
||||
<button class="btn btn-success" onclick="location.href='@Url.Action("CreateEdit", new {@project.Id})'"><i class="bi bi-pencil-square"></i></button>
|
||||
<button class="btn btn-danger" onclick="location.href='@Url.Action("DeleteProject", new {@project.Id})'"><i class="bi bi-trash"></i></button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<nav>
|
||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page }), new PagedListRenderOptions()
|
||||
{
|
||||
ActiveLiElementClass = "active",
|
||||
PageClasses = new[]{ "page-link"},
|
||||
LiElementClasses=new[] { "page-item" },
|
||||
UlElementClasses = new[] { "pagination","justify-content-center", "mt-3" },
|
||||
LinkToNextPageFormat = ">",
|
||||
LinkToPreviousPageFormat = "<",
|
||||
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
|
||||
DisplayLinkToNextPage = PagedListDisplayMode.Always
|
||||
})
|
||||
</nav>
|
||||
<div id="view-all">
|
||||
@await Html.PartialAsync("_ViewAll", Model)
|
||||
</div>
|
||||
|
||||
|
||||
89
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml
Normal file
89
FSI.Prj.Mgt/FSI.Prj.Mgt/Views/Project/_ViewAll.cshtml
Normal file
@@ -0,0 +1,89 @@
|
||||
@using X.PagedList;
|
||||
@using X.PagedList.Mvc.Core;
|
||||
@using X.PagedList.Web.Common;
|
||||
|
||||
@model IPagedList<Project>
|
||||
|
||||
<table class="table table-striped table-hover"
|
||||
data-filter-control="true"
|
||||
data-show-search-clear-button="true">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.No)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Plant)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Description)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(x => x.GetEnumerator().Current.Status)
|
||||
</th>
|
||||
<th>
|
||||
<a onclick="showInPopup('@Url.Action("AddOrEdit", "Project",null, Context.Request.Scheme)','neues Projekt')" class="btn btn-success text-white">
|
||||
<i class="bi bi-plus-square"></i>
|
||||
neues Projekt erstellen
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@{
|
||||
foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td hidden>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.No)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.Plant.Name) @Html.DisplayFor(modelItem => @item.Plant.SubPlantShortName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => @item.Description)
|
||||
</td>
|
||||
<td class="text-@(item.Status == ProjectStatus.started ? "success" : "danger")">
|
||||
@Html.DisplayFor(modelItem => @item.Status)
|
||||
</td>
|
||||
<td>
|
||||
<div class="btn-group" style="flex-direction:row">
|
||||
<a onclick="showInPopup('@Url.Action("AddOrEdit", "Project",new {id = item.Id}, Context.Request.Scheme)','Projekt bearbeiten')" class="btn btn-success text-white">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
<a asp-action="Delete" asp-asp-route-id="@item.Id"><i class="bi bi-trash"></i></a>
|
||||
@* <button class="btn btn-success" onclick="location.href='@Url.Action("CreateEdit", new {@item.Id})'"><i class="bi bi-pencil-square"></i></button>
|
||||
<button class="btn btn-danger" onclick="location.href='@Url.Action("DeleteProject", new {@item.Id})'"><i class="bi bi-trash"></i></button>*@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<nav>
|
||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page }), new PagedListRenderOptions()
|
||||
{
|
||||
ActiveLiElementClass = "active",
|
||||
PageClasses = new[]{ "page-link"},
|
||||
LiElementClasses=new[] { "page-item" },
|
||||
UlElementClasses = new[] { "pagination","justify-content-center", "mt-3" },
|
||||
LinkToNextPageFormat = ">",
|
||||
LinkToPreviousPageFormat = "<",
|
||||
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
|
||||
DisplayLinkToNextPage = PagedListDisplayMode.Always
|
||||
})
|
||||
</nav>
|
||||
@@ -30,6 +30,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Organization" asp-action="Index">Organization</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="btn btn-dark" asp-area="" asp-controller="Plant" asp-action="Index">Anlagen</a>
|
||||
</li>
|
||||
</ul>
|
||||
<partial name="_LoginPartial" />
|
||||
</div>
|
||||
@@ -42,6 +45,20 @@
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div class="modal" tabindex="-1" role="dialog" id="form-modal" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body" >
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2023 - FSI.Prj.Mgt - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
|
||||
@@ -2,3 +2,45 @@
|
||||
// for details on configuring this project to bundle and minify static web assets.
|
||||
|
||||
// Write your JavaScript code.
|
||||
|
||||
showInPopup = (url, title) => {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
success: function (res) {
|
||||
$("#form-modal .modal-body").html(res);
|
||||
$("#form-modal .modal-title").html(title);
|
||||
$("#form-modal").modal('show');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
jQueryAjaxPost = form => {
|
||||
try {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: form.action,
|
||||
data: new FormData(form),
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (res) {
|
||||
if (res.isValid) {
|
||||
$('#view-all').html(res.html)
|
||||
$('#form-modal .modal-body').html('');
|
||||
$('#form-modal .modal-title').html('');
|
||||
$('#form-modal').modal('hide');
|
||||
}
|
||||
else
|
||||
$("#form-modal .modal-body").html(res.html);
|
||||
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
//to prevent default form submit event
|
||||
return false;
|
||||
} catch (ex) {
|
||||
console.log(ex)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user