Compare commits
No commits in common. "907a171616446b950c4d705e03eef6736d8bac35" and "391a359a9f2152d65dd0a0a0c4bb180ce435145b" have entirely different histories.
907a171616
...
391a359a9f
@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PSTW_CentralSystem.Models
|
||||
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
{
|
||||
public class CompanyModel
|
||||
{
|
||||
@ -1,14 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace PSTW_CentralSystem.Models
|
||||
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
{
|
||||
public class DepartmentModel
|
||||
{
|
||||
[Key]
|
||||
public int DepartmentId { get; set; }
|
||||
public required string DepartmentName { get; set; }
|
||||
public required string DepartmentCode { get; set; }
|
||||
public required int CompanyId { get; set; }
|
||||
|
||||
[ForeignKey("CompanyId")]
|
||||
@ -1,8 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PSTW_CentralSystem.Models;
|
||||
|
||||
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
{
|
||||
@ -15,7 +12,6 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
public required int DepartmentId { get; set; }
|
||||
public required int ProductId { get; set; }
|
||||
public required string? SerialNumber { get; set; }
|
||||
public required string? TeamType { get; set; }
|
||||
public required int Quantity { get; set; }
|
||||
public required string Supplier { get; set; }
|
||||
public required DateTime PurchaseDate { get; set; }
|
||||
@ -24,18 +20,10 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
public required float PriceInRM { get; set; }
|
||||
public required float CurrencyRate { get; set; }
|
||||
public required float ConvertPrice { get; set; }
|
||||
public string? DONo { get; set; }
|
||||
public DateTime? DODate { get; set; }
|
||||
public required DateTime DODate { get; set; }
|
||||
public required int Warranty { get; set; }
|
||||
public required DateTime EndWDate { get; set; }
|
||||
public string? InvoiceNo { get; set; }
|
||||
public DateTime? InvoiceDate { get; set; }
|
||||
[Comment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;")]
|
||||
public int ItemStatus { get; set; } = 1;
|
||||
public string ItemLocation { get; set; } = string.Empty;
|
||||
public int CreatedByUserId { get; set; }
|
||||
[ForeignKey("CreatedByUserId")]
|
||||
public virtual UserModel? CreatedBy { get; set; }
|
||||
public required DateTime InvoiceDate { get; set; }
|
||||
[ForeignKey("CompanyId")]
|
||||
public virtual CompanyModel? Company { get; set; }
|
||||
[ForeignKey("DepartmentId")]
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||
{
|
||||
public class StoreModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@
|
||||
@{
|
||||
ViewData["Title"] = "Item Form";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
|
||||
}
|
||||
<style>
|
||||
.table td img {
|
||||
@ -65,7 +66,7 @@
|
||||
<label class="col-sm-4 col-form-label">Company:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="dropdown">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedCompany" required>
|
||||
<select class="btn btn-primary dropdown-toggle" v-model="selectedCompany" required>
|
||||
<option class="btn-light" value="" disabled selected>Select Company</option>
|
||||
<option class="btn-light" v-for="(item, index) in companies" :key="index" :value="item.companyId">{{item.companyName}}</option>
|
||||
</select>
|
||||
@ -77,31 +78,20 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Department:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedDepartment" required>
|
||||
<select class="btn btn-primary dropdown-toggle" v-model="selectedDepartment" required>
|
||||
<option class="btn-light" value="" disabled selected>Select Department</option>
|
||||
<option class="btn-light" v-for="(dept, index) in filteredDepartments" :key="index" :value="dept.departmentId">{{ dept.departmentName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TeamType Dropdown -->
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Team:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="teamType" required>
|
||||
<option class="btn-light" value="" disabled selected>Select Team</option>
|
||||
<option class="btn-light" v-for="(team, index) in teamTypes" :key="index" :value="team">{{ team }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@* Product Name Coding *@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Product Name:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="dropdown">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedProduct" required>
|
||||
<select class="btn btn-primary dropdown-toggle" v-model="selectedProduct" required>
|
||||
<option class="btn-light" value="" disabled selected>Select Product</option>
|
||||
<option class="btn-light" v-for="(item, index) in products" :key="index" :value="item.productId">{{ item.productName + ' (' + item.modelNo + ')' }}</option>
|
||||
</select>
|
||||
@ -174,7 +164,7 @@
|
||||
<label class="col-sm-4 col-form-label">Supplier: </label>
|
||||
<div class="col-sm-8">
|
||||
<div class="dropdown">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" data-toggle="dropdown" aria-expanded="false" v-model="selectedSupplier" required>
|
||||
<select class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false" v-model="selectedSupplier" required>
|
||||
<option class="btn-light" value="" disabled selected>Select Supplier</option>
|
||||
<option class="btn-light" v-for="(item, index) in suppliers">{{ item.supplierName }}</option>
|
||||
</select>
|
||||
@ -202,9 +192,9 @@
|
||||
<div class="col-md-6">
|
||||
@* Item Price in RM *@
|
||||
<div class="form-group row">
|
||||
<label for="priceInRM" class="col-sm-4">Default Item Price:</label>
|
||||
<label for="priceInRM" class="col-sm-4">Item Price In(RM):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" id="priceInRM" name="priceInRM" class="form-control" placeholder="RM 00.00" step="0.01" min="0.01" v-on:input="convertCurrency()" required v-model="priceInRM">
|
||||
<input type="number" id="priceInRM" name="priceInRM" class="form-control" placeholder="RM 00.00" step="0.01" v-on:input="convertCurrency()" required v-model="priceInRM">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -212,9 +202,9 @@
|
||||
<div class="form-group row">
|
||||
<label for="currency" class="col-sm-4">Select Currency:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="currency" name="currency" class="btn btn-primary form-control col-md-10" v-model="currency" v-on:change="convertCurrency()">
|
||||
<option class="btn-light" value="" disabled selected>Select a currency</option>
|
||||
<option class="btn-light" v-for="(name, code) in currencies" :key="code" :value="code">
|
||||
<select id="currency" name="currency" class="form-control" v-model="currency" v-on:change="convertCurrency()">
|
||||
<option value="" disabled selected>Select a currency</option>
|
||||
<option v-for="(name, code) in currencies" :key="code" :value="code">
|
||||
{{ code }} - {{ name }}
|
||||
</option>
|
||||
</select>
|
||||
@ -225,7 +215,7 @@
|
||||
<div class="form-group row">
|
||||
<label for="currencyRate" class="col-sm-4">Currency Rate(%):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" id="currencyRate" name="currencyRate" class="form-control" placeholder="0.01" step="0.01" min="1" v-on:input="convertCurrency()" required v-model="currencyRate">
|
||||
<input type="number" id="currencyRate" name="currencyRate" class="form-control" placeholder="0.01%" step="0.01" v-on:input="convertCurrency()" required v-model="currencyRate">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -237,25 +227,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Delivery Order Number *@
|
||||
<div class="form-group row">
|
||||
<label for="DONo" class="col-sm-4">Enter DO Number:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" id="DONo" name="DONo" class="form-control" v-model="DONo" placeholder="DO123456">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Delivery Order Date *@
|
||||
<div class="form-group row">
|
||||
<label for="DODate" class="col-sm-4">Enter DO Date:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="date" id="DODate" name="DODate" class="form-control" v-on:input="calculateWarrantyEndDate()" v-model="DODate">
|
||||
<input type="date" id="DODate" name="DODate" class="form-control" v-on:input="calculateWarrantyEndDate()" required v-model="DODate">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Warranty *@
|
||||
<div class="form-group row">
|
||||
<label for="warranty" class="col-sm-4">Enter Warranty (Months):</label>
|
||||
<label for="warranty" class="col-sm-4">Enter Warranty Months(Number):</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" id="warranty" name="warranty" class="form-control" placeholder="0 , 1 , 2 , 3, ..." step="1" min="0" v-on:input="calculateWarrantyEndDate()" required v-model="warranty">
|
||||
</div>
|
||||
@ -269,19 +251,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Invoice Number *@
|
||||
<div class="form-group row">
|
||||
<label for="invoiceNo" class="col-sm-4">Invoice Number:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" id="invoiceNo" name="invoiceNo" class="form-control" v-model="invoiceNo" placeholder="Invoice123456">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@* Invoice Date *@
|
||||
<div class="form-group row">
|
||||
<label for="invoiceDate" class="col-sm-4">Invoice Date:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="date" id="invoiceDate" name="invoiceDate" class="form-control" v-model="invoiceDate">
|
||||
<input type="date" id="invoiceDate" name="invoiceDate" class="form-control" required v-model="invoiceDate">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -344,8 +318,6 @@
|
||||
],
|
||||
company: "",
|
||||
Dept: null,
|
||||
teamTypes: ["Continuous", "Manual"],
|
||||
teamType: "",
|
||||
productName: null,
|
||||
imageProduct: null,
|
||||
productCategory: null,
|
||||
@ -354,15 +326,13 @@
|
||||
supplierName: null,
|
||||
purchaseDate: null,
|
||||
PO: null,
|
||||
currency: "MYR",
|
||||
priceInRM: 0.01,
|
||||
currency: null,
|
||||
priceInRM: null,
|
||||
currencyRate: 1,
|
||||
convertPrice: 0,
|
||||
DONo:null,
|
||||
DODate: null,
|
||||
warranty: 0,
|
||||
EndWDate: null,
|
||||
invoiceNo: null,
|
||||
invoiceDate: null,
|
||||
products: [],
|
||||
depts: [],
|
||||
@ -386,8 +356,6 @@
|
||||
loading: false,
|
||||
thisQR: null,
|
||||
items: [],
|
||||
currentUser: null,
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {// Log the token to check its value
|
||||
@ -398,7 +366,6 @@
|
||||
this.fetchCompanies();
|
||||
this.fetchProducts();
|
||||
this.fetchSuppliers();
|
||||
this.fetchUser();
|
||||
},
|
||||
computed: {
|
||||
filteredDepartments() {
|
||||
@ -440,8 +407,7 @@
|
||||
DODate: this.DODate,
|
||||
Warranty: this.warranty,
|
||||
EndWDate: this.EndWDate,
|
||||
InvoiceDate: this.invoiceDate,
|
||||
CreatedByUserId: this.currentUser,
|
||||
InvoiceDate: this.invoiceDate
|
||||
};
|
||||
|
||||
try {
|
||||
@ -725,12 +691,12 @@
|
||||
//----------------------//
|
||||
//Calculate Total Price
|
||||
convertCurrency() {
|
||||
const total = this.priceInRM * this.currencyRate;
|
||||
const total = this.priceInRM / this.currencyRate;
|
||||
this.convertPrice = total.toFixed(2);
|
||||
this.priceInRM = this.priceInRM
|
||||
// .replace(/[^0-9.]/g, '') // Remove non-numeric characters except decimal points
|
||||
// .replace(/(\..*)\..*/g, '$1') // Allow only one decimal point
|
||||
// .replace(/^(\d*\.\d{0,2})\d*$/, '$1'); // Limit to two decimal places
|
||||
.replace(/[^0-9.]/g, '') // Remove non-numeric characters except decimal points
|
||||
.replace(/(\..*)\..*/g, '$1') // Allow only one decimal point
|
||||
.replace(/^(\d*\.\d{0,2})\d*$/, '$1'); // Limit to two decimal places
|
||||
|
||||
},
|
||||
calculateWarrantyEndDate() {
|
||||
@ -826,23 +792,6 @@
|
||||
alert("An error occurred while generating the QR code.");
|
||||
}
|
||||
},
|
||||
async fetchUser() {
|
||||
try {
|
||||
const response = await fetch(`/IdentityAPI/GetUserInformation/`, {
|
||||
method: 'POST',
|
||||
});
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
this.currentUser = data?.UserInfo || null;
|
||||
}
|
||||
else {
|
||||
console.error(`Failed to fetch user: ${response.statusText}`);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Product Form";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
string userId = ViewBag.UserId;
|
||||
}
|
||||
|
||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PSTW_CentralSystem.DBContext;
|
||||
using PSTW_CentralSystem.Models;
|
||||
using System.Reflection;
|
||||
|
||||
namespace PSTW_CentralSystem.Controllers.API
|
||||
@ -13,14 +10,12 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
public class AdminAPI : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
private readonly UserManager<UserModel> _userManager;
|
||||
private readonly AuthDBContext _authDbContext;
|
||||
|
||||
public AdminAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext, UserManager<UserModel> userManager)
|
||||
public AdminAPI(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_authDbContext = authDbContext;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
[HttpPost("GetClassAndMethodInformation")]
|
||||
@ -50,7 +45,6 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
// Return the list as JSON
|
||||
return Json(controllerAndMethodList);
|
||||
}
|
||||
|
||||
[HttpPost("GetListClassAndMethodInformation")]
|
||||
public async Task<IActionResult> GetListClassAndMethodInformation()
|
||||
{
|
||||
@ -79,44 +73,6 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
// Return the list as JSON
|
||||
return Json(controllerAndMethodList);
|
||||
}
|
||||
[HttpPost("GetUserList")]
|
||||
public async Task<IActionResult> GetUserList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var user = await _userManager.GetUserAsync(User);
|
||||
|
||||
var userRole = await _userManager.GetRolesAsync(user??new UserModel());
|
||||
List<UserModel> userInfo = new List<UserModel>();
|
||||
|
||||
if (userRole == null || userRole.Count == 0)
|
||||
{
|
||||
// Fetch all users excluding those with roles SuperAdmin or SystemAdmin
|
||||
var allUsers = await _authDbContext.Users
|
||||
.Include(u => u.Department)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var u in allUsers)
|
||||
{
|
||||
var roles = await _userManager.GetRolesAsync(u);
|
||||
if (!roles.Contains("SuperAdmin") && !roles.Contains("SystemAdmin"))
|
||||
{
|
||||
userInfo.Add(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
userInfo = await _authDbContext.Users.Include(u => u.Department).ToListAsync();
|
||||
}
|
||||
|
||||
return Ok(new { UserInfo = userInfo });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"An error occurred: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,57 +0,0 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PSTW_CentralSystem.DBContext;
|
||||
using PSTW_CentralSystem.Models;
|
||||
namespace PSTW_CentralSystem.Controllers.API
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
|
||||
public class IdentityAPI : ControllerBase
|
||||
{
|
||||
private readonly ILogger<IdentityAPI> _logger;
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
private readonly UserManager<UserModel> _userManager;
|
||||
|
||||
public IdentityAPI(ILogger<IdentityAPI> logger, IdentityDBContext authDbContext, UserManager<UserModel> userManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_authDbContext = authDbContext;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
[HttpPost("GetUserInformation/")]
|
||||
public async Task<IActionResult> GetUserInformation()
|
||||
{
|
||||
try
|
||||
{
|
||||
var user = await _userManager.GetUserAsync(User);
|
||||
var userRole = await _userManager.GetRolesAsync(user!);
|
||||
if (user == null)
|
||||
{
|
||||
return NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
|
||||
}
|
||||
|
||||
var userInfo = await _authDbContext.Users.Include(u => u.Department).Select(u => new
|
||||
{
|
||||
u.Id,
|
||||
u.NormalizedEmail,
|
||||
u.Department,
|
||||
userRole,
|
||||
}).Where(u => u.Id == user.Id).FirstOrDefaultAsync();
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
return NotFound("User not found");
|
||||
}
|
||||
|
||||
return Ok(new { UserInfo = userInfo });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"An error occurred: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -18,14 +18,12 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
public class InvMainAPI : Controller
|
||||
{
|
||||
private readonly ILogger<InvMainAPI> _logger;
|
||||
private readonly IdentityDBContext _identityDbContext;
|
||||
private readonly InventoryDBContext _inventoryDbContext;
|
||||
private readonly AuthDBContext _authDbContext;
|
||||
|
||||
public InvMainAPI(ILogger<InvMainAPI> logger, IdentityDBContext authDbContext, InventoryDBContext inventoryDbContext)
|
||||
public InvMainAPI(ILogger<InvMainAPI> logger, AuthDBContext authDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_identityDbContext = authDbContext;
|
||||
_inventoryDbContext = inventoryDbContext;
|
||||
_authDbContext = authDbContext;
|
||||
}
|
||||
|
||||
public class DepartmentCompany
|
||||
@ -38,8 +36,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
|
||||
public async Task<List<DepartmentCompany>> GetDepartmentWithCompanyList()
|
||||
{
|
||||
var departmentList = await _identityDbContext.Departments.ToListAsync();
|
||||
var companyList = await _identityDbContext.Companies.ToListAsync();
|
||||
var departmentList = await _authDbContext.Departments.ToListAsync();
|
||||
var companyList = await _authDbContext.Companies.ToListAsync();
|
||||
|
||||
// Create a new list to store departments with their company name
|
||||
var departmentWithCompanyList = departmentList.Select(department => new DepartmentCompany
|
||||
@ -55,13 +53,13 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
}
|
||||
public async Task<DepartmentCompany> GetDepartmentWithCompany(int companyId, int departmentId)
|
||||
{
|
||||
var departmentList = await _identityDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
||||
var companyList = await _identityDbContext.Companies.FirstOrDefaultAsync(c => c.CompanyId == companyId);
|
||||
var departmentList = await _authDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
||||
var companyList = await _authDbContext.Companies.FirstOrDefaultAsync(c => c.CompanyId == companyId);
|
||||
|
||||
// Create a new list to store departments with their company name
|
||||
var departmentWithCompany = new DepartmentCompany
|
||||
{
|
||||
DepartmentId = departmentList!.DepartmentId,
|
||||
DepartmentId = departmentList.DepartmentId,
|
||||
DepartmentName = departmentList.DepartmentName,
|
||||
CompanyId = departmentList.CompanyId,
|
||||
CompanyName = companyList?.CompanyName
|
||||
@ -76,7 +74,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("ManufacturerList")]
|
||||
public async Task<IActionResult> ManufacturerList()
|
||||
{
|
||||
var manifacturerList = await _inventoryDbContext.Manufacturers.ToListAsync();
|
||||
var manifacturerList = await _authDbContext.Manufacturers.ToListAsync();
|
||||
return Json(manifacturerList);
|
||||
}
|
||||
|
||||
@ -94,12 +92,12 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
|
||||
try
|
||||
{
|
||||
_inventoryDbContext.Manufacturers.Add(new ManufacturerModel
|
||||
_authDbContext.Manufacturers.Add(new ManufacturerModel
|
||||
{
|
||||
ManufacturerName = manufacturer.ManufacturerName,
|
||||
});
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
var updatedList = await _inventoryDbContext.Manufacturers.ToListAsync();
|
||||
await _authDbContext.SaveChangesAsync();
|
||||
var updatedList = await _authDbContext.Manufacturers.ToListAsync();
|
||||
return Json(updatedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -111,14 +109,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpDelete("DeleteManufacturer/{id}")]
|
||||
public async Task<IActionResult> DeleteManufacturer(int id)
|
||||
{
|
||||
var manufacturer = await _inventoryDbContext.Manufacturers.FindAsync(id);
|
||||
var manufacturer = await _authDbContext.Manufacturers.FindAsync(id);
|
||||
if (manufacturer == null)
|
||||
{
|
||||
return NotFound(new { success = false, message = "Manufacturer not found" });
|
||||
}
|
||||
|
||||
_inventoryDbContext.Manufacturers.Remove(manufacturer);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_authDbContext.Manufacturers.Remove(manufacturer);
|
||||
await _authDbContext.SaveChangesAsync();
|
||||
|
||||
return Ok(new { success = true, message = "Manufacturer deleted successfully" });
|
||||
}
|
||||
@ -130,14 +128,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("ProductList")]
|
||||
public async Task<IActionResult> ProductList()
|
||||
{
|
||||
var productList = await _inventoryDbContext.Products.Include("Manufacturer").ToListAsync();
|
||||
var productList = await _authDbContext.Products.Include("Manufacturer").ToListAsync();
|
||||
return Json(productList);
|
||||
}
|
||||
|
||||
[HttpPost("ProductListWithItem")]
|
||||
public async Task<IActionResult> ProductListWithItem()
|
||||
{
|
||||
var productList = await _inventoryDbContext.Products
|
||||
var productList = await _authDbContext.Products
|
||||
.Include(p => p.Items) // Include related items
|
||||
.Include(p => p.Manufacturer) // Include related manufacturer
|
||||
.ToListAsync();
|
||||
@ -169,9 +167,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
await System.IO.File.WriteAllBytesAsync(filePath, bytes);
|
||||
product.ImageProduct = "/media/inventory/images/" + product.ModelNo + ".jpg";
|
||||
}
|
||||
_inventoryDbContext.Products.Add(product);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
var updatedList = await _inventoryDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
||||
_authDbContext.Products.Add(product);
|
||||
await _authDbContext.SaveChangesAsync();
|
||||
var updatedList = await _authDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
||||
return Json(updatedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -183,14 +181,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpDelete("DeleteProduct/{id}")]
|
||||
public async Task<IActionResult> DeleteProduct(int id)
|
||||
{
|
||||
var Product = await _inventoryDbContext.Products.FindAsync(id);
|
||||
var Product = await _authDbContext.Products.FindAsync(id);
|
||||
if (Product == null)
|
||||
{
|
||||
return NotFound(new { success = false, message = "Product not found" });
|
||||
}
|
||||
|
||||
_inventoryDbContext.Products.Remove(Product);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_authDbContext.Products.Remove(Product);
|
||||
await _authDbContext.SaveChangesAsync();
|
||||
|
||||
return Ok(new { success = true, message = "Product deleted successfully" });
|
||||
}
|
||||
@ -202,7 +200,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("CompanyDepartmentList")]
|
||||
public async Task<IActionResult> CompanyDepartmentList()
|
||||
{
|
||||
var companyList = await _identityDbContext.Companies
|
||||
var companyList = await _authDbContext.Companies
|
||||
.Include(c => c.Departments)
|
||||
.Select(c => new { c.CompanyId, c.CompanyName, Departments = c.Departments
|
||||
.OrderBy(d => d.DepartmentId)
|
||||
@ -219,7 +217,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("DepartmentCompanyList")]
|
||||
public async Task<IActionResult> DepartmentCompanyList()
|
||||
{
|
||||
var itemDepartment = await _identityDbContext.Departments
|
||||
var itemDepartment = await _authDbContext.Departments
|
||||
.Include(d => d.Company) // Include the related Company entity
|
||||
.Select(d => new
|
||||
{
|
||||
@ -241,7 +239,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("SupplierList")]
|
||||
public async Task<IActionResult> SupplierList()
|
||||
{
|
||||
var supplierList = await _inventoryDbContext.Suppliers.ToListAsync();
|
||||
var supplierList = await _authDbContext.Suppliers.ToListAsync();
|
||||
return Json(supplierList);
|
||||
}
|
||||
|
||||
@ -252,7 +250,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("ItemList")]
|
||||
public async Task<IActionResult> ItemList()
|
||||
{
|
||||
var itemList = await _inventoryDbContext.Items.ToListAsync();
|
||||
var itemList = await _authDbContext.Items.ToListAsync();
|
||||
// Retrieve the request's host and scheme
|
||||
var request = HttpContext.Request;
|
||||
string domain = $"{request.Scheme}://{request.Host.Value}";
|
||||
@ -307,7 +305,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
|
||||
try
|
||||
{
|
||||
var product = await _inventoryDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("Product not found");
|
||||
var product = await _authDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("Product not found");
|
||||
|
||||
var addToProduct = item.Quantity;
|
||||
product.QuantityProduct += addToProduct;
|
||||
@ -317,17 +315,17 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
item.SerialNumber = null;
|
||||
}
|
||||
|
||||
_inventoryDbContext.Items.Add(item);
|
||||
_inventoryDbContext.Products.Update(product);
|
||||
await _identityDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
||||
_authDbContext.Items.Add(item);
|
||||
_authDbContext.Products.Update(product);
|
||||
await _authDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
||||
|
||||
// Fetch the generated ItemID
|
||||
var savedItem = await _inventoryDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
|
||||
var savedItem = await _authDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
|
||||
|
||||
if (savedItem != null)
|
||||
{
|
||||
var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
||||
var itemProduct = _inventoryDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
||||
var itemProduct = _authDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
||||
|
||||
string? companyInitial = companyDepartment!.CompanyName?.ToString().Substring(0, 1).ToUpper();
|
||||
string? departmentInitial = companyDepartment!.DepartmentName?.ToString().Substring(0, 1).ToUpper();
|
||||
@ -337,8 +335,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
var uniqueId = $"{companyInitial}{departmentInitial}{initialCategory}{productId}{itemId}".ToUpper();
|
||||
savedItem.UniqueID = uniqueId;
|
||||
|
||||
_inventoryDbContext.Items.Update(savedItem);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_authDbContext.Items.Update(savedItem);
|
||||
await _authDbContext.SaveChangesAsync();
|
||||
}
|
||||
var updatedItem = new
|
||||
{
|
||||
@ -372,14 +370,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpDelete("DeleteItem/{id}")]
|
||||
public async Task<IActionResult> DeleteItem(int id)
|
||||
{
|
||||
var item = await _inventoryDbContext.Items.FindAsync(id);
|
||||
var item = await _authDbContext.Items.FindAsync(id);
|
||||
if (item == null)
|
||||
{
|
||||
return NotFound(new { success = false, message = "Item not found" });
|
||||
}
|
||||
|
||||
_inventoryDbContext.Items.Remove(item);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_authDbContext.Items.Remove(item);
|
||||
await _authDbContext.SaveChangesAsync();
|
||||
|
||||
return Ok(new { success = true, message = "Item deleted successfully" });
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
public class ModuleAPI : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
public ModuleAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||
private readonly AuthDBContext _authDbContext;
|
||||
public ModuleAPI(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_authDbContext = authDbContext;
|
||||
|
||||
@ -10,9 +10,9 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
{
|
||||
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
private readonly AuthDBContext _authDbContext;
|
||||
|
||||
public RoleAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||
public RoleAPI(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_authDbContext = authDbContext;
|
||||
|
||||
@ -9,10 +9,10 @@ namespace PSTW_CentralSystem.Controllers
|
||||
//[Authorize(Policy = "RoleModulePolicy")]
|
||||
public class AdminController : Controller
|
||||
{
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
private readonly AuthDBContext _authDbContext;
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public AdminController(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||
public AdminController(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_authDbContext = authDbContext;
|
||||
@ -27,7 +27,6 @@ namespace PSTW_CentralSystem.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult ModuleSetting(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
@ -49,19 +48,5 @@ namespace PSTW_CentralSystem.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult UserAdmin()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult UserSetting()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult UserCreate()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,11 +14,11 @@ namespace PSTW_CentralSystem.CustomPolicy
|
||||
}
|
||||
public class RoleModuleHandler : AuthorizationHandler<RoleModulePolicy>
|
||||
{
|
||||
private readonly IdentityDBContext _authDBContext;
|
||||
private readonly AuthDBContext _authDBContext;
|
||||
private readonly UserManager<UserModel> _userManager;
|
||||
private readonly RoleManager<RoleModel> _roleManager;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
public RoleModuleHandler( IdentityDBContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
||||
public RoleModuleHandler( AuthDBContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_authDBContext = authDBContext;
|
||||
_userManager = userManager;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Newtonsoft.Json;
|
||||
using PSTW_CentralSystem.Areas.Inventory.Models;
|
||||
using PSTW_CentralSystem.Models;
|
||||
@ -9,10 +8,10 @@ using System.Text.Json;
|
||||
|
||||
namespace PSTW_CentralSystem.DBContext
|
||||
{
|
||||
public class IdentityDBContext : IdentityDbContext<UserModel, RoleModel, int>
|
||||
public class AuthDBContext : IdentityDbContext<UserModel, RoleModel, int>
|
||||
{
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
public IdentityDBContext(DbContextOptions<IdentityDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||
public AuthDBContext(DbContextOptions<AuthDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||
{
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
@ -25,13 +24,7 @@ namespace PSTW_CentralSystem.DBContext
|
||||
.Property(e => e.MethodAllowedUserType)
|
||||
.HasConversion(
|
||||
v => JsonConvert.SerializeObject(v), // Convert List<MethodAllowedUserType> to JSON string
|
||||
v => JsonConvert.DeserializeObject<List<MethodAllowedUserType>>(v))
|
||||
.Metadata.SetValueComparer(
|
||||
new ValueComparer<List<MethodAllowedUserType>>(
|
||||
(c1, c2) => c1 != null && c2 != null && c1.SequenceEqual(c2), // Compare two lists
|
||||
c => c != null ? c.Aggregate(0, (a, v) => HashCode.Combine(a, v.GetHashCode())) : 0, // HashCode
|
||||
c => c != null ? c.ToList() : null // Clone the list to avoid mutations
|
||||
));
|
||||
v => JsonConvert.DeserializeObject<List<MethodAllowedUserType>>(v));
|
||||
|
||||
// Seeding Roles
|
||||
modelBuilder.Entity<RoleModel>().HasData(
|
||||
@ -74,10 +67,6 @@ namespace PSTW_CentralSystem.DBContext
|
||||
// Seeding AdminRole
|
||||
modelBuilder.Entity<IdentityUserRole<int>>().HasData(
|
||||
new IdentityUserRole<int> { UserId = 1, RoleId = 1 });
|
||||
|
||||
// Seeding SystemAdminRole
|
||||
modelBuilder.Entity<IdentityUserRole<int>>().HasData(
|
||||
new IdentityUserRole<int> { UserId = 2, RoleId = 2 });
|
||||
}
|
||||
|
||||
public new DbSet<UserModel> Users { get; set; }
|
||||
@ -85,6 +74,10 @@ namespace PSTW_CentralSystem.DBContext
|
||||
public DbSet<ModuleSettingModel> ModuleSettings { get; set; }
|
||||
public DbSet<CompanyModel> Companies { get; set; }
|
||||
public DbSet<DepartmentModel> Departments { get; set; }
|
||||
public DbSet<ManufacturerModel> Manufacturers { get; set; }
|
||||
public DbSet<ItemModel> Items { get; set; }
|
||||
public DbSet<ProductModel> Products{ get; set; }
|
||||
public DbSet<SupplierModel> Suppliers{ get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using PSTW_CentralSystem.Areas.Inventory.Models;
|
||||
using PSTW_CentralSystem.Models;
|
||||
|
||||
namespace PSTW_CentralSystem.DBContext
|
||||
{
|
||||
public class InventoryDBContext : DbContext
|
||||
{
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
public InventoryDBContext(DbContextOptions<InventoryDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||
{
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
public DbSet<ManufacturerModel> Manufacturers { get; set; }
|
||||
public DbSet<ItemModel> Items { get; set; }
|
||||
public DbSet<ProductModel> Products { get; set; }
|
||||
public DbSet<SupplierModel> Suppliers { get; set; }
|
||||
}
|
||||
}
|
||||
@ -11,8 +11,8 @@ using PSTW_CentralSystem.DBContext;
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
[DbContext(typeof(IdentityDBContext))]
|
||||
[Migration("20241206015840_Initiate")]
|
||||
[DbContext(typeof(AuthDBContext))]
|
||||
[Migration("20241128045608_Initiate")]
|
||||
partial class Initiate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -113,11 +113,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
UserId = 1,
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 2,
|
||||
RoleId = 2
|
||||
});
|
||||
});
|
||||
|
||||
@ -140,7 +135,7 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Property<int>("CompanyId")
|
||||
.ValueGeneratedOnAdd()
|
||||
@ -157,7 +152,7 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.ToTable("Companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.Property<int>("DepartmentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
@ -168,10 +163,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DepartmentCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DepartmentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
@ -183,6 +174,164 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.ToTable("Departments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("ConvertPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Currency")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("CurrencyRate")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("DODate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("DepartmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("EndWDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("InvoiceDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PONo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("PriceInRM")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("PurchaseDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Supplier")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UniqueID")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("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<int>("ManufacturerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
|
||||
|
||||
b.Property<string>("ManufacturerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("ManufacturerId");
|
||||
|
||||
b.ToTable("Manufacturers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Property<int>("ProductId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ImageProduct")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ManufacturerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ModelNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int?>("QuantityProduct")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProductId");
|
||||
|
||||
b.HasIndex("ManufacturerId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
|
||||
|
||||
b.Property<string>("SupplierEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierGender")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierPhoneNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Suppliers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
|
||||
{
|
||||
b.Property<int>("SettingId")
|
||||
@ -336,9 +485,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.Property<int?>("UserStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("departmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
@ -348,8 +494,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.HasIndex("departmentId");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
|
||||
b.HasData(
|
||||
@ -357,16 +501,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 1,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "b58597b6-2835-4ff6-b437-11ec7a213434",
|
||||
ConcurrencyStamp = "df01136b-c869-4bc3-9512-34a9cdc8f73d",
|
||||
Email = "admin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "MAAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAECA03al9kGFTKlmmTls3wiH4NV7HlL76680Qx6lR7d77LHJwIN6/Wt1MBCP9TE1qfg==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAECcU3fIsIpqE1gECPg262gMejQiypGUXipVbiRtF66ywBqUHdohCj89hiJAafOlrPQ==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "0f649a27-6566-436c-bc27-d1a6b8e7f846",
|
||||
SecurityStamp = "d36451ff-cfab-46e1-bf80-6b428d79a19b",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "admin@pstw.com.my"
|
||||
},
|
||||
@ -374,16 +518,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 2,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "cf9424fc-8afc-4f59-a0a6-34574676273c",
|
||||
ConcurrencyStamp = "6f7244cf-e611-4088-890a-72939cfbefa5",
|
||||
Email = "sysadmin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "SysAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEMkwXv250FjOjdLEAY2a/aEF3g3iu9xCVORV/MH37kVcj8vgJez+LlfJtjklaschLg==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEJwGvD0ionYUADG6FQvuXiK0/897GSnJ8z55w1P0GaItbNjjypF1+aDuRViCZMUQ+g==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "8efe9683-78fb-404d-96a9-b8b7302c03b2",
|
||||
SecurityStamp = "50df1ec2-4ba7-4eb5-84a3-ffb35b44f391",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "sysadmin@pstw.com.my"
|
||||
});
|
||||
@ -440,9 +584,9 @@ namespace PSTW_CentralSystem.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
||||
.WithMany("Departments")
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -451,19 +595,53 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.Navigation("Company");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
||||
.WithMany()
|
||||
.HasForeignKey("departmentId");
|
||||
.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("Items")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
|
||||
b.Navigation("Department");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ManufacturerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manufacturer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Navigation("Departments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
@ -38,91 +38,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Companies",
|
||||
columns: table => new
|
||||
{
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Companies", x => x.CompanyId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ModuleSettings",
|
||||
columns: table => new
|
||||
{
|
||||
SettingId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ModuleName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AllowedUserType = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MethodAllowedUserType = table.Column<string>(type: "json", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ModuleStatus = table.Column<int>(type: "int", nullable: false),
|
||||
Description = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ModuleSettings", x => x.SettingId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoleClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleId = table.Column<int>(type: "int", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ClaimValue = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Departments",
|
||||
columns: table => new
|
||||
{
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DepartmentName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DepartmentCode = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CompanyId = table.Column<int>(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: "AspNetUsers",
|
||||
columns: table => new
|
||||
@ -132,7 +47,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
FullName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UserStatus = table.Column<int>(type: "int", nullable: true),
|
||||
departmentId = table.Column<int>(type: "int", nullable: true),
|
||||
UserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
NormalizedUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||
@ -159,11 +73,103 @@ namespace PSTW_CentralSystem.Migrations
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Companies",
|
||||
columns: table => new
|
||||
{
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyName = table.Column<string>(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<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ManufacturerName = table.Column<string>(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
|
||||
{
|
||||
SettingId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ModuleName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
AllowedUserType = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
MethodAllowedUserType = table.Column<string>(type: "json", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ModuleStatus = table.Column<int>(type: "int", nullable: false),
|
||||
Description = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ModuleSettings", x => x.SettingId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Suppliers",
|
||||
columns: table => new
|
||||
{
|
||||
SupplierId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SupplierName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierGender = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierEmail = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierPhoneNo = table.Column<string>(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
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
RoleId = table.Column<int>(type: "int", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ClaimValue = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AspNetUsers_Departments_departmentId",
|
||||
column: x => x.departmentId,
|
||||
principalTable: "Departments",
|
||||
principalColumn: "DepartmentId");
|
||||
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
@ -264,6 +270,110 @@ namespace PSTW_CentralSystem.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Departments",
|
||||
columns: table => new
|
||||
{
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DepartmentName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CompanyId = table.Column<int>(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<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ProductName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ManufacturerId = table.Column<int>(type: "int", nullable: false),
|
||||
Category = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ModelNo = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
QuantityProduct = table.Column<int>(type: "int", nullable: true),
|
||||
ImageProduct = table.Column<string>(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<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UniqueID = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
ProductId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialNumber = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Quantity = table.Column<int>(type: "int", nullable: false),
|
||||
Supplier = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PurchaseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
PONo = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Currency = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PriceInRM = table.Column<float>(type: "float", nullable: false),
|
||||
CurrencyRate = table.Column<float>(type: "float", nullable: false),
|
||||
ConvertPrice = table.Column<float>(type: "float", nullable: false),
|
||||
DODate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
Warranty = table.Column<int>(type: "int", nullable: false),
|
||||
EndWDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
InvoiceDate = table.Column<DateTime>(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" },
|
||||
@ -277,21 +387,17 @@ namespace PSTW_CentralSystem.Migrations
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetUsers",
|
||||
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName", "UserStatus", "departmentId" },
|
||||
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName", "UserStatus" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, 0, "b58597b6-2835-4ff6-b437-11ec7a213434", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAECA03al9kGFTKlmmTls3wiH4NV7HlL76680Qx6lR7d77LHJwIN6/Wt1MBCP9TE1qfg==", null, false, "0f649a27-6566-436c-bc27-d1a6b8e7f846", false, "admin@pstw.com.my", null, null },
|
||||
{ 2, 0, "cf9424fc-8afc-4f59-a0a6-34574676273c", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEMkwXv250FjOjdLEAY2a/aEF3g3iu9xCVORV/MH37kVcj8vgJez+LlfJtjklaschLg==", null, false, "8efe9683-78fb-404d-96a9-b8b7302c03b2", false, "sysadmin@pstw.com.my", null, null }
|
||||
{ 1, 0, "df01136b-c869-4bc3-9512-34a9cdc8f73d", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAECcU3fIsIpqE1gECPg262gMejQiypGUXipVbiRtF66ywBqUHdohCj89hiJAafOlrPQ==", null, false, "d36451ff-cfab-46e1-bf80-6b428d79a19b", false, "admin@pstw.com.my", null },
|
||||
{ 2, 0, "6f7244cf-e611-4088-890a-72939cfbefa5", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEJwGvD0ionYUADG6FQvuXiK0/897GSnJ8z55w1P0GaItbNjjypF1+aDuRViCZMUQ+g==", null, false, "50df1ec2-4ba7-4eb5-84a3-ffb35b44f391", false, "sysadmin@pstw.com.my", null }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "AspNetUserRoles",
|
||||
columns: new[] { "RoleId", "UserId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, 1 },
|
||||
{ 2, 2 }
|
||||
});
|
||||
values: new object[] { 1, 1 });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetRoleClaims_RoleId",
|
||||
@ -324,11 +430,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AspNetUsers_departmentId",
|
||||
table: "AspNetUsers",
|
||||
column: "departmentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UserNameIndex",
|
||||
table: "AspNetUsers",
|
||||
@ -339,6 +440,26 @@ namespace PSTW_CentralSystem.Migrations
|
||||
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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -359,9 +480,15 @@ namespace PSTW_CentralSystem.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserTokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ModuleSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Suppliers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoles");
|
||||
|
||||
@ -371,8 +498,14 @@ namespace PSTW_CentralSystem.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "Departments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Companies");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Manufacturers");
|
||||
}
|
||||
}
|
||||
}
|
||||
647
Migrations/20241129023507_UpdateItemModel.Designer.cs
generated
Normal file
647
Migrations/20241129023507_UpdateItemModel.Designer.cs
generated
Normal file
@ -0,0 +1,647 @@
|
||||
// <auto-generated />
|
||||
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("20241129023507_UpdateItemModel")]
|
||||
partial class UpdateItemModel
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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<int>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("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<int>", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("varchar(255)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Property<int>("CompanyId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
|
||||
|
||||
b.Property<string>("CompanyName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("CompanyId");
|
||||
|
||||
b.ToTable("Companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.Property<int>("DepartmentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DepartmentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("DepartmentId");
|
||||
|
||||
b.HasIndex("CompanyId");
|
||||
|
||||
b.ToTable("Departments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("ConvertPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Currency")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("CurrencyRate")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("DODate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("DepartmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("EndWDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("InvoiceDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PONo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("PriceInRM")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("PurchaseDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Supplier")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UniqueID")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("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<int>("ManufacturerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
|
||||
|
||||
b.Property<string>("ManufacturerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("ManufacturerId");
|
||||
|
||||
b.ToTable("Manufacturers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Property<int>("ProductId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ImageProduct")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ManufacturerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ModelNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int?>("QuantityProduct")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProductId");
|
||||
|
||||
b.HasIndex("ManufacturerId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
|
||||
|
||||
b.Property<string>("SupplierEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierGender")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierPhoneNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Suppliers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
|
||||
{
|
||||
b.Property<int>("SettingId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
|
||||
|
||||
b.Property<string>("AllowedUserType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("MethodAllowedUserType")
|
||||
.HasColumnType("json");
|
||||
|
||||
b.Property<string>("ModuleName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<int>("ModuleStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("SettingId");
|
||||
|
||||
b.ToTable("ModuleSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("varchar(256)");
|
||||
|
||||
b.Property<int?>("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 = "9577ec05-b14b-4fe2-9d75-cb6aa1ce25be",
|
||||
Email = "admin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "MAAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEKPk6s6BTBEv5y5S9pOYk6OvLO6XfHhiylslKoOPbAQIAaG9DJZ27ltRHKwe34Na6w==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "8f828c08-90d7-4a77-a8b0-a317e7ecadbc",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "admin@pstw.com.my"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = 2,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "75cb87bb-bba0-410e-83a0-b23b54dfa2f6",
|
||||
Email = "sysadmin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "SysAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEPmeMMNew971MNbCbXypkCQ9L2EFXyjcFUhEjX7aPJCC4B+aRavO/201MVOvU/VFIQ==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "4480b7af-adbc-4d83-9527-511f99593aac",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "sysadmin@pstw.com.my"
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", 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<int>", 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("Departments")
|
||||
.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("Items")
|
||||
.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.ManufacturerModel", "Manufacturer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ManufacturerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manufacturer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Navigation("Departments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Migrations/20241129023507_UpdateItemModel.cs
Normal file
74
Migrations/20241129023507_UpdateItemModel.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class UpdateItemModel : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SerialNumber",
|
||||
table: "Items",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "9577ec05-b14b-4fe2-9d75-cb6aa1ce25be", "AQAAAAIAAYagAAAAEKPk6s6BTBEv5y5S9pOYk6OvLO6XfHhiylslKoOPbAQIAaG9DJZ27ltRHKwe34Na6w==", "8f828c08-90d7-4a77-a8b0-a317e7ecadbc" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "75cb87bb-bba0-410e-83a0-b23b54dfa2f6", "AQAAAAIAAYagAAAAEPmeMMNew971MNbCbXypkCQ9L2EFXyjcFUhEjX7aPJCC4B+aRavO/201MVOvU/VFIQ==", "4480b7af-adbc-4d83-9527-511f99593aac" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Items",
|
||||
keyColumn: "SerialNumber",
|
||||
keyValue: null,
|
||||
column: "SerialNumber",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "SerialNumber",
|
||||
table: "Items",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 1,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "df01136b-c869-4bc3-9512-34a9cdc8f73d", "AQAAAAIAAYagAAAAECcU3fIsIpqE1gECPg262gMejQiypGUXipVbiRtF66ywBqUHdohCj89hiJAafOlrPQ==", "d36451ff-cfab-46e1-bf80-6b428d79a19b" });
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "AspNetUsers",
|
||||
keyColumn: "Id",
|
||||
keyValue: 2,
|
||||
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
|
||||
values: new object[] { "6f7244cf-e611-4088-890a-72939cfbefa5", "AQAAAAIAAYagAAAAEJwGvD0ionYUADG6FQvuXiK0/897GSnJ8z55w1P0GaItbNjjypF1+aDuRViCZMUQ+g==", "50df1ec2-4ba7-4eb5-84a3-ffb35b44f391" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,8 +10,8 @@ using PSTW_CentralSystem.DBContext;
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
[DbContext(typeof(IdentityDBContext))]
|
||||
partial class IdentityDBContextModelSnapshot : ModelSnapshot
|
||||
[DbContext(typeof(AuthDBContext))]
|
||||
partial class AuthDBContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -110,11 +110,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
UserId = 1,
|
||||
RoleId = 1
|
||||
},
|
||||
new
|
||||
{
|
||||
UserId = 2,
|
||||
RoleId = 2
|
||||
});
|
||||
});
|
||||
|
||||
@ -137,7 +132,7 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Property<int>("CompanyId")
|
||||
.ValueGeneratedOnAdd()
|
||||
@ -154,7 +149,7 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.ToTable("Companies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.Property<int>("DepartmentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
@ -165,10 +160,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DepartmentCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DepartmentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
@ -180,6 +171,163 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.ToTable("Departments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("ConvertPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("Currency")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("CurrencyRate")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("DODate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("DepartmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("EndWDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime>("InvoiceDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("PONo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("PriceInRM")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("PurchaseDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Supplier")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UniqueID")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("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<int>("ManufacturerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
|
||||
|
||||
b.Property<string>("ManufacturerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("ManufacturerId");
|
||||
|
||||
b.ToTable("Manufacturers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Property<int>("ProductId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ImageProduct")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ManufacturerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ModelNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int?>("QuantityProduct")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProductId");
|
||||
|
||||
b.HasIndex("ManufacturerId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
|
||||
|
||||
b.Property<string>("SupplierEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierGender")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierPhoneNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Suppliers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
|
||||
{
|
||||
b.Property<int>("SettingId")
|
||||
@ -333,9 +481,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.Property<int?>("UserStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("departmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
@ -345,8 +490,6 @@ namespace PSTW_CentralSystem.Migrations
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.HasIndex("departmentId");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
|
||||
b.HasData(
|
||||
@ -354,16 +497,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 1,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "b58597b6-2835-4ff6-b437-11ec7a213434",
|
||||
ConcurrencyStamp = "9577ec05-b14b-4fe2-9d75-cb6aa1ce25be",
|
||||
Email = "admin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "MAAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAECA03al9kGFTKlmmTls3wiH4NV7HlL76680Qx6lR7d77LHJwIN6/Wt1MBCP9TE1qfg==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEKPk6s6BTBEv5y5S9pOYk6OvLO6XfHhiylslKoOPbAQIAaG9DJZ27ltRHKwe34Na6w==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "0f649a27-6566-436c-bc27-d1a6b8e7f846",
|
||||
SecurityStamp = "8f828c08-90d7-4a77-a8b0-a317e7ecadbc",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "admin@pstw.com.my"
|
||||
},
|
||||
@ -371,16 +514,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 2,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "cf9424fc-8afc-4f59-a0a6-34574676273c",
|
||||
ConcurrencyStamp = "75cb87bb-bba0-410e-83a0-b23b54dfa2f6",
|
||||
Email = "sysadmin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "SysAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEMkwXv250FjOjdLEAY2a/aEF3g3iu9xCVORV/MH37kVcj8vgJez+LlfJtjklaschLg==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEPmeMMNew971MNbCbXypkCQ9L2EFXyjcFUhEjX7aPJCC4B+aRavO/201MVOvU/VFIQ==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "8efe9683-78fb-404d-96a9-b8b7302c03b2",
|
||||
SecurityStamp = "4480b7af-adbc-4d83-9527-511f99593aac",
|
||||
TwoFactorEnabled = false,
|
||||
UserName = "sysadmin@pstw.com.my"
|
||||
});
|
||||
@ -437,9 +580,9 @@ namespace PSTW_CentralSystem.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
||||
.WithMany("Departments")
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -448,19 +591,53 @@ namespace PSTW_CentralSystem.Migrations
|
||||
b.Navigation("Company");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
||||
.WithMany()
|
||||
.HasForeignKey("departmentId");
|
||||
.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("Items")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
|
||||
b.Navigation("Department");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ManufacturerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manufacturer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Navigation("Departments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
@ -1,394 +0,0 @@
|
||||
// <auto-generated />
|
||||
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.InventoryDB
|
||||
{
|
||||
[DbContext(typeof(InventoryDBContext))]
|
||||
[Migration("20241206071642_Initiate")]
|
||||
partial class Initiate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("ConvertPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("CreatedByUserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Currency")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("CurrencyRate")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime?>("DODate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DONo")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DepartmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("EndWDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("InvoiceDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("InvoiceNo")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ItemLocation")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ItemStatus")
|
||||
.HasColumnType("int")
|
||||
.HasComment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;");
|
||||
|
||||
b.Property<string>("PONo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("PriceInRM")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("PurchaseDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Supplier")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("TeamType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UniqueID")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Warranty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ItemID");
|
||||
|
||||
b.HasIndex("CompanyId");
|
||||
|
||||
b.HasIndex("CreatedByUserId");
|
||||
|
||||
b.HasIndex("DepartmentId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b =>
|
||||
{
|
||||
b.Property<int>("ManufacturerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
|
||||
|
||||
b.Property<string>("ManufacturerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("ManufacturerId");
|
||||
|
||||
b.ToTable("Manufacturers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Property<int>("ProductId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ImageProduct")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ManufacturerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ModelNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int?>("QuantityProduct")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProductId");
|
||||
|
||||
b.HasIndex("ManufacturerId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
|
||||
|
||||
b.Property<string>("SupplierEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierGender")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierPhoneNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Suppliers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Property<int>("CompanyId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
|
||||
|
||||
b.Property<string>("CompanyName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("CompanyId");
|
||||
|
||||
b.ToTable("CompanyModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.Property<int>("DepartmentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DepartmentCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DepartmentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("DepartmentId");
|
||||
|
||||
b.HasIndex("CompanyId");
|
||||
|
||||
b.ToTable("DepartmentModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int?>("UserStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("departmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("departmentId");
|
||||
|
||||
b.ToTable("UserModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
.WithMany()
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PSTW_CentralSystem.Models.UserModel", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedByUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||
.WithMany()
|
||||
.HasForeignKey("DepartmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product")
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("Department");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ManufacturerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manufacturer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
.WithMany("Departments")
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||
.WithMany()
|
||||
.HasForeignKey("departmentId");
|
||||
|
||||
b.Navigation("Department");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Navigation("Departments");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,296 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations.InventoryDB
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initiate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CompanyModel",
|
||||
columns: table => new
|
||||
{
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
CompanyName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CompanyModel", x => x.CompanyId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Manufacturers",
|
||||
columns: table => new
|
||||
{
|
||||
ManufacturerId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ManufacturerName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Manufacturers", x => x.ManufacturerId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Suppliers",
|
||||
columns: table => new
|
||||
{
|
||||
SupplierId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SupplierName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierGender = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierEmail = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierPhoneNo = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Suppliers", x => x.SupplierId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DepartmentModel",
|
||||
columns: table => new
|
||||
{
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
DepartmentName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DepartmentCode = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DepartmentModel", x => x.DepartmentId);
|
||||
table.ForeignKey(
|
||||
name: "FK_DepartmentModel_CompanyModel_CompanyId",
|
||||
column: x => x.CompanyId,
|
||||
principalTable: "CompanyModel",
|
||||
principalColumn: "CompanyId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Products",
|
||||
columns: table => new
|
||||
{
|
||||
ProductId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ProductName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ManufacturerId = table.Column<int>(type: "int", nullable: false),
|
||||
Category = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ModelNo = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
QuantityProduct = table.Column<int>(type: "int", nullable: true),
|
||||
ImageProduct = table.Column<string>(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: "UserModel",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
FullName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
UserStatus = table.Column<int>(type: "int", nullable: true),
|
||||
departmentId = table.Column<int>(type: "int", nullable: true),
|
||||
UserName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
NormalizedUserName = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Email = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
NormalizedEmail = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
EmailConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
PasswordHash = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SecurityStamp = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PhoneNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PhoneNumberConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserModel", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_UserModel_DepartmentModel_departmentId",
|
||||
column: x => x.departmentId,
|
||||
principalTable: "DepartmentModel",
|
||||
principalColumn: "DepartmentId");
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Items",
|
||||
columns: table => new
|
||||
{
|
||||
ItemID = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
UniqueID = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CompanyId = table.Column<int>(type: "int", nullable: false),
|
||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
||||
ProductId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialNumber = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
TeamType = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Quantity = table.Column<int>(type: "int", nullable: false),
|
||||
Supplier = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PurchaseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
PONo = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Currency = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
PriceInRM = table.Column<float>(type: "float", nullable: false),
|
||||
CurrencyRate = table.Column<float>(type: "float", nullable: false),
|
||||
ConvertPrice = table.Column<float>(type: "float", nullable: false),
|
||||
DONo = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DODate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
Warranty = table.Column<int>(type: "int", nullable: false),
|
||||
EndWDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
InvoiceNo = table.Column<string>(type: "longtext", nullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
InvoiceDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
ItemStatus = table.Column<int>(type: "int", nullable: false, comment: "1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;"),
|
||||
ItemLocation = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedByUserId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Items", x => x.ItemID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Items_CompanyModel_CompanyId",
|
||||
column: x => x.CompanyId,
|
||||
principalTable: "CompanyModel",
|
||||
principalColumn: "CompanyId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Items_DepartmentModel_DepartmentId",
|
||||
column: x => x.DepartmentId,
|
||||
principalTable: "DepartmentModel",
|
||||
principalColumn: "DepartmentId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Items_Products_ProductId",
|
||||
column: x => x.ProductId,
|
||||
principalTable: "Products",
|
||||
principalColumn: "ProductId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Items_UserModel_CreatedByUserId",
|
||||
column: x => x.CreatedByUserId,
|
||||
principalTable: "UserModel",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_DepartmentModel_CompanyId",
|
||||
table: "DepartmentModel",
|
||||
column: "CompanyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Items_CompanyId",
|
||||
table: "Items",
|
||||
column: "CompanyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Items_CreatedByUserId",
|
||||
table: "Items",
|
||||
column: "CreatedByUserId");
|
||||
|
||||
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");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_UserModel_departmentId",
|
||||
table: "UserModel",
|
||||
column: "departmentId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Suppliers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserModel");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Manufacturers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DepartmentModel");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CompanyModel");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,391 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using PSTW_CentralSystem.DBContext;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations.InventoryDB
|
||||
{
|
||||
[DbContext(typeof(InventoryDBContext))]
|
||||
partial class InventoryDBContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.11")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.Property<int>("ItemID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("ConvertPrice")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("CreatedByUserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Currency")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("CurrencyRate")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime?>("DODate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("DONo")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("DepartmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("EndWDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<DateTime?>("InvoiceDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("InvoiceNo")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ItemLocation")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ItemStatus")
|
||||
.HasColumnType("int")
|
||||
.HasComment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;");
|
||||
|
||||
b.Property<string>("PONo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<float>("PriceInRM")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ProductId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("PurchaseDate")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Supplier")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("TeamType")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("UniqueID")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("Warranty")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ItemID");
|
||||
|
||||
b.HasIndex("CompanyId");
|
||||
|
||||
b.HasIndex("CreatedByUserId");
|
||||
|
||||
b.HasIndex("DepartmentId");
|
||||
|
||||
b.HasIndex("ProductId");
|
||||
|
||||
b.ToTable("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b =>
|
||||
{
|
||||
b.Property<int>("ManufacturerId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
|
||||
|
||||
b.Property<string>("ManufacturerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("ManufacturerId");
|
||||
|
||||
b.ToTable("Manufacturers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Property<int>("ProductId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ImageProduct")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int>("ManufacturerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ModelNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("ProductName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int?>("QuantityProduct")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("ProductId");
|
||||
|
||||
b.HasIndex("ManufacturerId");
|
||||
|
||||
b.ToTable("Products");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
|
||||
{
|
||||
b.Property<int>("SupplierId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
|
||||
|
||||
b.Property<string>("SupplierEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierGender")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("SupplierPhoneNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("SupplierId");
|
||||
|
||||
b.ToTable("Suppliers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Property<int>("CompanyId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
|
||||
|
||||
b.Property<string>("CompanyName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("CompanyId");
|
||||
|
||||
b.ToTable("CompanyModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.Property<int>("DepartmentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
|
||||
|
||||
b.Property<int>("CompanyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DepartmentCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("DepartmentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.HasKey("DepartmentId");
|
||||
|
||||
b.HasIndex("CompanyId");
|
||||
|
||||
b.ToTable("DepartmentModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("FullName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<int?>("UserStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("departmentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("departmentId");
|
||||
|
||||
b.ToTable("UserModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
.WithMany()
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PSTW_CentralSystem.Models.UserModel", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedByUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||
.WithMany()
|
||||
.HasForeignKey("DepartmentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product")
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("Department");
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ManufacturerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manufacturer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
.WithMany("Departments")
|
||||
.HasForeignKey("CompanyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Company");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||
.WithMany()
|
||||
.HasForeignKey("departmentId");
|
||||
|
||||
b.Navigation("Department");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||
{
|
||||
b.Navigation("Departments");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,9 +9,5 @@ namespace PSTW_CentralSystem.Models
|
||||
// Add custom properties
|
||||
public string? FullName { get; set; }
|
||||
public int? UserStatus { get; set; }
|
||||
public int? departmentId { get; set; }
|
||||
[ForeignKey("departmentId")]
|
||||
public virtual DepartmentModel? Department { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
<Folder Include="Controllers\JSA\API\" />
|
||||
<Folder Include="Logs\" />
|
||||
<Folder Include="Migrations\" />
|
||||
<Folder Include="Views\JSA\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
20
Program.cs
20
Program.cs
@ -11,8 +11,7 @@ internal class Program
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var authConnectionString = builder.Configuration.GetConnectionString("AuthConnnection");
|
||||
var inventoryConnectionString = builder.Configuration.GetConnectionString("InventoryConnection");
|
||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
@ -32,23 +31,12 @@ internal class Program
|
||||
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}"))
|
||||
.WriteTo.Console()
|
||||
.CreateLogger();
|
||||
// Set default session to 30 minutes
|
||||
builder.Services.AddSession(options =>
|
||||
{
|
||||
options.IdleTimeout = TimeSpan.FromDays(30);
|
||||
});
|
||||
|
||||
builder.Logging.AddSerilog();
|
||||
|
||||
builder.Services.AddDbContext<IdentityDBContext>(options =>
|
||||
builder.Services.AddDbContext<AuthDBContext>(options =>
|
||||
{
|
||||
options.UseMySql(authConnectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
||||
mysqlOptions => mysqlOptions.CommandTimeout(120)
|
||||
);
|
||||
});
|
||||
builder.Services.AddDbContext<InventoryDBContext>(options =>
|
||||
{
|
||||
options.UseMySql(inventoryConnectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
||||
options.UseMySql(connectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
||||
mysqlOptions => mysqlOptions.CommandTimeout(120)
|
||||
);
|
||||
});
|
||||
@ -56,7 +44,7 @@ internal class Program
|
||||
//builder.Services.AddDefaultIdentity<UserModel>(options => options.SignIn.RequireConfirmedAccount = true).AddEntityFrameworkStores<AuthDBContext>();
|
||||
|
||||
builder.Services.AddIdentity<UserModel, RoleModel>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<IdentityDBContext>()
|
||||
.AddEntityFrameworkStores<AuthDBContext>()
|
||||
.AddDefaultUI()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
|
||||
@ -7,27 +7,13 @@
|
||||
}
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-lg-3">
|
||||
<a asp-controller="Admin" asp-action="UserAdmin">
|
||||
<div class="card card-hover">
|
||||
<div class="box bg-cyan text-center">
|
||||
<h1 class="font-light text-white">
|
||||
<i class="mdi mdi-view-dashboard"></i>
|
||||
</h1>
|
||||
<h6 class="text-white">Dashboard</h6>
|
||||
</div>
|
||||
<div class="card card-hover">
|
||||
<div class="box bg-cyan text-center">
|
||||
<h1 class="font-light text-white">
|
||||
<i class="mdi mdi-view-dashboard"></i>
|
||||
</h1>
|
||||
<h6 class="text-white">Dashboard</h6>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-3">
|
||||
<a asp-controller="Admin" asp-action="UserAdmin">
|
||||
<div class="card card-hover">
|
||||
<div class="box bg-cyan text-center">
|
||||
<h1 class="font-light text-white">
|
||||
<i class="mdi mdi-human"></i>
|
||||
</h1>
|
||||
<h6 class="text-white">User Administration</h6>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,241 +0,0 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
ViewData["Title"] = "User Administration";
|
||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||
}
|
||||
|
||||
<p>
|
||||
<a asp-action="UserCreate">Create New</a>
|
||||
</p>
|
||||
<div id="app">
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Latest Posts</h4>
|
||||
<div class="col-md-12 col-lg-12">
|
||||
<div>
|
||||
<table class="table table-bordered border-primary" id="userDatatable">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- MODAL -->
|
||||
<div class="modal fade" id="confirm-dialog" tabindex="-1" role="dialog" aria-labelledby="confirm-dialog-title" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="confirm-dialog-title">Confirmation</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" v-on:click="hideModal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="selectedModule">
|
||||
<div class="modal-body">
|
||||
<p>Are you sure you want to delete module {{ selectedModule.moduleName }}?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" v-on:click="hideModal">Cancel</button>
|
||||
<input type="hidden" id="delete-id">
|
||||
<a id="confirmButton" href="#" class="btn btn-danger" v-on:click="confirmDelete(selectedModule)">Confirm</a>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else><p>Loading...</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@section Scripts {
|
||||
@{
|
||||
await Html.RenderPartialAsync("_ValidationScriptsPartial");
|
||||
}
|
||||
<script>
|
||||
const app = Vue.createApp({
|
||||
data() {
|
||||
return {
|
||||
userList: null,
|
||||
selectedModule: null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchModule();
|
||||
},
|
||||
methods: {
|
||||
fetchModule() {
|
||||
fetch('/AdminAPI/GetUserList', {
|
||||
method: 'POST'
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.length > 0) {
|
||||
this.userList = data.length ? data : [];
|
||||
}
|
||||
this.initiateTable();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('There was a problem with the fetch operation:', error);
|
||||
});
|
||||
},
|
||||
editModule(module) {
|
||||
// Check if the user ID exists
|
||||
if (module.settingId) {
|
||||
// Redirect the user to the edit user page
|
||||
window.location.href = 'ModuleSetting/' + module.settingId;
|
||||
} else {
|
||||
console.error('Module ID not found');
|
||||
}
|
||||
},
|
||||
deleteModule(module) {
|
||||
this.selectedModule = module; // Set selected user
|
||||
$('#confirm-dialog').modal('show'); // Show the modal
|
||||
|
||||
// console.log(this.selectedModule);
|
||||
},
|
||||
confirmDelete(module) {
|
||||
fetch(`/ModuleAPI/DeleteModule/${module.settingId}`, {
|
||||
method: 'POST'
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to delete module');
|
||||
}
|
||||
// Remove the deleted user from the userData array
|
||||
const index = this.moduleData.findIndex(u => u.settingId === module.settingId);
|
||||
if (index !== -1) {
|
||||
alert("Module deleted successfully");
|
||||
this.moduleData.splice(index, 1);
|
||||
}
|
||||
this.hideModal(); // Hide the modal after deletion
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Failed to delete module with status:', error);
|
||||
});
|
||||
},
|
||||
hideModal() {
|
||||
$('#confirm-dialog').modal('hide');
|
||||
},
|
||||
initiateTable() {
|
||||
self = this;
|
||||
this.itemDatatable = $('#userDatatable').DataTable({
|
||||
"data": this.items,
|
||||
"columns": [
|
||||
{
|
||||
"title": "Unique Id",
|
||||
"data": "uniqueID",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
// Assign a unique ID to the <td> element
|
||||
$(td).attr('id', `qr${cellData}`);
|
||||
},
|
||||
},
|
||||
{
|
||||
"title": "Serial Number",
|
||||
"data": "serialNumber",
|
||||
},
|
||||
{
|
||||
"title": "Quantity",
|
||||
"data": "quantity",
|
||||
},
|
||||
{
|
||||
"title": "Supplier",
|
||||
"data": "supplier",
|
||||
},
|
||||
{
|
||||
"title": "Purchase Date",
|
||||
"data": "purchaseDate",
|
||||
},
|
||||
{
|
||||
"title": "Price After Convert(RM)",
|
||||
"data": "convertPrice",
|
||||
},
|
||||
{
|
||||
"title": "Invoice Date",
|
||||
"data": "invoiceDate",
|
||||
},
|
||||
{
|
||||
"title": "Warranty Until",
|
||||
"data": "warranty",
|
||||
"render": function (data, type, full, meta) {
|
||||
if (data > 0) { return full.endWDate }
|
||||
else { return data }
|
||||
}
|
||||
},
|
||||
// {
|
||||
// "title": "Image",
|
||||
// "data": "imageProduct",
|
||||
// "render": function (data, type, full, meta) {
|
||||
// var image = `<a href="${data}" target="_blank" data-lightbox="image-1">
|
||||
// <img src="${data}" alt="Image" class="img-thumbnail" style="width: 100px; height: 100px;" />
|
||||
// </a>`;
|
||||
// return image;
|
||||
// },
|
||||
// },
|
||||
{
|
||||
"title": "Print",
|
||||
"data": "uniqueID",
|
||||
"render": function (data) {
|
||||
var printButton = `<button type="button" class="btn btn-success print-btn" data-id="${data}">Print</button>`;
|
||||
return printButton;
|
||||
},
|
||||
},
|
||||
{
|
||||
"title": "Delete",
|
||||
"data": "productId",
|
||||
"render": function (data) {
|
||||
var deleteButton = `<button type="button" class="btn btn-danger delete-btn" data-id="${data}">Delete</button>`;
|
||||
return deleteButton;
|
||||
},
|
||||
}
|
||||
],
|
||||
responsive: true,
|
||||
drawCallback: function (settings) {
|
||||
// Generate QR codes after rows are rendered
|
||||
const api = this.api();
|
||||
api.rows().every(function () {
|
||||
const data = this.data(); // Row data
|
||||
const containerId = `qr${data.uniqueID}`;
|
||||
const container = $(`#${containerId}`);
|
||||
// console.log(container[0]);
|
||||
if (container) {
|
||||
// Generate QR code only if not already generated
|
||||
new QRCode(container[0], {
|
||||
text: data.qrString,
|
||||
width: 150,
|
||||
height: 150,
|
||||
colorDark: "#000000",
|
||||
colorLight: "#ffffff",
|
||||
correctLevel: QRCode.CorrectLevel.H
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|
||||
|
||||
// Attach click event listener to the delete buttons
|
||||
$('#itemDatatable tbody').on('click', '.delete-btn', function () {
|
||||
const itemId = $(this).data('id');
|
||||
self.deleteItem(itemId);
|
||||
});
|
||||
|
||||
$('#itemDatatable tbody').on('click', '.print-btn', function () {
|
||||
const itemId = $(this).data('id');
|
||||
var $row = $(this).closest('tr'); // get the row containing the button
|
||||
var imageSrc = $row.find('img').attr('src'); // find the img element in the row and get its src
|
||||
// console.log(imageSrc);
|
||||
self.printItem(itemId, imageSrc);
|
||||
});
|
||||
|
||||
this.loading = false;
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
$(function () {
|
||||
app.mount('#app');
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace PSTW_CentralSystem.Controllers.JSA
|
||||
namespace PSTW_CentralSystem.Views.JSA
|
||||
{
|
||||
public class JSAController : Controller
|
||||
{
|
||||
@ -1,7 +1,8 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
|
||||
@{
|
||||
}
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
@ -726,6 +727,5 @@
|
||||
<!-- Datatables JS-->
|
||||
<script src="~/lib/datatables/datatables.js"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "Server=localhost;uid=root;Password='';Database=web_interface;"
|
||||
//"DefaultConnection": "server=175.136.244.102;user id=root;password=tw_mysql_root;port=3306;database=web_interface"
|
||||
"AuthConnnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_auth;", //DB_dev connection
|
||||
"InventoryConnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_inventory;" //DB_dev connection
|
||||
"DefaultConnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs;" //DB_dev connection
|
||||
//"DefaultConnection": "Server=219.92.7.60;Port=3307;uid=intern;password='intern_mysql_acct';database=web_interface;"//DB_dev connection
|
||||
},
|
||||
"Logging": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user