Compare commits
2 Commits
391a359a9f
...
907a171616
| Author | SHA1 | Date | |
|---|---|---|---|
| 907a171616 | |||
| 8135725180 |
@ -1,5 +1,8 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PSTW_CentralSystem.Models;
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||||
{
|
{
|
||||||
@ -12,6 +15,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
|||||||
public required int DepartmentId { get; set; }
|
public required int DepartmentId { get; set; }
|
||||||
public required int ProductId { get; set; }
|
public required int ProductId { get; set; }
|
||||||
public required string? SerialNumber { get; set; }
|
public required string? SerialNumber { get; set; }
|
||||||
|
public required string? TeamType { get; set; }
|
||||||
public required int Quantity { get; set; }
|
public required int Quantity { get; set; }
|
||||||
public required string Supplier { get; set; }
|
public required string Supplier { get; set; }
|
||||||
public required DateTime PurchaseDate { get; set; }
|
public required DateTime PurchaseDate { get; set; }
|
||||||
@ -20,10 +24,18 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
|||||||
public required float PriceInRM { get; set; }
|
public required float PriceInRM { get; set; }
|
||||||
public required float CurrencyRate { get; set; }
|
public required float CurrencyRate { get; set; }
|
||||||
public required float ConvertPrice { get; set; }
|
public required float ConvertPrice { get; set; }
|
||||||
public required DateTime DODate { get; set; }
|
public string? DONo { get; set; }
|
||||||
|
public DateTime? DODate { get; set; }
|
||||||
public required int Warranty { get; set; }
|
public required int Warranty { get; set; }
|
||||||
public required DateTime EndWDate { get; set; }
|
public required DateTime EndWDate { get; set; }
|
||||||
public required DateTime InvoiceDate { 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; }
|
||||||
[ForeignKey("CompanyId")]
|
[ForeignKey("CompanyId")]
|
||||||
public virtual CompanyModel? Company { get; set; }
|
public virtual CompanyModel? Company { get; set; }
|
||||||
[ForeignKey("DepartmentId")]
|
[ForeignKey("DepartmentId")]
|
||||||
|
|||||||
6
Areas/Inventory/Models/StoreModel.cs
Normal file
6
Areas/Inventory/Models/StoreModel.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
||||||
|
{
|
||||||
|
public class StoreModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,6 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Item Form";
|
ViewData["Title"] = "Item Form";
|
||||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
|
|
||||||
}
|
}
|
||||||
<style>
|
<style>
|
||||||
.table td img {
|
.table td img {
|
||||||
@ -66,7 +65,7 @@
|
|||||||
<label class="col-sm-4 col-form-label">Company:</label>
|
<label class="col-sm-4 col-form-label">Company:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<select class="btn btn-primary dropdown-toggle" v-model="selectedCompany" required>
|
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedCompany" required>
|
||||||
<option class="btn-light" value="" disabled selected>Select Company</option>
|
<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>
|
<option class="btn-light" v-for="(item, index) in companies" :key="index" :value="item.companyId">{{item.companyName}}</option>
|
||||||
</select>
|
</select>
|
||||||
@ -78,20 +77,31 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-4 col-form-label">Department:</label>
|
<label class="col-sm-4 col-form-label">Department:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select class="btn btn-primary dropdown-toggle" v-model="selectedDepartment" required>
|
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedDepartment" required>
|
||||||
<option class="btn-light" value="" disabled selected>Select Department</option>
|
<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>
|
<option class="btn-light" v-for="(dept, index) in filteredDepartments" :key="index" :value="dept.departmentId">{{ dept.departmentName }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</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 *@
|
@* Product Name Coding *@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-4 col-form-label">Product Name:</label>
|
<label class="col-sm-4 col-form-label">Product Name:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<select class="btn btn-primary dropdown-toggle" v-model="selectedProduct" required>
|
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedProduct" required>
|
||||||
<option class="btn-light" value="" disabled selected>Select Product</option>
|
<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>
|
<option class="btn-light" v-for="(item, index) in products" :key="index" :value="item.productId">{{ item.productName + ' (' + item.modelNo + ')' }}</option>
|
||||||
</select>
|
</select>
|
||||||
@ -164,7 +174,7 @@
|
|||||||
<label class="col-sm-4 col-form-label">Supplier: </label>
|
<label class="col-sm-4 col-form-label">Supplier: </label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<select class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false" v-model="selectedSupplier" required>
|
<select class="btn btn-primary dropdown-toggle col-md-10" data-toggle="dropdown" aria-expanded="false" v-model="selectedSupplier" required>
|
||||||
<option class="btn-light" value="" disabled selected>Select Supplier</option>
|
<option class="btn-light" value="" disabled selected>Select Supplier</option>
|
||||||
<option class="btn-light" v-for="(item, index) in suppliers">{{ item.supplierName }}</option>
|
<option class="btn-light" v-for="(item, index) in suppliers">{{ item.supplierName }}</option>
|
||||||
</select>
|
</select>
|
||||||
@ -192,9 +202,9 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@* Item Price in RM *@
|
@* Item Price in RM *@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="priceInRM" class="col-sm-4">Item Price In(RM):</label>
|
<label for="priceInRM" class="col-sm-4">Default Item Price:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<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">
|
<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">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -202,9 +212,9 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="currency" class="col-sm-4">Select Currency:</label>
|
<label for="currency" class="col-sm-4">Select Currency:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select id="currency" name="currency" class="form-control" v-model="currency" v-on:change="convertCurrency()">
|
<select id="currency" name="currency" class="btn btn-primary form-control col-md-10" v-model="currency" v-on:change="convertCurrency()">
|
||||||
<option value="" disabled selected>Select a currency</option>
|
<option class="btn-light" value="" disabled selected>Select a currency</option>
|
||||||
<option v-for="(name, code) in currencies" :key="code" :value="code">
|
<option class="btn-light" v-for="(name, code) in currencies" :key="code" :value="code">
|
||||||
{{ code }} - {{ name }}
|
{{ code }} - {{ name }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
@ -215,7 +225,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="currencyRate" class="col-sm-4">Currency Rate(%):</label>
|
<label for="currencyRate" class="col-sm-4">Currency Rate(%):</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="number" id="currencyRate" name="currencyRate" class="form-control" placeholder="0.01%" step="0.01" v-on:input="convertCurrency()" required v-model="currencyRate">
|
<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">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -227,17 +237,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</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 *@
|
@* Delivery Order Date *@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="DODate" class="col-sm-4">Enter DO Date:</label>
|
<label for="DODate" class="col-sm-4">Enter DO Date:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="date" id="DODate" name="DODate" class="form-control" v-on:input="calculateWarrantyEndDate()" required v-model="DODate">
|
<input type="date" id="DODate" name="DODate" class="form-control" v-on:input="calculateWarrantyEndDate()" v-model="DODate">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* Warranty *@
|
@* Warranty *@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="warranty" class="col-sm-4">Enter Warranty Months(Number):</label>
|
<label for="warranty" class="col-sm-4">Enter Warranty (Months):</label>
|
||||||
<div class="col-sm-8">
|
<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">
|
<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>
|
</div>
|
||||||
@ -251,11 +269,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</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 *@
|
@* Invoice Date *@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="invoiceDate" class="col-sm-4">Invoice Date:</label>
|
<label for="invoiceDate" class="col-sm-4">Invoice Date:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="date" id="invoiceDate" name="invoiceDate" class="form-control" required v-model="invoiceDate">
|
<input type="date" id="invoiceDate" name="invoiceDate" class="form-control" v-model="invoiceDate">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -318,6 +344,8 @@
|
|||||||
],
|
],
|
||||||
company: "",
|
company: "",
|
||||||
Dept: null,
|
Dept: null,
|
||||||
|
teamTypes: ["Continuous", "Manual"],
|
||||||
|
teamType: "",
|
||||||
productName: null,
|
productName: null,
|
||||||
imageProduct: null,
|
imageProduct: null,
|
||||||
productCategory: null,
|
productCategory: null,
|
||||||
@ -326,13 +354,15 @@
|
|||||||
supplierName: null,
|
supplierName: null,
|
||||||
purchaseDate: null,
|
purchaseDate: null,
|
||||||
PO: null,
|
PO: null,
|
||||||
currency: null,
|
currency: "MYR",
|
||||||
priceInRM: null,
|
priceInRM: 0.01,
|
||||||
currencyRate: 1,
|
currencyRate: 1,
|
||||||
convertPrice: 0,
|
convertPrice: 0,
|
||||||
|
DONo:null,
|
||||||
DODate: null,
|
DODate: null,
|
||||||
warranty: 0,
|
warranty: 0,
|
||||||
EndWDate: null,
|
EndWDate: null,
|
||||||
|
invoiceNo: null,
|
||||||
invoiceDate: null,
|
invoiceDate: null,
|
||||||
products: [],
|
products: [],
|
||||||
depts: [],
|
depts: [],
|
||||||
@ -356,6 +386,8 @@
|
|||||||
loading: false,
|
loading: false,
|
||||||
thisQR: null,
|
thisQR: null,
|
||||||
items: [],
|
items: [],
|
||||||
|
currentUser: null,
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {// Log the token to check its value
|
mounted() {// Log the token to check its value
|
||||||
@ -366,6 +398,7 @@
|
|||||||
this.fetchCompanies();
|
this.fetchCompanies();
|
||||||
this.fetchProducts();
|
this.fetchProducts();
|
||||||
this.fetchSuppliers();
|
this.fetchSuppliers();
|
||||||
|
this.fetchUser();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filteredDepartments() {
|
filteredDepartments() {
|
||||||
@ -407,7 +440,8 @@
|
|||||||
DODate: this.DODate,
|
DODate: this.DODate,
|
||||||
Warranty: this.warranty,
|
Warranty: this.warranty,
|
||||||
EndWDate: this.EndWDate,
|
EndWDate: this.EndWDate,
|
||||||
InvoiceDate: this.invoiceDate
|
InvoiceDate: this.invoiceDate,
|
||||||
|
CreatedByUserId: this.currentUser,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -691,12 +725,12 @@
|
|||||||
//----------------------//
|
//----------------------//
|
||||||
//Calculate Total Price
|
//Calculate Total Price
|
||||||
convertCurrency() {
|
convertCurrency() {
|
||||||
const total = this.priceInRM / this.currencyRate;
|
const total = this.priceInRM * this.currencyRate;
|
||||||
this.convertPrice = total.toFixed(2);
|
this.convertPrice = total.toFixed(2);
|
||||||
this.priceInRM = this.priceInRM
|
this.priceInRM = this.priceInRM
|
||||||
.replace(/[^0-9.]/g, '') // Remove non-numeric characters except decimal points
|
// .replace(/[^0-9.]/g, '') // Remove non-numeric characters except decimal points
|
||||||
.replace(/(\..*)\..*/g, '$1') // Allow only one decimal point
|
// .replace(/(\..*)\..*/g, '$1') // Allow only one decimal point
|
||||||
.replace(/^(\d*\.\d{0,2})\d*$/, '$1'); // Limit to two decimal places
|
// .replace(/^(\d*\.\d{0,2})\d*$/, '$1'); // Limit to two decimal places
|
||||||
|
|
||||||
},
|
},
|
||||||
calculateWarrantyEndDate() {
|
calculateWarrantyEndDate() {
|
||||||
@ -792,6 +826,23 @@
|
|||||||
alert("An error occurred while generating the QR code.");
|
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>
|
</script>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Product Form";
|
ViewData["Title"] = "Product Form";
|
||||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
|
string userId = ViewBag.UserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PSTW_CentralSystem.DBContext;
|
using PSTW_CentralSystem.DBContext;
|
||||||
|
using PSTW_CentralSystem.Models;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Controllers.API
|
namespace PSTW_CentralSystem.Controllers.API
|
||||||
@ -10,12 +13,14 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
public class AdminAPI : Controller
|
public class AdminAPI : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private readonly AuthDBContext _authDbContext;
|
private readonly IdentityDBContext _authDbContext;
|
||||||
|
private readonly UserManager<UserModel> _userManager;
|
||||||
|
|
||||||
public AdminAPI(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
public AdminAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext, UserManager<UserModel> userManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_authDbContext = authDbContext;
|
||||||
|
_userManager = userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("GetClassAndMethodInformation")]
|
[HttpPost("GetClassAndMethodInformation")]
|
||||||
@ -45,6 +50,7 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
// Return the list as JSON
|
// Return the list as JSON
|
||||||
return Json(controllerAndMethodList);
|
return Json(controllerAndMethodList);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("GetListClassAndMethodInformation")]
|
[HttpPost("GetListClassAndMethodInformation")]
|
||||||
public async Task<IActionResult> GetListClassAndMethodInformation()
|
public async Task<IActionResult> GetListClassAndMethodInformation()
|
||||||
{
|
{
|
||||||
@ -73,6 +79,44 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
// Return the list as JSON
|
// Return the list as JSON
|
||||||
return Json(controllerAndMethodList);
|
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}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
57
Controllers/API/IdentityAPI.cs
Normal file
57
Controllers/API/IdentityAPI.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
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,12 +18,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
public class InvMainAPI : Controller
|
public class InvMainAPI : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<InvMainAPI> _logger;
|
private readonly ILogger<InvMainAPI> _logger;
|
||||||
private readonly AuthDBContext _authDbContext;
|
private readonly IdentityDBContext _identityDbContext;
|
||||||
|
private readonly InventoryDBContext _inventoryDbContext;
|
||||||
|
|
||||||
public InvMainAPI(ILogger<InvMainAPI> logger, AuthDBContext authDbContext)
|
public InvMainAPI(ILogger<InvMainAPI> logger, IdentityDBContext authDbContext, InventoryDBContext inventoryDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_identityDbContext = authDbContext;
|
||||||
|
_inventoryDbContext = inventoryDbContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DepartmentCompany
|
public class DepartmentCompany
|
||||||
@ -36,8 +38,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
|
|
||||||
public async Task<List<DepartmentCompany>> GetDepartmentWithCompanyList()
|
public async Task<List<DepartmentCompany>> GetDepartmentWithCompanyList()
|
||||||
{
|
{
|
||||||
var departmentList = await _authDbContext.Departments.ToListAsync();
|
var departmentList = await _identityDbContext.Departments.ToListAsync();
|
||||||
var companyList = await _authDbContext.Companies.ToListAsync();
|
var companyList = await _identityDbContext.Companies.ToListAsync();
|
||||||
|
|
||||||
// Create a new list to store departments with their company name
|
// Create a new list to store departments with their company name
|
||||||
var departmentWithCompanyList = departmentList.Select(department => new DepartmentCompany
|
var departmentWithCompanyList = departmentList.Select(department => new DepartmentCompany
|
||||||
@ -53,13 +55,13 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
}
|
}
|
||||||
public async Task<DepartmentCompany> GetDepartmentWithCompany(int companyId, int departmentId)
|
public async Task<DepartmentCompany> GetDepartmentWithCompany(int companyId, int departmentId)
|
||||||
{
|
{
|
||||||
var departmentList = await _authDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
var departmentList = await _identityDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
||||||
var companyList = await _authDbContext.Companies.FirstOrDefaultAsync(c => c.CompanyId == companyId);
|
var companyList = await _identityDbContext.Companies.FirstOrDefaultAsync(c => c.CompanyId == companyId);
|
||||||
|
|
||||||
// Create a new list to store departments with their company name
|
// Create a new list to store departments with their company name
|
||||||
var departmentWithCompany = new DepartmentCompany
|
var departmentWithCompany = new DepartmentCompany
|
||||||
{
|
{
|
||||||
DepartmentId = departmentList.DepartmentId,
|
DepartmentId = departmentList!.DepartmentId,
|
||||||
DepartmentName = departmentList.DepartmentName,
|
DepartmentName = departmentList.DepartmentName,
|
||||||
CompanyId = departmentList.CompanyId,
|
CompanyId = departmentList.CompanyId,
|
||||||
CompanyName = companyList?.CompanyName
|
CompanyName = companyList?.CompanyName
|
||||||
@ -74,7 +76,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("ManufacturerList")]
|
[HttpPost("ManufacturerList")]
|
||||||
public async Task<IActionResult> ManufacturerList()
|
public async Task<IActionResult> ManufacturerList()
|
||||||
{
|
{
|
||||||
var manifacturerList = await _authDbContext.Manufacturers.ToListAsync();
|
var manifacturerList = await _inventoryDbContext.Manufacturers.ToListAsync();
|
||||||
return Json(manifacturerList);
|
return Json(manifacturerList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,12 +94,12 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_authDbContext.Manufacturers.Add(new ManufacturerModel
|
_inventoryDbContext.Manufacturers.Add(new ManufacturerModel
|
||||||
{
|
{
|
||||||
ManufacturerName = manufacturer.ManufacturerName,
|
ManufacturerName = manufacturer.ManufacturerName,
|
||||||
});
|
});
|
||||||
await _authDbContext.SaveChangesAsync();
|
await _identityDbContext.SaveChangesAsync();
|
||||||
var updatedList = await _authDbContext.Manufacturers.ToListAsync();
|
var updatedList = await _inventoryDbContext.Manufacturers.ToListAsync();
|
||||||
return Json(updatedList);
|
return Json(updatedList);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -109,14 +111,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpDelete("DeleteManufacturer/{id}")]
|
[HttpDelete("DeleteManufacturer/{id}")]
|
||||||
public async Task<IActionResult> DeleteManufacturer(int id)
|
public async Task<IActionResult> DeleteManufacturer(int id)
|
||||||
{
|
{
|
||||||
var manufacturer = await _authDbContext.Manufacturers.FindAsync(id);
|
var manufacturer = await _inventoryDbContext.Manufacturers.FindAsync(id);
|
||||||
if (manufacturer == null)
|
if (manufacturer == null)
|
||||||
{
|
{
|
||||||
return NotFound(new { success = false, message = "Manufacturer not found" });
|
return NotFound(new { success = false, message = "Manufacturer not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
_authDbContext.Manufacturers.Remove(manufacturer);
|
_inventoryDbContext.Manufacturers.Remove(manufacturer);
|
||||||
await _authDbContext.SaveChangesAsync();
|
await _identityDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
return Ok(new { success = true, message = "Manufacturer deleted successfully" });
|
return Ok(new { success = true, message = "Manufacturer deleted successfully" });
|
||||||
}
|
}
|
||||||
@ -128,14 +130,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("ProductList")]
|
[HttpPost("ProductList")]
|
||||||
public async Task<IActionResult> ProductList()
|
public async Task<IActionResult> ProductList()
|
||||||
{
|
{
|
||||||
var productList = await _authDbContext.Products.Include("Manufacturer").ToListAsync();
|
var productList = await _inventoryDbContext.Products.Include("Manufacturer").ToListAsync();
|
||||||
return Json(productList);
|
return Json(productList);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("ProductListWithItem")]
|
[HttpPost("ProductListWithItem")]
|
||||||
public async Task<IActionResult> ProductListWithItem()
|
public async Task<IActionResult> ProductListWithItem()
|
||||||
{
|
{
|
||||||
var productList = await _authDbContext.Products
|
var productList = await _inventoryDbContext.Products
|
||||||
.Include(p => p.Items) // Include related items
|
.Include(p => p.Items) // Include related items
|
||||||
.Include(p => p.Manufacturer) // Include related manufacturer
|
.Include(p => p.Manufacturer) // Include related manufacturer
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
@ -167,9 +169,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
await System.IO.File.WriteAllBytesAsync(filePath, bytes);
|
await System.IO.File.WriteAllBytesAsync(filePath, bytes);
|
||||||
product.ImageProduct = "/media/inventory/images/" + product.ModelNo + ".jpg";
|
product.ImageProduct = "/media/inventory/images/" + product.ModelNo + ".jpg";
|
||||||
}
|
}
|
||||||
_authDbContext.Products.Add(product);
|
_inventoryDbContext.Products.Add(product);
|
||||||
await _authDbContext.SaveChangesAsync();
|
await _identityDbContext.SaveChangesAsync();
|
||||||
var updatedList = await _authDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
var updatedList = await _inventoryDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
||||||
return Json(updatedList);
|
return Json(updatedList);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -181,14 +183,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpDelete("DeleteProduct/{id}")]
|
[HttpDelete("DeleteProduct/{id}")]
|
||||||
public async Task<IActionResult> DeleteProduct(int id)
|
public async Task<IActionResult> DeleteProduct(int id)
|
||||||
{
|
{
|
||||||
var Product = await _authDbContext.Products.FindAsync(id);
|
var Product = await _inventoryDbContext.Products.FindAsync(id);
|
||||||
if (Product == null)
|
if (Product == null)
|
||||||
{
|
{
|
||||||
return NotFound(new { success = false, message = "Product not found" });
|
return NotFound(new { success = false, message = "Product not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
_authDbContext.Products.Remove(Product);
|
_inventoryDbContext.Products.Remove(Product);
|
||||||
await _authDbContext.SaveChangesAsync();
|
await _identityDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
return Ok(new { success = true, message = "Product deleted successfully" });
|
return Ok(new { success = true, message = "Product deleted successfully" });
|
||||||
}
|
}
|
||||||
@ -200,7 +202,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("CompanyDepartmentList")]
|
[HttpPost("CompanyDepartmentList")]
|
||||||
public async Task<IActionResult> CompanyDepartmentList()
|
public async Task<IActionResult> CompanyDepartmentList()
|
||||||
{
|
{
|
||||||
var companyList = await _authDbContext.Companies
|
var companyList = await _identityDbContext.Companies
|
||||||
.Include(c => c.Departments)
|
.Include(c => c.Departments)
|
||||||
.Select(c => new { c.CompanyId, c.CompanyName, Departments = c.Departments
|
.Select(c => new { c.CompanyId, c.CompanyName, Departments = c.Departments
|
||||||
.OrderBy(d => d.DepartmentId)
|
.OrderBy(d => d.DepartmentId)
|
||||||
@ -217,7 +219,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("DepartmentCompanyList")]
|
[HttpPost("DepartmentCompanyList")]
|
||||||
public async Task<IActionResult> DepartmentCompanyList()
|
public async Task<IActionResult> DepartmentCompanyList()
|
||||||
{
|
{
|
||||||
var itemDepartment = await _authDbContext.Departments
|
var itemDepartment = await _identityDbContext.Departments
|
||||||
.Include(d => d.Company) // Include the related Company entity
|
.Include(d => d.Company) // Include the related Company entity
|
||||||
.Select(d => new
|
.Select(d => new
|
||||||
{
|
{
|
||||||
@ -239,7 +241,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("SupplierList")]
|
[HttpPost("SupplierList")]
|
||||||
public async Task<IActionResult> SupplierList()
|
public async Task<IActionResult> SupplierList()
|
||||||
{
|
{
|
||||||
var supplierList = await _authDbContext.Suppliers.ToListAsync();
|
var supplierList = await _inventoryDbContext.Suppliers.ToListAsync();
|
||||||
return Json(supplierList);
|
return Json(supplierList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +252,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("ItemList")]
|
[HttpPost("ItemList")]
|
||||||
public async Task<IActionResult> ItemList()
|
public async Task<IActionResult> ItemList()
|
||||||
{
|
{
|
||||||
var itemList = await _authDbContext.Items.ToListAsync();
|
var itemList = await _inventoryDbContext.Items.ToListAsync();
|
||||||
// Retrieve the request's host and scheme
|
// Retrieve the request's host and scheme
|
||||||
var request = HttpContext.Request;
|
var request = HttpContext.Request;
|
||||||
string domain = $"{request.Scheme}://{request.Host.Value}";
|
string domain = $"{request.Scheme}://{request.Host.Value}";
|
||||||
@ -305,7 +307,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var product = await _authDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("Product not found");
|
var product = await _inventoryDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("Product not found");
|
||||||
|
|
||||||
var addToProduct = item.Quantity;
|
var addToProduct = item.Quantity;
|
||||||
product.QuantityProduct += addToProduct;
|
product.QuantityProduct += addToProduct;
|
||||||
@ -315,17 +317,17 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
item.SerialNumber = null;
|
item.SerialNumber = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_authDbContext.Items.Add(item);
|
_inventoryDbContext.Items.Add(item);
|
||||||
_authDbContext.Products.Update(product);
|
_inventoryDbContext.Products.Update(product);
|
||||||
await _authDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
await _identityDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
||||||
|
|
||||||
// Fetch the generated ItemID
|
// Fetch the generated ItemID
|
||||||
var savedItem = await _authDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
|
var savedItem = await _inventoryDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
|
||||||
|
|
||||||
if (savedItem != null)
|
if (savedItem != null)
|
||||||
{
|
{
|
||||||
var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
||||||
var itemProduct = _authDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
var itemProduct = _inventoryDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
||||||
|
|
||||||
string? companyInitial = companyDepartment!.CompanyName?.ToString().Substring(0, 1).ToUpper();
|
string? companyInitial = companyDepartment!.CompanyName?.ToString().Substring(0, 1).ToUpper();
|
||||||
string? departmentInitial = companyDepartment!.DepartmentName?.ToString().Substring(0, 1).ToUpper();
|
string? departmentInitial = companyDepartment!.DepartmentName?.ToString().Substring(0, 1).ToUpper();
|
||||||
@ -335,8 +337,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
var uniqueId = $"{companyInitial}{departmentInitial}{initialCategory}{productId}{itemId}".ToUpper();
|
var uniqueId = $"{companyInitial}{departmentInitial}{initialCategory}{productId}{itemId}".ToUpper();
|
||||||
savedItem.UniqueID = uniqueId;
|
savedItem.UniqueID = uniqueId;
|
||||||
|
|
||||||
_authDbContext.Items.Update(savedItem);
|
_inventoryDbContext.Items.Update(savedItem);
|
||||||
await _authDbContext.SaveChangesAsync();
|
await _identityDbContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
var updatedItem = new
|
var updatedItem = new
|
||||||
{
|
{
|
||||||
@ -370,14 +372,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpDelete("DeleteItem/{id}")]
|
[HttpDelete("DeleteItem/{id}")]
|
||||||
public async Task<IActionResult> DeleteItem(int id)
|
public async Task<IActionResult> DeleteItem(int id)
|
||||||
{
|
{
|
||||||
var item = await _authDbContext.Items.FindAsync(id);
|
var item = await _inventoryDbContext.Items.FindAsync(id);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
return NotFound(new { success = false, message = "Item not found" });
|
return NotFound(new { success = false, message = "Item not found" });
|
||||||
}
|
}
|
||||||
|
|
||||||
_authDbContext.Items.Remove(item);
|
_inventoryDbContext.Items.Remove(item);
|
||||||
await _authDbContext.SaveChangesAsync();
|
await _identityDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
return Ok(new { success = true, message = "Item deleted successfully" });
|
return Ok(new { success = true, message = "Item deleted successfully" });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,8 +11,8 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
public class ModuleAPI : Controller
|
public class ModuleAPI : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private readonly AuthDBContext _authDbContext;
|
private readonly IdentityDBContext _authDbContext;
|
||||||
public ModuleAPI(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
public ModuleAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_authDbContext = authDbContext;
|
||||||
|
|||||||
@ -10,9 +10,9 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
{
|
{
|
||||||
|
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private readonly AuthDBContext _authDbContext;
|
private readonly IdentityDBContext _authDbContext;
|
||||||
|
|
||||||
public RoleAPI(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
public RoleAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_authDbContext = authDbContext;
|
||||||
|
|||||||
@ -9,10 +9,10 @@ namespace PSTW_CentralSystem.Controllers
|
|||||||
//[Authorize(Policy = "RoleModulePolicy")]
|
//[Authorize(Policy = "RoleModulePolicy")]
|
||||||
public class AdminController : Controller
|
public class AdminController : Controller
|
||||||
{
|
{
|
||||||
private readonly AuthDBContext _authDbContext;
|
private readonly IdentityDBContext _authDbContext;
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
|
||||||
public AdminController(ILogger<HomeController> logger, AuthDBContext authDbContext)
|
public AdminController(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_authDbContext = authDbContext;
|
||||||
@ -27,6 +27,7 @@ namespace PSTW_CentralSystem.Controllers
|
|||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult ModuleSetting(int? id)
|
public IActionResult ModuleSetting(int? id)
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
@ -48,5 +49,19 @@ namespace PSTW_CentralSystem.Controllers
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IActionResult UserAdmin()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult UserSetting()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult UserCreate()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Views.JSA
|
namespace PSTW_CentralSystem.Controllers.JSA
|
||||||
{
|
{
|
||||||
public class JSAController : Controller
|
public class JSAController : Controller
|
||||||
{
|
{
|
||||||
@ -14,11 +14,11 @@ namespace PSTW_CentralSystem.CustomPolicy
|
|||||||
}
|
}
|
||||||
public class RoleModuleHandler : AuthorizationHandler<RoleModulePolicy>
|
public class RoleModuleHandler : AuthorizationHandler<RoleModulePolicy>
|
||||||
{
|
{
|
||||||
private readonly AuthDBContext _authDBContext;
|
private readonly IdentityDBContext _authDBContext;
|
||||||
private readonly UserManager<UserModel> _userManager;
|
private readonly UserManager<UserModel> _userManager;
|
||||||
private readonly RoleManager<RoleModel> _roleManager;
|
private readonly RoleManager<RoleModel> _roleManager;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
public RoleModuleHandler( AuthDBContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
public RoleModuleHandler( IdentityDBContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_authDBContext = authDBContext;
|
_authDBContext = authDBContext;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PSTW_CentralSystem.Areas.Inventory.Models;
|
using PSTW_CentralSystem.Areas.Inventory.Models;
|
||||||
using PSTW_CentralSystem.Models;
|
using PSTW_CentralSystem.Models;
|
||||||
@ -8,10 +9,10 @@ using System.Text.Json;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.DBContext
|
namespace PSTW_CentralSystem.DBContext
|
||||||
{
|
{
|
||||||
public class AuthDBContext : IdentityDbContext<UserModel, RoleModel, int>
|
public class IdentityDBContext : IdentityDbContext<UserModel, RoleModel, int>
|
||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||||
public AuthDBContext(DbContextOptions<AuthDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
public IdentityDBContext(DbContextOptions<IdentityDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||||
{
|
{
|
||||||
_hostingEnvironment = hostingEnvironment;
|
_hostingEnvironment = hostingEnvironment;
|
||||||
}
|
}
|
||||||
@ -24,7 +25,13 @@ namespace PSTW_CentralSystem.DBContext
|
|||||||
.Property(e => e.MethodAllowedUserType)
|
.Property(e => e.MethodAllowedUserType)
|
||||||
.HasConversion(
|
.HasConversion(
|
||||||
v => JsonConvert.SerializeObject(v), // Convert List<MethodAllowedUserType> to JSON string
|
v => JsonConvert.SerializeObject(v), // Convert List<MethodAllowedUserType> to JSON string
|
||||||
v => JsonConvert.DeserializeObject<List<MethodAllowedUserType>>(v));
|
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
|
||||||
|
));
|
||||||
|
|
||||||
// Seeding Roles
|
// Seeding Roles
|
||||||
modelBuilder.Entity<RoleModel>().HasData(
|
modelBuilder.Entity<RoleModel>().HasData(
|
||||||
@ -67,6 +74,10 @@ namespace PSTW_CentralSystem.DBContext
|
|||||||
// Seeding AdminRole
|
// Seeding AdminRole
|
||||||
modelBuilder.Entity<IdentityUserRole<int>>().HasData(
|
modelBuilder.Entity<IdentityUserRole<int>>().HasData(
|
||||||
new IdentityUserRole<int> { UserId = 1, RoleId = 1 });
|
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; }
|
public new DbSet<UserModel> Users { get; set; }
|
||||||
@ -74,10 +85,6 @@ namespace PSTW_CentralSystem.DBContext
|
|||||||
public DbSet<ModuleSettingModel> ModuleSettings { get; set; }
|
public DbSet<ModuleSettingModel> ModuleSettings { get; set; }
|
||||||
public DbSet<CompanyModel> Companies { get; set; }
|
public DbSet<CompanyModel> Companies { get; set; }
|
||||||
public DbSet<DepartmentModel> Departments { 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; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
28
DBContext/InventoryDBContext.cs
Normal file
28
DBContext/InventoryDBContext.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
647
Migrations/20241129023507_UpdateItemModel.Designer.cs
generated
647
Migrations/20241129023507_UpdateItemModel.Designer.cs
generated
@ -1,647 +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
|
|
||||||
{
|
|
||||||
[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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
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" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -11,8 +11,8 @@ using PSTW_CentralSystem.DBContext;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.Migrations
|
namespace PSTW_CentralSystem.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AuthDBContext))]
|
[DbContext(typeof(IdentityDBContext))]
|
||||||
[Migration("20241128045608_Initiate")]
|
[Migration("20241206015840_Initiate")]
|
||||||
partial class Initiate
|
partial class Initiate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -113,6 +113,11 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
UserId = 1,
|
UserId = 1,
|
||||||
RoleId = 1
|
RoleId = 1
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
UserId = 2,
|
||||||
|
RoleId = 2
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -135,7 +140,7 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("AspNetUserTokens", (string)null);
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("CompanyId")
|
b.Property<int>("CompanyId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -152,7 +157,7 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("Companies");
|
b.ToTable("Companies");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("DepartmentId")
|
b.Property<int>("DepartmentId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -163,6 +168,10 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Property<int>("CompanyId")
|
b.Property<int>("CompanyId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("DepartmentCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<string>("DepartmentName")
|
b.Property<string>("DepartmentName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("longtext");
|
.HasColumnType("longtext");
|
||||||
@ -174,164 +183,6 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("Departments");
|
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 =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("SettingId")
|
b.Property<int>("SettingId")
|
||||||
@ -485,6 +336,9 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Property<int?>("UserStatus")
|
b.Property<int?>("UserStatus")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("departmentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
b.HasIndex("NormalizedEmail")
|
||||||
@ -494,6 +348,8 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
.IsUnique()
|
.IsUnique()
|
||||||
.HasDatabaseName("UserNameIndex");
|
.HasDatabaseName("UserNameIndex");
|
||||||
|
|
||||||
|
b.HasIndex("departmentId");
|
||||||
|
|
||||||
b.ToTable("AspNetUsers", (string)null);
|
b.ToTable("AspNetUsers", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
@ -501,16 +357,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "df01136b-c869-4bc3-9512-34a9cdc8f73d",
|
ConcurrencyStamp = "b58597b6-2835-4ff6-b437-11ec7a213434",
|
||||||
Email = "admin@pstw.com.my",
|
Email = "admin@pstw.com.my",
|
||||||
EmailConfirmed = true,
|
EmailConfirmed = true,
|
||||||
FullName = "MAAdmin",
|
FullName = "MAAdmin",
|
||||||
LockoutEnabled = false,
|
LockoutEnabled = false,
|
||||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||||
PasswordHash = "AQAAAAIAAYagAAAAECcU3fIsIpqE1gECPg262gMejQiypGUXipVbiRtF66ywBqUHdohCj89hiJAafOlrPQ==",
|
PasswordHash = "AQAAAAIAAYagAAAAECA03al9kGFTKlmmTls3wiH4NV7HlL76680Qx6lR7d77LHJwIN6/Wt1MBCP9TE1qfg==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "d36451ff-cfab-46e1-bf80-6b428d79a19b",
|
SecurityStamp = "0f649a27-6566-436c-bc27-d1a6b8e7f846",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserName = "admin@pstw.com.my"
|
UserName = "admin@pstw.com.my"
|
||||||
},
|
},
|
||||||
@ -518,16 +374,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "6f7244cf-e611-4088-890a-72939cfbefa5",
|
ConcurrencyStamp = "cf9424fc-8afc-4f59-a0a6-34574676273c",
|
||||||
Email = "sysadmin@pstw.com.my",
|
Email = "sysadmin@pstw.com.my",
|
||||||
EmailConfirmed = true,
|
EmailConfirmed = true,
|
||||||
FullName = "SysAdmin",
|
FullName = "SysAdmin",
|
||||||
LockoutEnabled = false,
|
LockoutEnabled = false,
|
||||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||||
PasswordHash = "AQAAAAIAAYagAAAAEJwGvD0ionYUADG6FQvuXiK0/897GSnJ8z55w1P0GaItbNjjypF1+aDuRViCZMUQ+g==",
|
PasswordHash = "AQAAAAIAAYagAAAAEMkwXv250FjOjdLEAY2a/aEF3g3iu9xCVORV/MH37kVcj8vgJez+LlfJtjklaschLg==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "50df1ec2-4ba7-4eb5-84a3-ffb35b44f391",
|
SecurityStamp = "8efe9683-78fb-404d-96a9-b8b7302c03b2",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserName = "sysadmin@pstw.com.my"
|
UserName = "sysadmin@pstw.com.my"
|
||||||
});
|
});
|
||||||
@ -584,9 +440,9 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||||
.WithMany("Departments")
|
.WithMany("Departments")
|
||||||
.HasForeignKey("CompanyId")
|
.HasForeignKey("CompanyId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@ -595,53 +451,19 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Navigation("Company");
|
b.Navigation("Company");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CompanyId")
|
.HasForeignKey("departmentId");
|
||||||
.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("Department");
|
||||||
|
|
||||||
b.Navigation("Product");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", 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");
|
b.Navigation("Departments");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Items");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,44 +38,6 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "AspNetUsers",
|
|
||||||
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),
|
|
||||||
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)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
NormalizedEmail = table.Column<string>(type: "varchar(256)", maxLength: 256, 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_AspNetUsers", x => x.Id);
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Companies",
|
name: "Companies",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -91,21 +53,6 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.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(
|
migrationBuilder.CreateTable(
|
||||||
name: "ModuleSettings",
|
name: "ModuleSettings",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -128,27 +75,6 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.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(
|
migrationBuilder.CreateTable(
|
||||||
name: "AspNetRoleClaims",
|
name: "AspNetRoleClaims",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -173,6 +99,74 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.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
|
||||||
|
{
|
||||||
|
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: "varchar(256)", maxLength: 256, nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
NormalizedUserName = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Email = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
NormalizedEmail = table.Column<string>(type: "varchar(256)", maxLength: 256, 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_AspNetUsers", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_AspNetUsers_Departments_departmentId",
|
||||||
|
column: x => x.departmentId,
|
||||||
|
principalTable: "Departments",
|
||||||
|
principalColumn: "DepartmentId");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "AspNetUserClaims",
|
name: "AspNetUserClaims",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -270,110 +264,6 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.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(
|
migrationBuilder.InsertData(
|
||||||
table: "AspNetRoles",
|
table: "AspNetRoles",
|
||||||
columns: new[] { "Id", "ConcurrencyStamp", "Description", "Name", "NormalizedName" },
|
columns: new[] { "Id", "ConcurrencyStamp", "Description", "Name", "NormalizedName" },
|
||||||
@ -387,17 +277,21 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
|
|
||||||
migrationBuilder.InsertData(
|
migrationBuilder.InsertData(
|
||||||
table: "AspNetUsers",
|
table: "AspNetUsers",
|
||||||
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName", "UserStatus" },
|
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName", "UserStatus", "departmentId" },
|
||||||
values: new object[,]
|
values: new object[,]
|
||||||
{
|
{
|
||||||
{ 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 },
|
{ 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, "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 }
|
{ 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 }
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
migrationBuilder.InsertData(
|
||||||
table: "AspNetUserRoles",
|
table: "AspNetUserRoles",
|
||||||
columns: new[] { "RoleId", "UserId" },
|
columns: new[] { "RoleId", "UserId" },
|
||||||
values: new object[] { 1, 1 });
|
values: new object[,]
|
||||||
|
{
|
||||||
|
{ 1, 1 },
|
||||||
|
{ 2, 2 }
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_AspNetRoleClaims_RoleId",
|
name: "IX_AspNetRoleClaims_RoleId",
|
||||||
@ -430,6 +324,11 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
table: "AspNetUsers",
|
table: "AspNetUsers",
|
||||||
column: "NormalizedEmail");
|
column: "NormalizedEmail");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_AspNetUsers_departmentId",
|
||||||
|
table: "AspNetUsers",
|
||||||
|
column: "departmentId");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "UserNameIndex",
|
name: "UserNameIndex",
|
||||||
table: "AspNetUsers",
|
table: "AspNetUsers",
|
||||||
@ -440,26 +339,6 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
name: "IX_Departments_CompanyId",
|
name: "IX_Departments_CompanyId",
|
||||||
table: "Departments",
|
table: "Departments",
|
||||||
column: "CompanyId");
|
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 />
|
/// <inheritdoc />
|
||||||
@ -480,15 +359,9 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "AspNetUserTokens");
|
name: "AspNetUserTokens");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Items");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ModuleSettings");
|
name: "ModuleSettings");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Suppliers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "AspNetRoles");
|
name: "AspNetRoles");
|
||||||
|
|
||||||
@ -498,14 +371,8 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Departments");
|
name: "Departments");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Products");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Companies");
|
name: "Companies");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Manufacturers");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,8 +10,8 @@ using PSTW_CentralSystem.DBContext;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.Migrations
|
namespace PSTW_CentralSystem.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(AuthDBContext))]
|
[DbContext(typeof(IdentityDBContext))]
|
||||||
partial class AuthDBContextModelSnapshot : ModelSnapshot
|
partial class IdentityDBContextModelSnapshot : ModelSnapshot
|
||||||
{
|
{
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@ -110,6 +110,11 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
UserId = 1,
|
UserId = 1,
|
||||||
RoleId = 1
|
RoleId = 1
|
||||||
|
},
|
||||||
|
new
|
||||||
|
{
|
||||||
|
UserId = 2,
|
||||||
|
RoleId = 2
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -132,7 +137,7 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("AspNetUserTokens", (string)null);
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("CompanyId")
|
b.Property<int>("CompanyId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -149,7 +154,7 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("Companies");
|
b.ToTable("Companies");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("DepartmentId")
|
b.Property<int>("DepartmentId")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -160,6 +165,10 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Property<int>("CompanyId")
|
b.Property<int>("CompanyId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("DepartmentCode")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
b.Property<string>("DepartmentName")
|
b.Property<string>("DepartmentName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("longtext");
|
.HasColumnType("longtext");
|
||||||
@ -171,163 +180,6 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("Departments");
|
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 =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("SettingId")
|
b.Property<int>("SettingId")
|
||||||
@ -481,6 +333,9 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Property<int?>("UserStatus")
|
b.Property<int?>("UserStatus")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("departmentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("NormalizedEmail")
|
b.HasIndex("NormalizedEmail")
|
||||||
@ -490,6 +345,8 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
.IsUnique()
|
.IsUnique()
|
||||||
.HasDatabaseName("UserNameIndex");
|
.HasDatabaseName("UserNameIndex");
|
||||||
|
|
||||||
|
b.HasIndex("departmentId");
|
||||||
|
|
||||||
b.ToTable("AspNetUsers", (string)null);
|
b.ToTable("AspNetUsers", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
@ -497,16 +354,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "9577ec05-b14b-4fe2-9d75-cb6aa1ce25be",
|
ConcurrencyStamp = "b58597b6-2835-4ff6-b437-11ec7a213434",
|
||||||
Email = "admin@pstw.com.my",
|
Email = "admin@pstw.com.my",
|
||||||
EmailConfirmed = true,
|
EmailConfirmed = true,
|
||||||
FullName = "MAAdmin",
|
FullName = "MAAdmin",
|
||||||
LockoutEnabled = false,
|
LockoutEnabled = false,
|
||||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||||
PasswordHash = "AQAAAAIAAYagAAAAEKPk6s6BTBEv5y5S9pOYk6OvLO6XfHhiylslKoOPbAQIAaG9DJZ27ltRHKwe34Na6w==",
|
PasswordHash = "AQAAAAIAAYagAAAAECA03al9kGFTKlmmTls3wiH4NV7HlL76680Qx6lR7d77LHJwIN6/Wt1MBCP9TE1qfg==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "8f828c08-90d7-4a77-a8b0-a317e7ecadbc",
|
SecurityStamp = "0f649a27-6566-436c-bc27-d1a6b8e7f846",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserName = "admin@pstw.com.my"
|
UserName = "admin@pstw.com.my"
|
||||||
},
|
},
|
||||||
@ -514,16 +371,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "75cb87bb-bba0-410e-83a0-b23b54dfa2f6",
|
ConcurrencyStamp = "cf9424fc-8afc-4f59-a0a6-34574676273c",
|
||||||
Email = "sysadmin@pstw.com.my",
|
Email = "sysadmin@pstw.com.my",
|
||||||
EmailConfirmed = true,
|
EmailConfirmed = true,
|
||||||
FullName = "SysAdmin",
|
FullName = "SysAdmin",
|
||||||
LockoutEnabled = false,
|
LockoutEnabled = false,
|
||||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||||
PasswordHash = "AQAAAAIAAYagAAAAEPmeMMNew971MNbCbXypkCQ9L2EFXyjcFUhEjX7aPJCC4B+aRavO/201MVOvU/VFIQ==",
|
PasswordHash = "AQAAAAIAAYagAAAAEMkwXv250FjOjdLEAY2a/aEF3g3iu9xCVORV/MH37kVcj8vgJez+LlfJtjklaschLg==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "4480b7af-adbc-4d83-9527-511f99593aac",
|
SecurityStamp = "8efe9683-78fb-404d-96a9-b8b7302c03b2",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserName = "sysadmin@pstw.com.my"
|
UserName = "sysadmin@pstw.com.my"
|
||||||
});
|
});
|
||||||
@ -580,9 +437,9 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||||
.WithMany("Departments")
|
.WithMany("Departments")
|
||||||
.HasForeignKey("CompanyId")
|
.HasForeignKey("CompanyId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
@ -591,53 +448,19 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Navigation("Company");
|
b.Navigation("Company");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
|
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CompanyId")
|
.HasForeignKey("departmentId");
|
||||||
.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("Department");
|
||||||
|
|
||||||
b.Navigation("Product");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", 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");
|
b.Navigation("Departments");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Items");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
#pragma warning restore 612, 618
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
394
Migrations/InventoryDB/20241206071642_Initiate.Designer.cs
generated
Normal file
394
Migrations/InventoryDB/20241206071642_Initiate.Designer.cs
generated
Normal file
@ -0,0 +1,394 @@
|
|||||||
|
// <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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
296
Migrations/InventoryDB/20241206071642_Initiate.cs
Normal file
296
Migrations/InventoryDB/20241206071642_Initiate.cs
Normal file
@ -0,0 +1,296 @@
|
|||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
391
Migrations/InventoryDB/InventoryDBContextModelSnapshot.cs
Normal file
391
Migrations/InventoryDB/InventoryDBContextModelSnapshot.cs
Normal file
@ -0,0 +1,391 @@
|
|||||||
|
// <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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
namespace PSTW_CentralSystem.Models
|
||||||
{
|
{
|
||||||
public class CompanyModel
|
public class CompanyModel
|
||||||
{
|
{
|
||||||
@ -1,13 +1,14 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Areas.Inventory.Models
|
namespace PSTW_CentralSystem.Models
|
||||||
{
|
{
|
||||||
public class DepartmentModel
|
public class DepartmentModel
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int DepartmentId { get; set; }
|
public int DepartmentId { get; set; }
|
||||||
public required string DepartmentName { get; set; }
|
public required string DepartmentName { get; set; }
|
||||||
|
public required string DepartmentCode { get; set; }
|
||||||
public required int CompanyId { get; set; }
|
public required int CompanyId { get; set; }
|
||||||
|
|
||||||
[ForeignKey("CompanyId")]
|
[ForeignKey("CompanyId")]
|
||||||
@ -9,5 +9,9 @@ namespace PSTW_CentralSystem.Models
|
|||||||
// Add custom properties
|
// Add custom properties
|
||||||
public string? FullName { get; set; }
|
public string? FullName { get; set; }
|
||||||
public int? UserStatus { get; set; }
|
public int? UserStatus { get; set; }
|
||||||
|
public int? departmentId { get; set; }
|
||||||
|
[ForeignKey("departmentId")]
|
||||||
|
public virtual DepartmentModel? Department { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
<Folder Include="Controllers\JSA\API\" />
|
<Folder Include="Controllers\JSA\API\" />
|
||||||
<Folder Include="Logs\" />
|
<Folder Include="Logs\" />
|
||||||
<Folder Include="Migrations\" />
|
<Folder Include="Migrations\" />
|
||||||
|
<Folder Include="Views\JSA\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
20
Program.cs
20
Program.cs
@ -11,7 +11,8 @@ internal class Program
|
|||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
var authConnectionString = builder.Configuration.GetConnectionString("AuthConnnection");
|
||||||
|
var inventoryConnectionString = builder.Configuration.GetConnectionString("InventoryConnection");
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
@ -31,12 +32,23 @@ internal class Program
|
|||||||
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}"))
|
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}"))
|
||||||
.WriteTo.Console()
|
.WriteTo.Console()
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
|
// Set default session to 30 minutes
|
||||||
|
builder.Services.AddSession(options =>
|
||||||
|
{
|
||||||
|
options.IdleTimeout = TimeSpan.FromDays(30);
|
||||||
|
});
|
||||||
|
|
||||||
builder.Logging.AddSerilog();
|
builder.Logging.AddSerilog();
|
||||||
|
|
||||||
builder.Services.AddDbContext<AuthDBContext>(options =>
|
builder.Services.AddDbContext<IdentityDBContext>(options =>
|
||||||
{
|
{
|
||||||
options.UseMySql(connectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
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)),
|
||||||
mysqlOptions => mysqlOptions.CommandTimeout(120)
|
mysqlOptions => mysqlOptions.CommandTimeout(120)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -44,7 +56,7 @@ internal class Program
|
|||||||
//builder.Services.AddDefaultIdentity<UserModel>(options => options.SignIn.RequireConfirmedAccount = true).AddEntityFrameworkStores<AuthDBContext>();
|
//builder.Services.AddDefaultIdentity<UserModel>(options => options.SignIn.RequireConfirmedAccount = true).AddEntityFrameworkStores<AuthDBContext>();
|
||||||
|
|
||||||
builder.Services.AddIdentity<UserModel, RoleModel>(options => options.SignIn.RequireConfirmedAccount = true)
|
builder.Services.AddIdentity<UserModel, RoleModel>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||||
.AddEntityFrameworkStores<AuthDBContext>()
|
.AddEntityFrameworkStores<IdentityDBContext>()
|
||||||
.AddDefaultUI()
|
.AddDefaultUI()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
}
|
}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-lg-3">
|
<div class="col-md-6 col-lg-3">
|
||||||
|
<a asp-controller="Admin" asp-action="UserAdmin">
|
||||||
<div class="card card-hover">
|
<div class="card card-hover">
|
||||||
<div class="box bg-cyan text-center">
|
<div class="box bg-cyan text-center">
|
||||||
<h1 class="font-light text-white">
|
<h1 class="font-light text-white">
|
||||||
@ -15,5 +16,18 @@
|
|||||||
<h6 class="text-white">Dashboard</h6>
|
<h6 class="text-white">Dashboard</h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|||||||
241
Views/Admin/UserAdmin.cshtml
Normal file
241
Views/Admin/UserAdmin.cshtml
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
@*
|
||||||
|
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,8 +1,7 @@
|
|||||||
@*
|
@*
|
||||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
*@
|
*@
|
||||||
@{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -727,5 +726,6 @@
|
|||||||
<!-- Datatables JS-->
|
<!-- Datatables JS-->
|
||||||
<script src="~/lib/datatables/datatables.js"></script>
|
<script src="~/lib/datatables/datatables.js"></script>
|
||||||
@await RenderSectionAsync("Scripts", required: false)
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"DefaultConnection": "Server=localhost;uid=root;Password='';Database=web_interface;"
|
//"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"
|
//"DefaultConnection": "server=175.136.244.102;user id=root;password=tw_mysql_root;port=3306;database=web_interface"
|
||||||
"DefaultConnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs;" //DB_dev connection
|
"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=intern;password='intern_mysql_acct';database=web_interface;"//DB_dev connection
|
//"DefaultConnection": "Server=219.92.7.60;Port=3307;uid=intern;password='intern_mysql_acct';database=web_interface;"//DB_dev connection
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user