diff --git a/Areas/Inventory/Models/DepartmentModel.cs b/Areas/Inventory/Models/DepartmentModel.cs index 18e7fdf..a9f2fb0 100644 --- a/Areas/Inventory/Models/DepartmentModel.cs +++ b/Areas/Inventory/Models/DepartmentModel.cs @@ -10,6 +10,6 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public required string Name { get; set; } public required int CompanyId { get; set; } [ForeignKey("CompanyId")] - public virtual required CompanyModel Company { get; set; } + public virtual CompanyModel? Company { get; set; } } } diff --git a/Areas/Inventory/Models/ItemModel.cs b/Areas/Inventory/Models/ItemModel.cs index cd9b0c5..99a7fc2 100644 --- a/Areas/Inventory/Models/ItemModel.cs +++ b/Areas/Inventory/Models/ItemModel.cs @@ -24,10 +24,10 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public required DateTime EndWDate { get; set; } public required DateTime InvoiceDate { get; set; } [ForeignKey("CompanyId")] - public required virtual CompanyModel Company { get; set; } + public virtual CompanyModel? Company { get; set; } [ForeignKey("DepartmentId")] - public required virtual DepartmentModel Department { get; set; } + public virtual DepartmentModel? Department { get; set; } [ForeignKey("ProductId")] - public required virtual ProductModel Product { get; set; } + public virtual ProductModel? Product { get; set; } } } diff --git a/Areas/Inventory/Models/ProductModel.cs b/Areas/Inventory/Models/ProductModel.cs index d2bf4ee..eb64bca 100644 --- a/Areas/Inventory/Models/ProductModel.cs +++ b/Areas/Inventory/Models/ProductModel.cs @@ -8,13 +8,12 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models [Key] public int ProductId { get; set; } public required string ProductName { get; set; } - public required string Manufacturer { get; set; } + public required int ManufacturerId { get; set; } public required string Category { get; set; } public required string ModelNo { get; set; } - public required int QuantityProduct { get; set; } + public int? QuantityProduct { get; set; } public required string ImageProduct { get; set; } - public required int CompanyId { get; set; } - [ForeignKey("CompanyId")] - public required virtual CompanyModel Company { get; set; } + [ForeignKey("ManufacturerId")] + public virtual ManufacturerModel? Manufacturer { get; set; } } } diff --git a/Areas/Inventory/Views/Item/ProductRegistration.cshtml b/Areas/Inventory/Views/Item/ProductRegistration.cshtml index ef59cd4..42fa89c 100644 --- a/Areas/Inventory/Views/Item/ProductRegistration.cshtml +++ b/Areas/Inventory/Views/Item/ProductRegistration.cshtml @@ -4,114 +4,127 @@ } @await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml"); -
-
-
-
-
-
-
-
-

REGISTRATION PRODUCT

-
-
-
- - @* Product Name *@ -
- -
- -
+
+
+
+ +
+
+
+
+
+
+

REGISTRATION PRODUCT

+
+
- @* Manufacturer *@ -
- -
-
- + @* Product Name *@ +
+ +
+ +
+
+ + @* Manufacturer *@ +
+ +
+
+ +
+
+
+ + @* Category *@ +
+ +
+
+ +
+
+
+ +
+
+ + @* Model No Coding *@ +
+ +
+ +
+
+ + @* Image Product Coding *@ +
+ +
+ +
+ Image Preview +
+
+ +
+
+
+ +
- - @* Category *@ -
- -
-
- -
-
-
- -
-
- - @* Model No Coding *@ -
- -
- -
-
- - @* Min Quantity Coding *@ -
- -
- -
-
- - @* Image Product Coding *@ -
- -
- -
- Image Preview -
-
- -
-
-
- - -
+ +
+
- +
+ +
+
+
+
+
- +@section Scripts { +@{ + await Html.RenderPartialAsync("_ValidationScriptsPartial"); +} +} diff --git a/Areas/Inventory/Views/Main/ManifacturerRegistration.cshtml b/Areas/Inventory/Views/Main/ManifacturerRegistration.cshtml index a8bbb7f..41766fc 100644 --- a/Areas/Inventory/Views/Main/ManifacturerRegistration.cshtml +++ b/Areas/Inventory/Views/Main/ManifacturerRegistration.cshtml @@ -72,7 +72,6 @@ }) .then(response => response.json()) .then(data => { - console.log(data); if (data != null && data.length > 0) { this.manufacturer = data; diff --git a/Controllers/API/Inventory/InvMainAPI.cs b/Controllers/API/Inventory/InvMainAPI.cs index 3613946..1903b28 100644 --- a/Controllers/API/Inventory/InvMainAPI.cs +++ b/Controllers/API/Inventory/InvMainAPI.cs @@ -23,6 +23,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory _logger = logger; _authDbContext = authDbContext; } + #region Manufacturer [HttpPost("ManufacturerList")] public async Task ManufacturerList() @@ -30,6 +31,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory var manifacturerList = await _authDbContext.Manufacturers.ToListAsync(); return Json(manifacturerList); } + [HttpPost("AddManufacturer")] public async Task AddManufacturer([FromBody] ManufacturerModel manufacturer) { @@ -72,6 +74,66 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory return Ok(new { success = true, message = "Manufacturer deleted successfully" }); } + #endregion Manufacturer + #region Product + + [HttpPost("ProductList")] + public async Task ProductList() + { + var productList = await _authDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync(); + return Json(productList); + } + + [HttpPost("AddProduct")] + public async Task AddProduct([FromBody] ProductModel product) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + if (product == null) + { + return NotFound("Product is null"); + } + + try + { + product.QuantityProduct = 0; + var productImage = product.ImageProduct; // Save image to wwwroot/media/inventory/images | Images name is product.ModelNo | product.ImageProduct is in base64 string + if (!string.IsNullOrEmpty(product.ImageProduct)) + { + var bytes = Convert.FromBase64String(product.ImageProduct); + var filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/media/inventory/images", product.ModelNo); + await System.IO.File.WriteAllBytesAsync(filePath, bytes); + product.ImageProduct = "/media/inventory/images/" + product.ModelNo; + } + _authDbContext.Products.Add(product); + await _authDbContext.SaveChangesAsync(); + var updatedList = await _authDbContext.Manufacturers.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync(); + return Json(updatedList); + } + catch (Exception ex) + { + return BadRequest(ex.Message); + } + } + + [HttpDelete("DeleteProduct/{id}")] + public async Task DeleteProduct(int id) + { + var Product = await _authDbContext.Manufacturers.FindAsync(id); + if (Product == null) + { + return NotFound(new { success = false, message = "Product not found" }); + } + + _authDbContext.Manufacturers.Remove(Product); + await _authDbContext.SaveChangesAsync(); + + return Ok(new { success = true, message = "Product deleted successfully" }); + } + + #endregion Product } } diff --git a/Migrations/20241120071120_Initiate.Designer.cs b/Migrations/20241120071120_Initiate.Designer.cs deleted file mode 100644 index b66f76a..0000000 --- a/Migrations/20241120071120_Initiate.Designer.cs +++ /dev/null @@ -1,392 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PSTW_CentralSystem.DBContext; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - [DbContext(typeof(AuthDBContext))] - [Migration("20241120071120_Initiate")] - partial class Initiate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - - b.HasData( - new - { - UserId = 1, - RoleId = 1 - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => - { - b.Property("SettingId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); - - b.Property("AllowedUserType") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("MethodAllowedUserType") - .HasColumnType("json"); - - b.Property("ModuleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ModuleStatus") - .HasColumnType("int"); - - b.HasKey("SettingId"); - - b.ToTable("ModuleSettings"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - - b.HasData( - new - { - Id = 1, - Description = "Can access all pages", - Name = "SuperAdmin", - NormalizedName = "SUPERADMIN" - }, - new - { - Id = 2, - Description = "Can access some admin pages", - Name = "SystemAdmin", - NormalizedName = "SYSTEMADMIN" - }, - new - { - Id = 3, - Description = "Can access operation pages", - Name = "Engineer", - NormalizedName = "ENGINEER" - }, - new - { - Id = 4, - Description = "Can access data viewer pages", - Name = "Observer", - NormalizedName = "OBSERVER" - }); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("FullName") - .HasColumnType("longtext"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("UserStatus") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasData( - new - { - Id = 1, - AccessFailedCount = 0, - ConcurrencyStamp = "e4431078-c853-410b-8369-eba4c21937f0", - Email = "admin@pstw.com.my", - EmailConfirmed = true, - FullName = "MAAdmin", - LockoutEnabled = false, - NormalizedEmail = "ADMIN@PSTW.COM.MY", - NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAENdEN8F2O8D9gJofhSQV6UDhcjh2+C7TvjAC+KgJMUbFJbGBNXPvOORKISb0jRhftA==", - PhoneNumberConfirmed = false, - SecurityStamp = "bce6229e-4b74-4324-a89d-5f3210daccfb", - TwoFactorEnabled = false, - UserName = "admin@pstw.com.my" - }, - new - { - Id = 2, - AccessFailedCount = 0, - ConcurrencyStamp = "94504423-6916-4a9e-baf2-271beb3b3f2a", - Email = "sysadmin@pstw.com.my", - EmailConfirmed = true, - FullName = "SysAdmin", - LockoutEnabled = false, - NormalizedEmail = "SYSADMIN@PSTW.COM.MY", - NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEApFYVWK3qRpzEM6jFFw5EDohJ+xHCxX2EDABsUg65pa0iA1h54wp9yf/gp2qVxvVg==", - PhoneNumberConfirmed = false, - SecurityStamp = "0d07b058-1d11-40a9-875e-6631d26702cb", - TwoFactorEnabled = false, - UserName = "sysadmin@pstw.com.my" - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241122082905_addInventoryTable.Designer.cs b/Migrations/20241122082905_addInventoryTable.Designer.cs deleted file mode 100644 index c12b285..0000000 --- a/Migrations/20241122082905_addInventoryTable.Designer.cs +++ /dev/null @@ -1,392 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PSTW_CentralSystem.DBContext; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - [DbContext(typeof(AuthDBContext))] - [Migration("20241122082905_addInventoryTable")] - partial class addInventoryTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - - b.HasData( - new - { - UserId = 1, - RoleId = 1 - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => - { - b.Property("SettingId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); - - b.Property("AllowedUserType") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("MethodAllowedUserType") - .HasColumnType("json"); - - b.Property("ModuleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ModuleStatus") - .HasColumnType("int"); - - b.HasKey("SettingId"); - - b.ToTable("ModuleSettings"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - - b.HasData( - new - { - Id = 1, - Description = "Can access all pages", - Name = "SuperAdmin", - NormalizedName = "SUPERADMIN" - }, - new - { - Id = 2, - Description = "Can access some admin pages", - Name = "SystemAdmin", - NormalizedName = "SYSTEMADMIN" - }, - new - { - Id = 3, - Description = "Can access operation pages", - Name = "Engineer", - NormalizedName = "ENGINEER" - }, - new - { - Id = 4, - Description = "Can access data viewer pages", - Name = "Observer", - NormalizedName = "OBSERVER" - }); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("FullName") - .HasColumnType("longtext"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("UserStatus") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasData( - new - { - Id = 1, - AccessFailedCount = 0, - ConcurrencyStamp = "f79b6001-14b2-4a38-9053-260da45ada52", - Email = "admin@pstw.com.my", - EmailConfirmed = true, - FullName = "MAAdmin", - LockoutEnabled = false, - NormalizedEmail = "ADMIN@PSTW.COM.MY", - NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEOYjD3O+nyYU9Fk9q39d6tSeunezi9sWZCz4DbTkHsR6Dc7+FOkgYtFdC/SUbQY6qw==", - PhoneNumberConfirmed = false, - SecurityStamp = "7d64818d-d890-4c39-9bf9-f74c69fcfb1b", - TwoFactorEnabled = false, - UserName = "admin@pstw.com.my" - }, - new - { - Id = 2, - AccessFailedCount = 0, - ConcurrencyStamp = "bdf8a940-37e3-4c91-9f3e-c69d9aaea315", - Email = "sysadmin@pstw.com.my", - EmailConfirmed = true, - FullName = "SysAdmin", - LockoutEnabled = false, - NormalizedEmail = "SYSADMIN@PSTW.COM.MY", - NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEG8sIA+qY2dDrUrmX4jmFgKojC/X8pT9bv60D+yIy93/8vNy6qmRgLqebYjkZ1CjVw==", - PhoneNumberConfirmed = false, - SecurityStamp = "07ca3eae-b820-4219-b52f-7957244e272f", - TwoFactorEnabled = false, - UserName = "sysadmin@pstw.com.my" - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241122082905_addInventoryTable.cs b/Migrations/20241122082905_addInventoryTable.cs deleted file mode 100644 index 86208cf..0000000 --- a/Migrations/20241122082905_addInventoryTable.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - /// - public partial class addInventoryTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "f79b6001-14b2-4a38-9053-260da45ada52", "AQAAAAIAAYagAAAAEOYjD3O+nyYU9Fk9q39d6tSeunezi9sWZCz4DbTkHsR6Dc7+FOkgYtFdC/SUbQY6qw==", "7d64818d-d890-4c39-9bf9-f74c69fcfb1b" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "bdf8a940-37e3-4c91-9f3e-c69d9aaea315", "AQAAAAIAAYagAAAAEG8sIA+qY2dDrUrmX4jmFgKojC/X8pT9bv60D+yIy93/8vNy6qmRgLqebYjkZ1CjVw==", "07ca3eae-b820-4219-b52f-7957244e272f" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "e4431078-c853-410b-8369-eba4c21937f0", "AQAAAAIAAYagAAAAENdEN8F2O8D9gJofhSQV6UDhcjh2+C7TvjAC+KgJMUbFJbGBNXPvOORKISb0jRhftA==", "bce6229e-4b74-4324-a89d-5f3210daccfb" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "94504423-6916-4a9e-baf2-271beb3b3f2a", "AQAAAAIAAYagAAAAEApFYVWK3qRpzEM6jFFw5EDohJ+xHCxX2EDABsUg65pa0iA1h54wp9yf/gp2qVxvVg==", "0d07b058-1d11-40a9-875e-6631d26702cb" }); - } - } -} diff --git a/Migrations/20241125030825_UpdateInventory.Designer.cs b/Migrations/20241125030825_UpdateInventory.Designer.cs deleted file mode 100644 index a2add1e..0000000 --- a/Migrations/20241125030825_UpdateInventory.Designer.cs +++ /dev/null @@ -1,611 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PSTW_CentralSystem.DBContext; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - [DbContext(typeof(AuthDBContext))] - [Migration("20241125030825_UpdateInventory")] - partial class UpdateInventory - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - - b.HasData( - new - { - UserId = 1, - RoleId = 1 - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b => - { - b.Property("CompanyId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CompanyId"); - - b.ToTable("Companies"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("DepartmentId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Departments"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.Property("ItemID") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ConvertPrice") - .HasColumnType("float"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CurrencyRate") - .HasColumnType("float"); - - b.Property("DODate") - .HasColumnType("datetime(6)"); - - b.Property("Dept") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("EndWDate") - .HasColumnType("datetime(6)"); - - b.Property("ImageProduct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("InvoiceDate") - .HasColumnType("datetime(6)"); - - b.Property("PONo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PriceInRM") - .HasColumnType("float"); - - b.Property("ProductCategory") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProductName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PurchaseDate") - .HasColumnType("datetime(6)"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SerialNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Supplier") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Warranty") - .HasColumnType("int"); - - b.HasKey("ItemID"); - - b.HasIndex("CompanyId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("Category") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ImageProduct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Manufacturer") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ModelNo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProductName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("QuantityProduct") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierId")); - - b.Property("SupplierEmail") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierGender") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierPhoneNo") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierId"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => - { - b.Property("SettingId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); - - b.Property("AllowedUserType") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("MethodAllowedUserType") - .HasColumnType("json"); - - b.Property("ModuleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ModuleStatus") - .HasColumnType("int"); - - b.HasKey("SettingId"); - - b.ToTable("ModuleSettings"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - - b.HasData( - new - { - Id = 1, - Description = "Can access all pages", - Name = "SuperAdmin", - NormalizedName = "SUPERADMIN" - }, - new - { - Id = 2, - Description = "Can access some admin pages", - Name = "SystemAdmin", - NormalizedName = "SYSTEMADMIN" - }, - new - { - Id = 3, - Description = "Can access operation pages", - Name = "Engineer", - NormalizedName = "ENGINEER" - }, - new - { - Id = 4, - Description = "Can access data viewer pages", - Name = "Observer", - NormalizedName = "OBSERVER" - }); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("FullName") - .HasColumnType("longtext"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("UserStatus") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasData( - new - { - Id = 1, - AccessFailedCount = 0, - ConcurrencyStamp = "ca9d09a9-e64c-4e77-b4db-5f3a74347c2e", - Email = "admin@pstw.com.my", - EmailConfirmed = true, - FullName = "MAAdmin", - LockoutEnabled = false, - NormalizedEmail = "ADMIN@PSTW.COM.MY", - NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEE5O/c/d64bTFVIMdF4bXbFvJTX6o0Tfz5yMhUEHmWqKGGD+QR5awcQMkOxQrZiPyA==", - PhoneNumberConfirmed = false, - SecurityStamp = "2d5b2076-6914-4946-b8d1-58d8b1739a41", - TwoFactorEnabled = false, - UserName = "admin@pstw.com.my" - }, - new - { - Id = 2, - AccessFailedCount = 0, - ConcurrencyStamp = "29852249-ce04-40a3-b735-6aa3ec4d6fae", - Email = "sysadmin@pstw.com.my", - EmailConfirmed = true, - FullName = "SysAdmin", - LockoutEnabled = false, - NormalizedEmail = "SYSADMIN@PSTW.COM.MY", - NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEIxZLeIlI9khL2sAGbA9ueokgHFkd1IKX4bYRAm9vCnd0gHCPfo4SAra5ageTh7aOg==", - PhoneNumberConfirmed = false, - SecurityStamp = "889bcd81-6fec-42e5-ae31-77f759d3d88a", - TwoFactorEnabled = false, - UserName = "sysadmin@pstw.com.my" - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241125030825_UpdateInventory.cs b/Migrations/20241125030825_UpdateInventory.cs deleted file mode 100644 index dbcc980..0000000 --- a/Migrations/20241125030825_UpdateInventory.cs +++ /dev/null @@ -1,212 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - /// - public partial class UpdateInventory : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Companies", - columns: table => new - { - CompanyId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_Companies", x => x.CompanyId); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Suppliers", - columns: table => new - { - SupplierId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - SupplierName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SupplierGender = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SupplierEmail = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SupplierPhoneNo = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_Suppliers", x => x.SupplierId); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Departments", - columns: table => new - { - DepartmentId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - Name = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - CompanyId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Departments", x => x.DepartmentId); - table.ForeignKey( - name: "FK_Departments_Companies_CompanyId", - column: x => x.CompanyId, - principalTable: "Companies", - principalColumn: "CompanyId", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Items", - columns: table => new - { - ItemID = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - CompanyId = table.Column(type: "int", nullable: false), - Dept = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ProductName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ImageProduct = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ProductCategory = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - SerialNumber = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Quantity = table.Column(type: "int", nullable: false), - Supplier = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - PurchaseDate = table.Column(type: "datetime(6)", nullable: false), - PONo = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Currency = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - PriceInRM = table.Column(type: "float", nullable: false), - CurrencyRate = table.Column(type: "float", nullable: false), - ConvertPrice = table.Column(type: "float", nullable: false), - DODate = table.Column(type: "datetime(6)", nullable: false), - Warranty = table.Column(type: "int", nullable: false), - EndWDate = table.Column(type: "datetime(6)", nullable: false), - InvoiceDate = table.Column(type: "datetime(6)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Items", x => x.ItemID); - table.ForeignKey( - name: "FK_Items_Companies_CompanyId", - column: x => x.CompanyId, - principalTable: "Companies", - principalColumn: "CompanyId", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.CreateTable( - name: "Products", - columns: table => new - { - ProductId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ProductName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Manufacturer = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - Category = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - ModelNo = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - QuantityProduct = table.Column(type: "int", nullable: false), - ImageProduct = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"), - CompanyId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Products", x => x.ProductId); - table.ForeignKey( - name: "FK_Products_Companies_CompanyId", - column: x => x.CompanyId, - principalTable: "Companies", - principalColumn: "CompanyId", - onDelete: ReferentialAction.Cascade); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "ca9d09a9-e64c-4e77-b4db-5f3a74347c2e", "AQAAAAIAAYagAAAAEE5O/c/d64bTFVIMdF4bXbFvJTX6o0Tfz5yMhUEHmWqKGGD+QR5awcQMkOxQrZiPyA==", "2d5b2076-6914-4946-b8d1-58d8b1739a41" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "29852249-ce04-40a3-b735-6aa3ec4d6fae", "AQAAAAIAAYagAAAAEIxZLeIlI9khL2sAGbA9ueokgHFkd1IKX4bYRAm9vCnd0gHCPfo4SAra5ageTh7aOg==", "889bcd81-6fec-42e5-ae31-77f759d3d88a" }); - - migrationBuilder.CreateIndex( - name: "IX_Departments_CompanyId", - table: "Departments", - column: "CompanyId"); - - migrationBuilder.CreateIndex( - name: "IX_Items_CompanyId", - table: "Items", - column: "CompanyId"); - - migrationBuilder.CreateIndex( - name: "IX_Products_CompanyId", - table: "Products", - column: "CompanyId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Departments"); - - migrationBuilder.DropTable( - name: "Items"); - - migrationBuilder.DropTable( - name: "Products"); - - migrationBuilder.DropTable( - name: "Suppliers"); - - migrationBuilder.DropTable( - name: "Companies"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "f79b6001-14b2-4a38-9053-260da45ada52", "AQAAAAIAAYagAAAAEOYjD3O+nyYU9Fk9q39d6tSeunezi9sWZCz4DbTkHsR6Dc7+FOkgYtFdC/SUbQY6qw==", "7d64818d-d890-4c39-9bf9-f74c69fcfb1b" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "bdf8a940-37e3-4c91-9f3e-c69d9aaea315", "AQAAAAIAAYagAAAAEG8sIA+qY2dDrUrmX4jmFgKojC/X8pT9bv60D+yIy93/8vNy6qmRgLqebYjkZ1CjVw==", "07ca3eae-b820-4219-b52f-7957244e272f" }); - } - } -} diff --git a/Migrations/20241125040942_UpdateInventory2.Designer.cs b/Migrations/20241125040942_UpdateInventory2.Designer.cs deleted file mode 100644 index b1a1099..0000000 --- a/Migrations/20241125040942_UpdateInventory2.Designer.cs +++ /dev/null @@ -1,618 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PSTW_CentralSystem.DBContext; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - [DbContext(typeof(AuthDBContext))] - [Migration("20241125040942_UpdateInventory2")] - partial class UpdateInventory2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - - b.HasData( - new - { - UserId = 1, - RoleId = 1 - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b => - { - b.Property("CompanyId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CompanyId"); - - b.ToTable("Companies"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("DepartmentId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Departments"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.Property("ItemID") - .HasColumnType("varchar(255)"); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ConvertPrice") - .HasColumnType("float"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CurrencyRate") - .HasColumnType("float"); - - b.Property("DODate") - .HasColumnType("datetime(6)"); - - b.Property("DepartmentId") - .HasColumnType("int"); - - b.Property("EndWDate") - .HasColumnType("datetime(6)"); - - b.Property("InvoiceDate") - .HasColumnType("datetime(6)"); - - b.Property("PONo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PriceInRM") - .HasColumnType("float"); - - b.Property("ProductId") - .HasColumnType("int"); - - b.Property("PurchaseDate") - .HasColumnType("datetime(6)"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SerialNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Supplier") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Warranty") - .HasColumnType("int"); - - b.HasKey("ItemID"); - - b.HasIndex("CompanyId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("ProductId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("Category") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ImageProduct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Manufacturer") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ModelNo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProductName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("QuantityProduct") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierId")); - - b.Property("SupplierEmail") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierGender") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierPhoneNo") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierId"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => - { - b.Property("SettingId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); - - b.Property("AllowedUserType") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("MethodAllowedUserType") - .HasColumnType("json"); - - b.Property("ModuleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ModuleStatus") - .HasColumnType("int"); - - b.HasKey("SettingId"); - - b.ToTable("ModuleSettings"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - - b.HasData( - new - { - Id = 1, - Description = "Can access all pages", - Name = "SuperAdmin", - NormalizedName = "SUPERADMIN" - }, - new - { - Id = 2, - Description = "Can access some admin pages", - Name = "SystemAdmin", - NormalizedName = "SYSTEMADMIN" - }, - new - { - Id = 3, - Description = "Can access operation pages", - Name = "Engineer", - NormalizedName = "ENGINEER" - }, - new - { - Id = 4, - Description = "Can access data viewer pages", - Name = "Observer", - NormalizedName = "OBSERVER" - }); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("FullName") - .HasColumnType("longtext"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("UserStatus") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasData( - new - { - Id = 1, - AccessFailedCount = 0, - ConcurrencyStamp = "566de32b-8ac7-4fd9-9e16-d239fcf61f33", - Email = "admin@pstw.com.my", - EmailConfirmed = true, - FullName = "MAAdmin", - LockoutEnabled = false, - NormalizedEmail = "ADMIN@PSTW.COM.MY", - NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEOs61no/950C9+WFQRSQg3Wssko80bGYfLBvlMN7EOcKf4Dj9TUFLjqAiM4jc7JKqg==", - PhoneNumberConfirmed = false, - SecurityStamp = "25fbc2fb-3ac0-4a83-a4f4-4abbcf9d1942", - TwoFactorEnabled = false, - UserName = "admin@pstw.com.my" - }, - new - { - Id = 2, - AccessFailedCount = 0, - ConcurrencyStamp = "58495e52-8212-49a5-929a-04a759a1eaae", - Email = "sysadmin@pstw.com.my", - EmailConfirmed = true, - FullName = "SysAdmin", - LockoutEnabled = false, - NormalizedEmail = "SYSADMIN@PSTW.COM.MY", - NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEHI2wahcf8tCM2SlSfNPiluZtwp9QP2QOlom8Vc5L1FhbuZoex+1WlnhONaWtKHBZQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "be73a773-8c2d-4f23-9a79-cb5d106ac1d2", - TwoFactorEnabled = false, - UserName = "sysadmin@pstw.com.my" - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") - .WithMany() - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - - b.Navigation("Department"); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241125040942_UpdateInventory2.cs b/Migrations/20241125040942_UpdateInventory2.cs deleted file mode 100644 index b1e73df..0000000 --- a/Migrations/20241125040942_UpdateInventory2.cs +++ /dev/null @@ -1,175 +0,0 @@ -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - /// - public partial class UpdateInventory2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Dept", - table: "Items"); - - migrationBuilder.DropColumn( - name: "ImageProduct", - table: "Items"); - - migrationBuilder.DropColumn( - name: "ProductCategory", - table: "Items"); - - migrationBuilder.DropColumn( - name: "ProductName", - table: "Items"); - - migrationBuilder.AlterColumn( - name: "ItemID", - table: "Items", - type: "varchar(255)", - nullable: false, - oldClrType: typeof(int), - oldType: "int") - .Annotation("MySql:CharSet", "utf8mb4") - .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); - - migrationBuilder.AddColumn( - name: "DepartmentId", - table: "Items", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.AddColumn( - name: "ProductId", - table: "Items", - type: "int", - nullable: false, - defaultValue: 0); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "566de32b-8ac7-4fd9-9e16-d239fcf61f33", "AQAAAAIAAYagAAAAEOs61no/950C9+WFQRSQg3Wssko80bGYfLBvlMN7EOcKf4Dj9TUFLjqAiM4jc7JKqg==", "25fbc2fb-3ac0-4a83-a4f4-4abbcf9d1942" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "58495e52-8212-49a5-929a-04a759a1eaae", "AQAAAAIAAYagAAAAEHI2wahcf8tCM2SlSfNPiluZtwp9QP2QOlom8Vc5L1FhbuZoex+1WlnhONaWtKHBZQ==", "be73a773-8c2d-4f23-9a79-cb5d106ac1d2" }); - - migrationBuilder.CreateIndex( - name: "IX_Items_DepartmentId", - table: "Items", - column: "DepartmentId"); - - migrationBuilder.CreateIndex( - name: "IX_Items_ProductId", - table: "Items", - column: "ProductId"); - - migrationBuilder.AddForeignKey( - name: "FK_Items_Departments_DepartmentId", - table: "Items", - column: "DepartmentId", - principalTable: "Departments", - principalColumn: "DepartmentId", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_Items_Products_ProductId", - table: "Items", - column: "ProductId", - principalTable: "Products", - principalColumn: "ProductId", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Items_Departments_DepartmentId", - table: "Items"); - - migrationBuilder.DropForeignKey( - name: "FK_Items_Products_ProductId", - table: "Items"); - - migrationBuilder.DropIndex( - name: "IX_Items_DepartmentId", - table: "Items"); - - migrationBuilder.DropIndex( - name: "IX_Items_ProductId", - table: "Items"); - - migrationBuilder.DropColumn( - name: "DepartmentId", - table: "Items"); - - migrationBuilder.DropColumn( - name: "ProductId", - table: "Items"); - - migrationBuilder.AlterColumn( - name: "ItemID", - table: "Items", - type: "int", - nullable: false, - oldClrType: typeof(string), - oldType: "varchar(255)") - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) - .OldAnnotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "Dept", - table: "Items", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "ImageProduct", - table: "Items", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "ProductCategory", - table: "Items", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.AddColumn( - name: "ProductName", - table: "Items", - type: "longtext", - nullable: false) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "ca9d09a9-e64c-4e77-b4db-5f3a74347c2e", "AQAAAAIAAYagAAAAEE5O/c/d64bTFVIMdF4bXbFvJTX6o0Tfz5yMhUEHmWqKGGD+QR5awcQMkOxQrZiPyA==", "2d5b2076-6914-4946-b8d1-58d8b1739a41" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "29852249-ce04-40a3-b735-6aa3ec4d6fae", "AQAAAAIAAYagAAAAEIxZLeIlI9khL2sAGbA9ueokgHFkd1IKX4bYRAm9vCnd0gHCPfo4SAra5ageTh7aOg==", "889bcd81-6fec-42e5-ae31-77f759d3d88a" }); - } - } -} diff --git a/Migrations/20241125044629_AddManifacturerModel.Designer.cs b/Migrations/20241125044629_AddManifacturerModel.Designer.cs deleted file mode 100644 index c6dd105..0000000 --- a/Migrations/20241125044629_AddManifacturerModel.Designer.cs +++ /dev/null @@ -1,635 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PSTW_CentralSystem.DBContext; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - [DbContext(typeof(AuthDBContext))] - [Migration("20241125044629_AddManifacturerModel")] - partial class AddManifacturerModel - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - - b.HasData( - new - { - UserId = 1, - RoleId = 1 - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b => - { - b.Property("CompanyId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CompanyId"); - - b.ToTable("Companies"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("DepartmentId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Departments"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.Property("ItemID") - .HasColumnType("varchar(255)"); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ConvertPrice") - .HasColumnType("float"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CurrencyRate") - .HasColumnType("float"); - - b.Property("DODate") - .HasColumnType("datetime(6)"); - - b.Property("DepartmentId") - .HasColumnType("int"); - - b.Property("EndWDate") - .HasColumnType("datetime(6)"); - - b.Property("InvoiceDate") - .HasColumnType("datetime(6)"); - - b.Property("PONo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PriceInRM") - .HasColumnType("float"); - - b.Property("ProductId") - .HasColumnType("int"); - - b.Property("PurchaseDate") - .HasColumnType("datetime(6)"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SerialNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Supplier") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Warranty") - .HasColumnType("int"); - - b.HasKey("ItemID"); - - b.HasIndex("CompanyId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("ProductId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b => - { - b.Property("ManifacturerId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ManifacturerId")); - - b.Property("ManifacturerName") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("ManifacturerId"); - - b.ToTable("Manifacturers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("Category") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ImageProduct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Manufacturer") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ModelNo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProductName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("QuantityProduct") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierId")); - - b.Property("SupplierEmail") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierGender") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierPhoneNo") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierId"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => - { - b.Property("SettingId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); - - b.Property("AllowedUserType") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("MethodAllowedUserType") - .HasColumnType("json"); - - b.Property("ModuleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ModuleStatus") - .HasColumnType("int"); - - b.HasKey("SettingId"); - - b.ToTable("ModuleSettings"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - - b.HasData( - new - { - Id = 1, - Description = "Can access all pages", - Name = "SuperAdmin", - NormalizedName = "SUPERADMIN" - }, - new - { - Id = 2, - Description = "Can access some admin pages", - Name = "SystemAdmin", - NormalizedName = "SYSTEMADMIN" - }, - new - { - Id = 3, - Description = "Can access operation pages", - Name = "Engineer", - NormalizedName = "ENGINEER" - }, - new - { - Id = 4, - Description = "Can access data viewer pages", - Name = "Observer", - NormalizedName = "OBSERVER" - }); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("FullName") - .HasColumnType("longtext"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("UserStatus") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasData( - new - { - Id = 1, - AccessFailedCount = 0, - ConcurrencyStamp = "23e577cb-b26f-47e6-bd98-aa4e600a69cb", - Email = "admin@pstw.com.my", - EmailConfirmed = true, - FullName = "MAAdmin", - LockoutEnabled = false, - NormalizedEmail = "ADMIN@PSTW.COM.MY", - NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAELWRmCIfyew1rUthl5tw5zCupjCBpto6hwQFo63NWL69M7cp2d1SCy7yoUll1jQqkQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "e12db90e-efad-4d36-b0f8-af93b665dfb6", - TwoFactorEnabled = false, - UserName = "admin@pstw.com.my" - }, - new - { - Id = 2, - AccessFailedCount = 0, - ConcurrencyStamp = "ff24ec03-3b72-4b88-aa9a-a37f3141dd9c", - Email = "sysadmin@pstw.com.my", - EmailConfirmed = true, - FullName = "SysAdmin", - LockoutEnabled = false, - NormalizedEmail = "SYSADMIN@PSTW.COM.MY", - NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAENmNTZg8skbp+aJcr4tvdrPKnYmI+Hmgi0Ah/t5Jy35zKSHNX0Dhu0BBGXVLyTliSQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "b2365439-64e8-4ba3-a4e5-4043c0c4b0e0", - TwoFactorEnabled = false, - UserName = "sysadmin@pstw.com.my" - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") - .WithMany() - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - - b.Navigation("Department"); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241125044629_AddManifacturerModel.cs b/Migrations/20241125044629_AddManifacturerModel.cs deleted file mode 100644 index 35b7984..0000000 --- a/Migrations/20241125044629_AddManifacturerModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - /// - public partial class AddManifacturerModel : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Manifacturers", - columns: table => new - { - ManifacturerId = table.Column(type: "int", nullable: false) - .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), - ManifacturerName = table.Column(type: "longtext", nullable: false) - .Annotation("MySql:CharSet", "utf8mb4") - }, - constraints: table => - { - table.PrimaryKey("PK_Manifacturers", x => x.ManifacturerId); - }) - .Annotation("MySql:CharSet", "utf8mb4"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "23e577cb-b26f-47e6-bd98-aa4e600a69cb", "AQAAAAIAAYagAAAAELWRmCIfyew1rUthl5tw5zCupjCBpto6hwQFo63NWL69M7cp2d1SCy7yoUll1jQqkQ==", "e12db90e-efad-4d36-b0f8-af93b665dfb6" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "ff24ec03-3b72-4b88-aa9a-a37f3141dd9c", "AQAAAAIAAYagAAAAENmNTZg8skbp+aJcr4tvdrPKnYmI+Hmgi0Ah/t5Jy35zKSHNX0Dhu0BBGXVLyTliSQ==", "b2365439-64e8-4ba3-a4e5-4043c0c4b0e0" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Manifacturers"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "566de32b-8ac7-4fd9-9e16-d239fcf61f33", "AQAAAAIAAYagAAAAEOs61no/950C9+WFQRSQg3Wssko80bGYfLBvlMN7EOcKf4Dj9TUFLjqAiM4jc7JKqg==", "25fbc2fb-3ac0-4a83-a4f4-4abbcf9d1942" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "58495e52-8212-49a5-929a-04a759a1eaae", "AQAAAAIAAYagAAAAEHI2wahcf8tCM2SlSfNPiluZtwp9QP2QOlom8Vc5L1FhbuZoex+1WlnhONaWtKHBZQ==", "be73a773-8c2d-4f23-9a79-cb5d106ac1d2" }); - } - } -} diff --git a/Migrations/20241125051125_UpdateManifacturerModel.Designer.cs b/Migrations/20241125051125_UpdateManifacturerModel.Designer.cs deleted file mode 100644 index be60714..0000000 --- a/Migrations/20241125051125_UpdateManifacturerModel.Designer.cs +++ /dev/null @@ -1,635 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using PSTW_CentralSystem.DBContext; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - [DbContext(typeof(AuthDBContext))] - [Migration("20241125051125_UpdateManifacturerModel")] - partial class UpdateManifacturerModel - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 64); - - MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("longtext"); - - b.Property("ClaimValue") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("ProviderKey") - .HasColumnType("varchar(255)"); - - b.Property("ProviderDisplayName") - .HasColumnType("longtext"); - - b.Property("UserId") - .HasColumnType("int"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("RoleId") - .HasColumnType("int"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - - b.HasData( - new - { - UserId = 1, - RoleId = 1 - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("int"); - - b.Property("LoginProvider") - .HasColumnType("varchar(255)"); - - b.Property("Name") - .HasColumnType("varchar(255)"); - - b.Property("Value") - .HasColumnType("longtext"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b => - { - b.Property("CompanyId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId")); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("CompanyId"); - - b.ToTable("Companies"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.Property("DepartmentId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("DepartmentId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Departments"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.Property("ItemID") - .HasColumnType("varchar(255)"); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ConvertPrice") - .HasColumnType("float"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CurrencyRate") - .HasColumnType("float"); - - b.Property("DODate") - .HasColumnType("datetime(6)"); - - b.Property("DepartmentId") - .HasColumnType("int"); - - b.Property("EndWDate") - .HasColumnType("datetime(6)"); - - b.Property("InvoiceDate") - .HasColumnType("datetime(6)"); - - b.Property("PONo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("PriceInRM") - .HasColumnType("float"); - - b.Property("ProductId") - .HasColumnType("int"); - - b.Property("PurchaseDate") - .HasColumnType("datetime(6)"); - - b.Property("Quantity") - .HasColumnType("int"); - - b.Property("SerialNumber") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Supplier") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Warranty") - .HasColumnType("int"); - - b.HasKey("ItemID"); - - b.HasIndex("CompanyId"); - - b.HasIndex("DepartmentId"); - - b.HasIndex("ProductId"); - - b.ToTable("Items"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b => - { - b.Property("ManufacturesId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ManufacturesId")); - - b.Property("ManufacturesName") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("ManufacturesId"); - - b.ToTable("Manifacturers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.Property("ProductId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); - - b.Property("Category") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("CompanyId") - .HasColumnType("int"); - - b.Property("ImageProduct") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("Manufacturer") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ModelNo") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("ProductName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("QuantityProduct") - .HasColumnType("int"); - - b.HasKey("ProductId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b => - { - b.Property("SupplierId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierId")); - - b.Property("SupplierEmail") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierGender") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierName") - .IsRequired() - .HasColumnType("longtext"); - - b.Property("SupplierPhoneNo") - .IsRequired() - .HasColumnType("longtext"); - - b.HasKey("SupplierId"); - - b.ToTable("Suppliers"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => - { - b.Property("SettingId") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); - - b.Property("AllowedUserType") - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("MethodAllowedUserType") - .HasColumnType("json"); - - b.Property("ModuleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("varchar(50)"); - - b.Property("ModuleStatus") - .HasColumnType("int"); - - b.HasKey("SettingId"); - - b.ToTable("ModuleSettings"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Description") - .HasColumnType("longtext"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("AspNetRoles", (string)null); - - b.HasData( - new - { - Id = 1, - Description = "Can access all pages", - Name = "SuperAdmin", - NormalizedName = "SUPERADMIN" - }, - new - { - Id = 2, - Description = "Can access some admin pages", - Name = "SystemAdmin", - NormalizedName = "SYSTEMADMIN" - }, - new - { - Id = 3, - Description = "Can access operation pages", - Name = "Engineer", - NormalizedName = "ENGINEER" - }, - new - { - Id = 4, - Description = "Can access data viewer pages", - Name = "Observer", - NormalizedName = "OBSERVER" - }); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("longtext"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("FullName") - .HasColumnType("longtext"); - - b.Property("LockoutEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("LockoutEnd") - .HasColumnType("datetime(6)"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("longtext"); - - b.Property("PhoneNumber") - .HasColumnType("longtext"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("tinyint(1)"); - - b.Property("SecurityStamp") - .HasColumnType("longtext"); - - b.Property("TwoFactorEnabled") - .HasColumnType("tinyint(1)"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("varchar(256)"); - - b.Property("UserStatus") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("AspNetUsers", (string)null); - - b.HasData( - new - { - Id = 1, - AccessFailedCount = 0, - ConcurrencyStamp = "0b144c73-eac3-46ed-b04c-0109e958043c", - Email = "admin@pstw.com.my", - EmailConfirmed = true, - FullName = "MAAdmin", - LockoutEnabled = false, - NormalizedEmail = "ADMIN@PSTW.COM.MY", - NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAECyQRTu2SEHsnq6Qoyo4OEB8hwfTI97hruTOOWK6/DrCrOEH5th2DpYu2Bq7yUUEaQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "6b2ac3ea-069b-4064-a1e5-856e6d183681", - TwoFactorEnabled = false, - UserName = "admin@pstw.com.my" - }, - new - { - Id = 2, - AccessFailedCount = 0, - ConcurrencyStamp = "4f9d5d52-9123-4715-9453-08607b43fc68", - Email = "sysadmin@pstw.com.my", - EmailConfirmed = true, - FullName = "SysAdmin", - LockoutEnabled = false, - NormalizedEmail = "SYSADMIN@PSTW.COM.MY", - NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEHhYutnublAEWEf49O5TXjZpXptCyJdu5sD2wVoqRbEdn0COmIYlc5IKFTfCMuDRtQ==", - PhoneNumberConfirmed = false, - SecurityStamp = "314fdbc4-826d-4ee9-8296-a90bb6fe19f5", - TwoFactorEnabled = false, - UserName = "sysadmin@pstw.com.my" - }); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("PSTW_CentralSystem.Models.UserModel", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", "Department") - .WithMany() - .HasForeignKey("DepartmentId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") - .WithMany() - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - - b.Navigation("Department"); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => - { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Company"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Migrations/20241125051125_UpdateManifacturerModel.cs b/Migrations/20241125051125_UpdateManifacturerModel.cs deleted file mode 100644 index 45e2dfa..0000000 --- a/Migrations/20241125051125_UpdateManifacturerModel.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - /// - public partial class UpdateManifacturerModel : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ManifacturerName", - table: "Manifacturers", - newName: "ManufacturesName"); - - migrationBuilder.RenameColumn( - name: "ManifacturerId", - table: "Manifacturers", - newName: "ManufacturesId"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "0b144c73-eac3-46ed-b04c-0109e958043c", "AQAAAAIAAYagAAAAECyQRTu2SEHsnq6Qoyo4OEB8hwfTI97hruTOOWK6/DrCrOEH5th2DpYu2Bq7yUUEaQ==", "6b2ac3ea-069b-4064-a1e5-856e6d183681" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "4f9d5d52-9123-4715-9453-08607b43fc68", "AQAAAAIAAYagAAAAEHhYutnublAEWEf49O5TXjZpXptCyJdu5sD2wVoqRbEdn0COmIYlc5IKFTfCMuDRtQ==", "314fdbc4-826d-4ee9-8296-a90bb6fe19f5" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ManufacturesName", - table: "Manifacturers", - newName: "ManifacturerName"); - - migrationBuilder.RenameColumn( - name: "ManufacturesId", - table: "Manifacturers", - newName: "ManifacturerId"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "23e577cb-b26f-47e6-bd98-aa4e600a69cb", "AQAAAAIAAYagAAAAELWRmCIfyew1rUthl5tw5zCupjCBpto6hwQFo63NWL69M7cp2d1SCy7yoUll1jQqkQ==", "e12db90e-efad-4d36-b0f8-af93b665dfb6" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "ff24ec03-3b72-4b88-aa9a-a37f3141dd9c", "AQAAAAIAAYagAAAAENmNTZg8skbp+aJcr4tvdrPKnYmI+Hmgi0Ah/t5Jy35zKSHNX0Dhu0BBGXVLyTliSQ==", "b2365439-64e8-4ba3-a4e5-4043c0c4b0e0" }); - } - } -} diff --git a/Migrations/20241125051236_UpdateManifacturerModel2.cs b/Migrations/20241125051236_UpdateManifacturerModel2.cs deleted file mode 100644 index 8e8a48a..0000000 --- a/Migrations/20241125051236_UpdateManifacturerModel2.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace PSTW_CentralSystem.Migrations -{ - /// - public partial class UpdateManifacturerModel2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ManufacturesName", - table: "Manifacturers", - newName: "ManufacturerName"); - - migrationBuilder.RenameColumn( - name: "ManufacturesId", - table: "Manifacturers", - newName: "ManufacturerId"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "9ea0a171-7dcc-45a5-81a7-cfcfddbfd6e0", "AQAAAAIAAYagAAAAELSRntWl5rKnYA0TnNAC7qj54A7uRTevStsdc4WkfTXLZaNG1/J55Cl6laIR9kOR2g==", "a906bafd-1a37-41ec-9e08-0e6877a05dbb" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "daf3b4fc-8c91-4dbe-a01a-a7eb9a9200d3", "AQAAAAIAAYagAAAAEGRrzPnCkIDxBFOc9gMn+h/xYIdjN6rQZFMd0eSMfLk8n4u9AX6791Zzw/Q8UR5Xww==", "83dcb965-0f1d-4be3-ac42-e8476daca591" }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ManufacturerName", - table: "Manifacturers", - newName: "ManufacturesName"); - - migrationBuilder.RenameColumn( - name: "ManufacturerId", - table: "Manifacturers", - newName: "ManufacturesId"); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 1, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "0b144c73-eac3-46ed-b04c-0109e958043c", "AQAAAAIAAYagAAAAECyQRTu2SEHsnq6Qoyo4OEB8hwfTI97hruTOOWK6/DrCrOEH5th2DpYu2Bq7yUUEaQ==", "6b2ac3ea-069b-4064-a1e5-856e6d183681" }); - - migrationBuilder.UpdateData( - table: "AspNetUsers", - keyColumn: "Id", - keyValue: 2, - columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, - values: new object[] { "4f9d5d52-9123-4715-9453-08607b43fc68", "AQAAAAIAAYagAAAAEHhYutnublAEWEf49O5TXjZpXptCyJdu5sD2wVoqRbEdn0COmIYlc5IKFTfCMuDRtQ==", "314fdbc4-826d-4ee9-8296-a90bb6fe19f5" }); - } - } -} diff --git a/Migrations/20241125051236_UpdateManifacturerModel2.Designer.cs b/Migrations/20241126071458_Initiate.Designer.cs similarity index 95% rename from Migrations/20241125051236_UpdateManifacturerModel2.Designer.cs rename to Migrations/20241126071458_Initiate.Designer.cs index f99977f..feff262 100644 --- a/Migrations/20241125051236_UpdateManifacturerModel2.Designer.cs +++ b/Migrations/20241126071458_Initiate.Designer.cs @@ -12,8 +12,8 @@ using PSTW_CentralSystem.DBContext; namespace PSTW_CentralSystem.Migrations { [DbContext(typeof(AuthDBContext))] - [Migration("20241125051236_UpdateManifacturerModel2")] - partial class UpdateManifacturerModel2 + [Migration("20241126071458_Initiate")] + partial class Initiate { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -256,7 +256,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("ManufacturerId"); - b.ToTable("Manifacturers"); + b.ToTable("Manufacturers"); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => @@ -271,16 +271,12 @@ namespace PSTW_CentralSystem.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("CompanyId") - .HasColumnType("int"); - b.Property("ImageProduct") .IsRequired() .HasColumnType("longtext"); - b.Property("Manufacturer") - .IsRequired() - .HasColumnType("longtext"); + b.Property("ManufacturerId") + .HasColumnType("int"); b.Property("ModelNo") .IsRequired() @@ -295,7 +291,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("ProductId"); - b.HasIndex("CompanyId"); + b.HasIndex("ManufacturerId"); b.ToTable("Products"); }); @@ -498,16 +494,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 1, AccessFailedCount = 0, - ConcurrencyStamp = "9ea0a171-7dcc-45a5-81a7-cfcfddbfd6e0", + ConcurrencyStamp = "dde44c98-793e-452c-8123-5252dc03d655", Email = "admin@pstw.com.my", EmailConfirmed = true, FullName = "MAAdmin", LockoutEnabled = false, NormalizedEmail = "ADMIN@PSTW.COM.MY", NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAELSRntWl5rKnYA0TnNAC7qj54A7uRTevStsdc4WkfTXLZaNG1/J55Cl6laIR9kOR2g==", + PasswordHash = "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==", PhoneNumberConfirmed = false, - SecurityStamp = "a906bafd-1a37-41ec-9e08-0e6877a05dbb", + SecurityStamp = "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf", TwoFactorEnabled = false, UserName = "admin@pstw.com.my" }, @@ -515,16 +511,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 2, AccessFailedCount = 0, - ConcurrencyStamp = "daf3b4fc-8c91-4dbe-a01a-a7eb9a9200d3", + ConcurrencyStamp = "b529f4f9-3426-4a74-b048-d8995fe3e647", Email = "sysadmin@pstw.com.my", EmailConfirmed = true, FullName = "SysAdmin", LockoutEnabled = false, NormalizedEmail = "SYSADMIN@PSTW.COM.MY", NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEGRrzPnCkIDxBFOc9gMn+h/xYIdjN6rQZFMd0eSMfLk8n4u9AX6791Zzw/Q8UR5Xww==", + PasswordHash = "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==", PhoneNumberConfirmed = false, - SecurityStamp = "83dcb965-0f1d-4be3-ac42-e8476daca591", + SecurityStamp = "065ee938-093c-4816-ad28-f2e0831a7550", TwoFactorEnabled = false, UserName = "sysadmin@pstw.com.my" }); @@ -621,13 +617,13 @@ namespace PSTW_CentralSystem.Migrations modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer") .WithMany() - .HasForeignKey("CompanyId") + .HasForeignKey("ManufacturerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Company"); + b.Navigation("Manufacturer"); }); #pragma warning restore 612, 618 } diff --git a/Migrations/20241120071120_Initiate.cs b/Migrations/20241126071458_Initiate.cs similarity index 59% rename from Migrations/20241120071120_Initiate.cs rename to Migrations/20241126071458_Initiate.cs index 34123e7..c39f312 100644 --- a/Migrations/20241120071120_Initiate.cs +++ b/Migrations/20241126071458_Initiate.cs @@ -76,6 +76,36 @@ namespace PSTW_CentralSystem.Migrations }) .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( + name: "Companies", + columns: table => new + { + CompanyId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Companies", x => x.CompanyId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Manufacturers", + columns: table => new + { + ManufacturerId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ManufacturerName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Manufacturers", x => x.ManufacturerId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( name: "ModuleSettings", columns: table => new @@ -98,6 +128,27 @@ namespace PSTW_CentralSystem.Migrations }) .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( + name: "Suppliers", + columns: table => new + { + SupplierId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + SupplierName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplierGender = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplierEmail = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + SupplierPhoneNo = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Suppliers", x => x.SupplierId); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( name: "AspNetRoleClaims", columns: table => new @@ -219,6 +270,108 @@ namespace PSTW_CentralSystem.Migrations }) .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.CreateTable( + name: "Departments", + columns: table => new + { + DepartmentId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CompanyId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Departments", x => x.DepartmentId); + table.ForeignKey( + name: "FK_Departments_Companies_CompanyId", + column: x => x.CompanyId, + principalTable: "Companies", + principalColumn: "CompanyId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Products", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + ProductName = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ManufacturerId = table.Column(type: "int", nullable: false), + Category = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ModelNo = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + QuantityProduct = table.Column(type: "int", nullable: false), + ImageProduct = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_Products", x => x.ProductId); + table.ForeignKey( + name: "FK_Products_Manufacturers_ManufacturerId", + column: x => x.ManufacturerId, + principalTable: "Manufacturers", + principalColumn: "ManufacturerId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "Items", + columns: table => new + { + ItemID = table.Column(type: "varchar(255)", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + CompanyId = table.Column(type: "int", nullable: false), + DepartmentId = table.Column(type: "int", nullable: false), + ProductId = table.Column(type: "int", nullable: false), + SerialNumber = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Quantity = table.Column(type: "int", nullable: false), + Supplier = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PurchaseDate = table.Column(type: "datetime(6)", nullable: false), + PONo = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + Currency = table.Column(type: "longtext", nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + PriceInRM = table.Column(type: "float", nullable: false), + CurrencyRate = table.Column(type: "float", nullable: false), + ConvertPrice = table.Column(type: "float", nullable: false), + DODate = table.Column(type: "datetime(6)", nullable: false), + Warranty = table.Column(type: "int", nullable: false), + EndWDate = table.Column(type: "datetime(6)", nullable: false), + InvoiceDate = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Items", x => x.ItemID); + table.ForeignKey( + name: "FK_Items_Companies_CompanyId", + column: x => x.CompanyId, + principalTable: "Companies", + principalColumn: "CompanyId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Items_Departments_DepartmentId", + column: x => x.DepartmentId, + principalTable: "Departments", + principalColumn: "DepartmentId", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Items_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "ProductId", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + migrationBuilder.InsertData( table: "AspNetRoles", columns: new[] { "Id", "ConcurrencyStamp", "Description", "Name", "NormalizedName" }, @@ -235,8 +388,8 @@ namespace PSTW_CentralSystem.Migrations columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName", "UserStatus" }, values: new object[,] { - { 1, 0, "e4431078-c853-410b-8369-eba4c21937f0", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAENdEN8F2O8D9gJofhSQV6UDhcjh2+C7TvjAC+KgJMUbFJbGBNXPvOORKISb0jRhftA==", null, false, "bce6229e-4b74-4324-a89d-5f3210daccfb", false, "admin@pstw.com.my", null }, - { 2, 0, "94504423-6916-4a9e-baf2-271beb3b3f2a", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEApFYVWK3qRpzEM6jFFw5EDohJ+xHCxX2EDABsUg65pa0iA1h54wp9yf/gp2qVxvVg==", null, false, "0d07b058-1d11-40a9-875e-6631d26702cb", false, "sysadmin@pstw.com.my", null } + { 1, 0, "dde44c98-793e-452c-8123-5252dc03d655", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==", null, false, "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf", false, "admin@pstw.com.my", null }, + { 2, 0, "b529f4f9-3426-4a74-b048-d8995fe3e647", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==", null, false, "065ee938-093c-4816-ad28-f2e0831a7550", false, "sysadmin@pstw.com.my", null } }); migrationBuilder.InsertData( @@ -280,6 +433,31 @@ namespace PSTW_CentralSystem.Migrations table: "AspNetUsers", column: "NormalizedUserName", unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Departments_CompanyId", + table: "Departments", + column: "CompanyId"); + + migrationBuilder.CreateIndex( + name: "IX_Items_CompanyId", + table: "Items", + column: "CompanyId"); + + migrationBuilder.CreateIndex( + name: "IX_Items_DepartmentId", + table: "Items", + column: "DepartmentId"); + + migrationBuilder.CreateIndex( + name: "IX_Items_ProductId", + table: "Items", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_ManufacturerId", + table: "Products", + column: "ManufacturerId"); } /// @@ -300,14 +478,32 @@ namespace PSTW_CentralSystem.Migrations migrationBuilder.DropTable( name: "AspNetUserTokens"); + migrationBuilder.DropTable( + name: "Items"); + migrationBuilder.DropTable( name: "ModuleSettings"); + migrationBuilder.DropTable( + name: "Suppliers"); + migrationBuilder.DropTable( name: "AspNetRoles"); migrationBuilder.DropTable( name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "Departments"); + + migrationBuilder.DropTable( + name: "Products"); + + migrationBuilder.DropTable( + name: "Companies"); + + migrationBuilder.DropTable( + name: "Manufacturers"); } } } diff --git a/Migrations/AuthDBContextModelSnapshot.cs b/Migrations/AuthDBContextModelSnapshot.cs index 14dbf99..8990bb0 100644 --- a/Migrations/AuthDBContextModelSnapshot.cs +++ b/Migrations/AuthDBContextModelSnapshot.cs @@ -253,7 +253,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("ManufacturerId"); - b.ToTable("Manifacturers"); + b.ToTable("Manufacturers"); }); modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => @@ -268,16 +268,12 @@ namespace PSTW_CentralSystem.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("CompanyId") - .HasColumnType("int"); - b.Property("ImageProduct") .IsRequired() .HasColumnType("longtext"); - b.Property("Manufacturer") - .IsRequired() - .HasColumnType("longtext"); + b.Property("ManufacturerId") + .HasColumnType("int"); b.Property("ModelNo") .IsRequired() @@ -292,7 +288,7 @@ namespace PSTW_CentralSystem.Migrations b.HasKey("ProductId"); - b.HasIndex("CompanyId"); + b.HasIndex("ManufacturerId"); b.ToTable("Products"); }); @@ -495,16 +491,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 1, AccessFailedCount = 0, - ConcurrencyStamp = "9ea0a171-7dcc-45a5-81a7-cfcfddbfd6e0", + ConcurrencyStamp = "dde44c98-793e-452c-8123-5252dc03d655", Email = "admin@pstw.com.my", EmailConfirmed = true, FullName = "MAAdmin", LockoutEnabled = false, NormalizedEmail = "ADMIN@PSTW.COM.MY", NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAELSRntWl5rKnYA0TnNAC7qj54A7uRTevStsdc4WkfTXLZaNG1/J55Cl6laIR9kOR2g==", + PasswordHash = "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==", PhoneNumberConfirmed = false, - SecurityStamp = "a906bafd-1a37-41ec-9e08-0e6877a05dbb", + SecurityStamp = "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf", TwoFactorEnabled = false, UserName = "admin@pstw.com.my" }, @@ -512,16 +508,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 2, AccessFailedCount = 0, - ConcurrencyStamp = "daf3b4fc-8c91-4dbe-a01a-a7eb9a9200d3", + ConcurrencyStamp = "b529f4f9-3426-4a74-b048-d8995fe3e647", Email = "sysadmin@pstw.com.my", EmailConfirmed = true, FullName = "SysAdmin", LockoutEnabled = false, NormalizedEmail = "SYSADMIN@PSTW.COM.MY", NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEGRrzPnCkIDxBFOc9gMn+h/xYIdjN6rQZFMd0eSMfLk8n4u9AX6791Zzw/Q8UR5Xww==", + PasswordHash = "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==", PhoneNumberConfirmed = false, - SecurityStamp = "83dcb965-0f1d-4be3-ac42-e8476daca591", + SecurityStamp = "065ee938-093c-4816-ad28-f2e0831a7550", TwoFactorEnabled = false, UserName = "sysadmin@pstw.com.my" }); @@ -618,13 +614,13 @@ namespace PSTW_CentralSystem.Migrations modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => { - b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer") .WithMany() - .HasForeignKey("CompanyId") + .HasForeignKey("ManufacturerId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.Navigation("Company"); + b.Navigation("Manufacturer"); }); #pragma warning restore 612, 618 } diff --git a/PSTW_CentralSystem.csproj b/PSTW_CentralSystem.csproj index af4e93f..4a74941 100644 --- a/PSTW_CentralSystem.csproj +++ b/PSTW_CentralSystem.csproj @@ -30,6 +30,7 @@ + diff --git a/wwwroot/Media/Inventory/Images/YSISonde1 b/wwwroot/Media/Inventory/Images/YSISonde1 new file mode 100644 index 0000000..a415a60 Binary files /dev/null and b/wwwroot/Media/Inventory/Images/YSISonde1 differ