Update
This commit is contained in:
parent
8ddf9752f4
commit
292f516e33
@ -21,7 +21,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
|
|||||||
public required DateTime PurchaseDate { get; set; }
|
public required DateTime PurchaseDate { get; set; }
|
||||||
public required string PONo { get; set; }
|
public required string PONo { get; set; }
|
||||||
public required string Currency { get; set; }
|
public required string Currency { get; set; }
|
||||||
public required float PriceInRM { get; set; }
|
public required float DefaultPrice { 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 string? DONo { get; set; }
|
public string? DONo { get; set; }
|
||||||
|
|||||||
@ -24,14 +24,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal fade" id="QrItemModal" tabindex="-1" role="dialog" aria-labelledby="QrItemModalLabel" aria-hidden="true" data-bs-target="#staticBackdrop">
|
<div class="modal fade" id="QrItemModal" tabindex="-1" role="dialog" aria-labelledby="QrItemModalLabel" aria-hidden="true" data-bs-target="#staticBackdrop">
|
||||||
<div class="modal-dialog modal-dialog-centered modal-sm" role="document">
|
<div class="modal-dialog modal-dialog-centered modal-md" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="QrItemModalLabel">{{thisQR}}</h5>
|
<h5 class="modal-title" id="QrItemModalLabel">{{thisQRInfo.uniqueID}}</h5>
|
||||||
<button type="button" class="closeModal btn-close" data-bs-dismiss="modal" aria-label="Close" v-on:click="showItemModal=false"></button>
|
<button type="button" class="closeModal btn-close" data-bs-dismiss="modal" aria-label="Close" v-on:click="showItemModal=false"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body d-flex justify-content-center align-items-center">
|
<div class="modal-body d-flex justify-content-center align-items-center">
|
||||||
<div id="QrContainer">
|
<div class="container">
|
||||||
|
<div class="row" >
|
||||||
|
<div class="col-6 text-center">
|
||||||
|
<div class="row">
|
||||||
|
<div id="QrContainer"></div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
{{thisQRInfo.uniqueID}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 text-center">
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
Department: {{thisQRInfo.departmentName}}
|
||||||
|
</div>
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
Item: {{thisQRInfo.productName}}
|
||||||
|
</div>
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
Warranty: {{thisQRInfo.endWDate}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -65,7 +88,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 col-md-10" v-model="selectedCompany" required>
|
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedCompany" :disabled="currentUserCompanyDept != null" 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>
|
||||||
@ -88,7 +111,7 @@
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-4 col-form-label">Team:</label>
|
<label class="col-sm-4 col-form-label">Team:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="teamType" required>
|
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedTeamType" required>
|
||||||
<option class="btn-light" value="" disabled selected>Select Team</option>
|
<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>
|
<option class="btn-light" v-for="(team, index) in teamTypes" :key="index" :value="team">{{ team }}</option>
|
||||||
</select>
|
</select>
|
||||||
@ -202,9 +225,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">Default Item Price:</label>
|
<label for="DefaultPrice" 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" min="0.01" v-on:input="convertCurrency()" required v-model="priceInRM">
|
<input type="number" id="DefaultPrice" name="DefaultPrice" class="form-control" placeholder="RM 00.00" step="0.01" min="0.01" v-on:input="convertCurrency()" required v-model="DefaultPrice">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -355,9 +378,9 @@
|
|||||||
purchaseDate: null,
|
purchaseDate: null,
|
||||||
PO: null,
|
PO: null,
|
||||||
currency: "MYR",
|
currency: "MYR",
|
||||||
priceInRM: 0.01,
|
DefaultPrice: 0.01,
|
||||||
currencyRate: 1,
|
currencyRate: 1,
|
||||||
convertPrice: 0,
|
convertPrice: 0.01,
|
||||||
DONo:null,
|
DONo:null,
|
||||||
DODate: null,
|
DODate: null,
|
||||||
warranty: 0,
|
warranty: 0,
|
||||||
@ -381,24 +404,28 @@
|
|||||||
selectedSupplier: "",
|
selectedSupplier: "",
|
||||||
selectedCompany: "",
|
selectedCompany: "",
|
||||||
selectedDepartment: "",
|
selectedDepartment: "",
|
||||||
|
selectedTeamType: "",
|
||||||
currencies: {},
|
currencies: {},
|
||||||
showItemModal: false,
|
showItemModal: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
thisQR: null,
|
thisQRInfo: {
|
||||||
|
uniqueID: null,
|
||||||
|
departmentName: null,
|
||||||
|
serialNumber: null,
|
||||||
|
endWDate: null,
|
||||||
|
},
|
||||||
items: [],
|
items: [],
|
||||||
currentUser: null,
|
currentUser: null,
|
||||||
|
currentUserCompanyDept: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {// Log the token to check its value
|
mounted() {
|
||||||
|
this.fetchUser();
|
||||||
// Fetch companies, depts, and products from the API
|
|
||||||
this.fetchItem();
|
this.fetchItem();
|
||||||
this.fetchCurrencyData();
|
this.fetchCurrencyData();
|
||||||
this.fetchCompanies();
|
this.fetchCompanies();
|
||||||
this.fetchProducts();
|
this.fetchProducts();
|
||||||
this.fetchSuppliers();
|
this.fetchSuppliers();
|
||||||
this.fetchUser();
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
filteredDepartments() {
|
filteredDepartments() {
|
||||||
@ -406,6 +433,7 @@
|
|||||||
return []; // No company selected, return empty list
|
return []; // No company selected, return empty list
|
||||||
}
|
}
|
||||||
const company = this.companies.find(c => c.companyId === this.selectedCompany);
|
const company = this.companies.find(c => c.companyId === this.selectedCompany);
|
||||||
|
this.selectedDepartment = '';
|
||||||
return company ? company.departments : [];
|
return company ? company.departments : [];
|
||||||
},
|
},
|
||||||
showProduct() {
|
showProduct() {
|
||||||
@ -434,14 +462,15 @@
|
|||||||
PurchaseDate: this.purchaseDate,
|
PurchaseDate: this.purchaseDate,
|
||||||
PONo: this.PO,
|
PONo: this.PO,
|
||||||
Currency: this.currency,
|
Currency: this.currency,
|
||||||
PriceInRM: this.priceInRM,
|
DefaultPrice: this.DefaultPrice,
|
||||||
CurrencyRate: this.currencyRate,
|
CurrencyRate: this.currencyRate,
|
||||||
ConvertPrice: this.convertPrice,
|
ConvertPrice: this.convertPrice,
|
||||||
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,
|
CreatedByUserId: this.currentUser.id,
|
||||||
|
TeamType: this.selectedTeamType,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -548,7 +577,7 @@
|
|||||||
{
|
{
|
||||||
"title": "Print",
|
"title": "Print",
|
||||||
"data": "uniqueID",
|
"data": "uniqueID",
|
||||||
"render": function (data) {
|
"render": function (data, type, full, meta) {
|
||||||
var printButton = `<button type="button" class="btn btn-success print-btn" data-id="${data}">Print</button>`;
|
var printButton = `<button type="button" class="btn btn-success print-btn" data-id="${data}">Print</button>`;
|
||||||
return printButton;
|
return printButton;
|
||||||
},
|
},
|
||||||
@ -708,7 +737,7 @@
|
|||||||
this.purchaseDate = null;
|
this.purchaseDate = null;
|
||||||
this.PO = null;
|
this.PO = null;
|
||||||
this.currency = null;
|
this.currency = null;
|
||||||
this.priceInRM = null;
|
this.DefaultPrice = null;
|
||||||
this.currencyRate = null;
|
this.currencyRate = null;
|
||||||
this.convertPrice = null;
|
this.convertPrice = null;
|
||||||
this.DODate = null;
|
this.DODate = null;
|
||||||
@ -719,15 +748,17 @@
|
|||||||
this.selectedSupplier = "";
|
this.selectedSupplier = "";
|
||||||
this.selectedCompany = "";
|
this.selectedCompany = "";
|
||||||
this.selectedDepartment = "";
|
this.selectedDepartment = "";
|
||||||
|
this.currentUserCompanyDept = null;
|
||||||
|
this.selectedTeamType = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
// FRONT END FUNCTIONS
|
// FRONT END FUNCTIONS
|
||||||
//----------------------//
|
//----------------------//
|
||||||
//Calculate Total Price
|
//Calculate Total Price
|
||||||
convertCurrency() {
|
convertCurrency() {
|
||||||
const total = this.priceInRM * this.currencyRate;
|
const total = this.DefaultPrice * this.currencyRate;
|
||||||
this.convertPrice = total.toFixed(2);
|
this.convertPrice = total.toFixed(2);
|
||||||
this.priceInRM = this.priceInRM
|
this.DefaultPrice = this.DefaultPrice
|
||||||
// .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
|
||||||
@ -812,14 +843,28 @@
|
|||||||
},
|
},
|
||||||
async printItem(itemId, imgSrc) {
|
async printItem(itemId, imgSrc) {
|
||||||
try {
|
try {
|
||||||
this.thisQR = itemId;
|
this.thisQRInfo.uniqueID = itemId;
|
||||||
|
const uniqueQR = itemId;
|
||||||
const container = document.getElementById("QrContainer");
|
const container = document.getElementById("QrContainer");
|
||||||
|
|
||||||
if (!container) {
|
if (!container) {
|
||||||
console.error(`Container not found.`);
|
console.error("Container not found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
container.innerHTML = `<img src="${imgSrc}" alt="Alternate Text" class="text-center img-fluid" />`;
|
|
||||||
$(`#QrItemModal`).modal('show');
|
// Safely set image content
|
||||||
|
const sanitizedImgSrc = encodeURI(imgSrc); // Sanitize the URL
|
||||||
|
container.innerHTML = `<img src="${sanitizedImgSrc}" alt="QR Code" class="text-center img-fluid" />`;
|
||||||
|
|
||||||
|
// Fetch QR information
|
||||||
|
const qrInfo = this.getPrintedQR(uniqueQR);
|
||||||
|
if (!qrInfo) {
|
||||||
|
console.error("QR Info not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.thisQRInfo = qrInfo; // Save the QR info to a property
|
||||||
|
$(`#QrItemModal`).modal('show'); // Show modal
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error("Error generating QR code:", error);
|
console.error("Error generating QR code:", error);
|
||||||
@ -833,7 +878,10 @@
|
|||||||
});
|
});
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
this.currentUser = data?.UserInfo || null;
|
this.currentUser = data?.userInfo || null;
|
||||||
|
const companyDeptData = await this.currentUser.department;
|
||||||
|
this.currentUserCompanyDept = companyDeptData;
|
||||||
|
this.selectedCompany = companyDeptData?.companyId || "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.error(`Failed to fetch user: ${response.statusText}`);
|
console.error(`Failed to fetch user: ${response.statusText}`);
|
||||||
@ -843,6 +891,13 @@
|
|||||||
console.error('There was a problem with the fetch operation:', error);
|
console.error('There was a problem with the fetch operation:', error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getPrintedQR(uniqueID) {
|
||||||
|
if (!this.items || !Array.isArray(this.items)) {
|
||||||
|
console.error("Items list is not available or is not an array.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.items.find(item => item.uniqueID === uniqueID);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -18,12 +18,12 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
public class AdminAPI : Controller
|
public class AdminAPI : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<AdminAPI> _logger;
|
private readonly ILogger<AdminAPI> _logger;
|
||||||
private readonly IdentityDBContext _identityDbContext;
|
private readonly CentralSystemContext _identityDbContext;
|
||||||
private readonly UserManager<UserModel> _userManager;
|
private readonly UserManager<UserModel> _userManager;
|
||||||
private readonly SignInManager<UserModel> _signInManager;
|
private readonly SignInManager<UserModel> _signInManager;
|
||||||
private readonly RoleManager<RoleModel> _roleManager;
|
private readonly RoleManager<RoleModel> _roleManager;
|
||||||
|
|
||||||
public AdminAPI(ILogger<AdminAPI> logger, IdentityDBContext authDbContext, UserManager<UserModel> userManager, SignInManager<UserModel> signInManager, RoleManager<RoleModel> roleManager)
|
public AdminAPI(ILogger<AdminAPI> logger, CentralSystemContext authDbContext, UserManager<UserModel> userManager, SignInManager<UserModel> signInManager, RoleManager<RoleModel> roleManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_identityDbContext = authDbContext;
|
_identityDbContext = authDbContext;
|
||||||
|
|||||||
@ -14,14 +14,14 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
public class IdentityAPI : Controller
|
public class IdentityAPI : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<IdentityAPI> _logger;
|
private readonly ILogger<IdentityAPI> _logger;
|
||||||
private readonly IdentityDBContext _identityDbContext;
|
private readonly CentralSystemContext _identityDbContext;
|
||||||
private readonly UserManager<UserModel> _userManager;
|
private readonly UserManager<UserModel> _userManager;
|
||||||
private readonly SignInManager<UserModel> _signInManager;
|
private readonly SignInManager<UserModel> _signInManager;
|
||||||
// Communication Key for API. Not API authentication key
|
// Communication Key for API. Not API authentication key
|
||||||
private readonly string _commKey = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF4NW42anlkNlpTYzZNSE1Zem9qaApUbldpYTIra2pud2ZNbVhpSWlyK0RadjM2cEVGMGhRUWFLaWpaMWtyMGNiT25Ha2d2QnNwTzNiYkFua0E3SWwzCk4zM3NNYWdQV0JOQzZyVm1jT04zNEhDSWJCM0hvQXFYQUtkSHFUOGZneklMRzFhRzdxK2h4RDZhZzZsemhTMnEKdDA1bHdNc0hONWpOdmVNNnFWalRnTVB4aEFOMUhnUTkrd1lRWFh5bnZYYUo5OUNySHBqS21WdUt2VUh6WXdlRwp6SnBtYXZOclc4bE9oM1lMeVNuUVU5bjRrdURubGc1OWNHeUtKbzJ2YUxZbll4MkR1ZDNabzBXMHRMWGd0dlQyCjVXdVFsY0NVbldvaVpBV1JBTGI3anRpcTF0MGY5eVBiV2gxYXpMMjFoL3QvckJUMXNCL2FQd2kzRCt3MnBUR00KeVFJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==";
|
private readonly string _commKey = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF4NW42anlkNlpTYzZNSE1Zem9qaApUbldpYTIra2pud2ZNbVhpSWlyK0RadjM2cEVGMGhRUWFLaWpaMWtyMGNiT25Ha2d2QnNwTzNiYkFua0E3SWwzCk4zM3NNYWdQV0JOQzZyVm1jT04zNEhDSWJCM0hvQXFYQUtkSHFUOGZneklMRzFhRzdxK2h4RDZhZzZsemhTMnEKdDA1bHdNc0hONWpOdmVNNnFWalRnTVB4aEFOMUhnUTkrd1lRWFh5bnZYYUo5OUNySHBqS21WdUt2VUh6WXdlRwp6SnBtYXZOclc4bE9oM1lMeVNuUVU5bjRrdURubGc1OWNHeUtKbzJ2YUxZbll4MkR1ZDNabzBXMHRMWGd0dlQyCjVXdVFsY0NVbldvaVpBV1JBTGI3anRpcTF0MGY5eVBiV2gxYXpMMjFoL3QvckJUMXNCL2FQd2kzRCt3MnBUR00KeVFJREFRQUIKLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==";
|
||||||
|
|
||||||
|
|
||||||
public IdentityAPI(ILogger<IdentityAPI> logger, IdentityDBContext authDbContext, UserManager<UserModel> userManager, SignInManager<UserModel> signInManager)
|
public IdentityAPI(ILogger<IdentityAPI> logger, CentralSystemContext authDbContext, UserManager<UserModel> userManager, SignInManager<UserModel> signInManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_identityDbContext = authDbContext;
|
_identityDbContext = authDbContext;
|
||||||
@ -29,6 +29,7 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
_signInManager = signInManager;
|
_signInManager = signInManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region User
|
||||||
[HttpPost("GetUserInformation")]
|
[HttpPost("GetUserInformation")]
|
||||||
public async Task<IActionResult> GetUserInformation()
|
public async Task<IActionResult> GetUserInformation()
|
||||||
{
|
{
|
||||||
@ -62,7 +63,9 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
return StatusCode(500, $"An error occurred: {ex.Message}");
|
return StatusCode(500, $"An error occurred: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion User
|
||||||
|
|
||||||
|
#region LDAP Login
|
||||||
[HttpPost("LdapLogin")]
|
[HttpPost("LdapLogin")]
|
||||||
public async Task<IActionResult> LdapLogin([FromBody] LdapLoginCredential ldapLoginInfo)
|
public async Task<IActionResult> LdapLogin([FromBody] LdapLoginCredential ldapLoginInfo)
|
||||||
{
|
{
|
||||||
@ -135,7 +138,7 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
|
|
||||||
await _signInManager.SignInAsync(existUser, false);
|
await _signInManager.SignInAsync(existUser, false);
|
||||||
|
|
||||||
if (existUser.UserInfoStatus == null || existUser.UserInfoStatus != 0)
|
if (existUser.UserInfoStatus == null || existUser.UserInfoStatus == 0)
|
||||||
{
|
{
|
||||||
return Ok(new { RedirectUrl = Url.Action("ComDeptAssignment", "Identity") });
|
return Ok(new { RedirectUrl = Url.Action("ComDeptAssignment", "Identity") });
|
||||||
}
|
}
|
||||||
@ -143,6 +146,8 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
return Ok(new { RedirectUrl = Url.Action("Index", "Home") });
|
return Ok(new { RedirectUrl = Url.Action("Index", "Home") });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endregion LDAP Login
|
||||||
|
|
||||||
#region Company
|
#region Company
|
||||||
|
|
||||||
[HttpPost("CompanyDepartmentList")]
|
[HttpPost("CompanyDepartmentList")]
|
||||||
@ -183,8 +188,6 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
return Json(itemDepartment);
|
return Json(itemDepartment);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Department
|
|
||||||
|
|
||||||
[HttpPost("UserComptDeptAssignment/{id}")]
|
[HttpPost("UserComptDeptAssignment/{id}")]
|
||||||
public async Task<IActionResult> UserComptDeptAssignment([FromBody] UserDeptAssignment userDeptAssignment, int id)
|
public async Task<IActionResult> UserComptDeptAssignment([FromBody] UserDeptAssignment userDeptAssignment, int id)
|
||||||
{
|
{
|
||||||
@ -204,6 +207,8 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
return Ok( new { message = "User updated successfully", RedirectUrl = Url.Action("Index", "Home") });
|
return Ok( new { message = "User updated successfully", RedirectUrl = Url.Action("Index", "Home") });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Department
|
||||||
|
|
||||||
public async Task<UserModel?> doUserExists(string username)
|
public async Task<UserModel?> doUserExists(string username)
|
||||||
{
|
{
|
||||||
var user = await _userManager.FindByNameAsync(username);
|
var user = await _userManager.FindByNameAsync(username);
|
||||||
|
|||||||
@ -18,14 +18,12 @@ 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 IdentityDBContext _identityDbContext;
|
private readonly CentralSystemContext _centralDbContext;
|
||||||
private readonly InventoryDBContext _inventoryDbContext;
|
|
||||||
|
|
||||||
public InvMainAPI(ILogger<InvMainAPI> logger, IdentityDBContext authDbContext, InventoryDBContext inventoryDbContext)
|
public InvMainAPI(ILogger<InvMainAPI> logger, CentralSystemContext centralDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_identityDbContext = authDbContext;
|
_centralDbContext = centralDbContext;
|
||||||
_inventoryDbContext = inventoryDbContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DepartmentCompany
|
public class DepartmentCompany
|
||||||
@ -34,12 +32,13 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
public string? DepartmentName { get; set; }
|
public string? DepartmentName { get; set; }
|
||||||
public int CompanyId { get; set; }
|
public int CompanyId { get; set; }
|
||||||
public string? CompanyName { get; set; }
|
public string? CompanyName { get; set; }
|
||||||
|
public string? DepartmentCode { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<DepartmentCompany>> GetDepartmentWithCompanyList()
|
public async Task<List<DepartmentCompany>> GetDepartmentWithCompanyList()
|
||||||
{
|
{
|
||||||
var departmentList = await _identityDbContext.Departments.ToListAsync();
|
var departmentList = await _centralDbContext.Departments.ToListAsync();
|
||||||
var companyList = await _identityDbContext.Companies.ToListAsync();
|
var companyList = await _centralDbContext.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
|
||||||
@ -55,8 +54,8 @@ 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 _identityDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
var departmentList = await _centralDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
||||||
var companyList = await _identityDbContext.Companies.FirstOrDefaultAsync(c => c.CompanyId == companyId);
|
var companyList = await _centralDbContext.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
|
||||||
@ -64,7 +63,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
DepartmentId = departmentList!.DepartmentId,
|
DepartmentId = departmentList!.DepartmentId,
|
||||||
DepartmentName = departmentList.DepartmentName,
|
DepartmentName = departmentList.DepartmentName,
|
||||||
CompanyId = departmentList.CompanyId,
|
CompanyId = departmentList.CompanyId,
|
||||||
CompanyName = companyList?.CompanyName
|
CompanyName = companyList?.CompanyName,
|
||||||
|
DepartmentCode = departmentList.DepartmentCode,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return the constructed list as JSON
|
// Return the constructed list as JSON
|
||||||
@ -76,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 _inventoryDbContext.Manufacturers.ToListAsync();
|
var manifacturerList = await _centralDbContext.Manufacturers.ToListAsync();
|
||||||
return Json(manifacturerList);
|
return Json(manifacturerList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,19 +87,15 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
{
|
{
|
||||||
return BadRequest(ModelState);
|
return BadRequest(ModelState);
|
||||||
}
|
}
|
||||||
if (manufacturer == null)
|
|
||||||
{
|
|
||||||
return NotFound("Manufacturer is null");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_inventoryDbContext.Manufacturers.Add(new ManufacturerModel
|
_centralDbContext.Manufacturers.Add(new ManufacturerModel
|
||||||
{
|
{
|
||||||
ManufacturerName = manufacturer.ManufacturerName,
|
ManufacturerName = manufacturer.ManufacturerName,
|
||||||
});
|
});
|
||||||
await _identityDbContext.SaveChangesAsync();
|
await _centralDbContext.SaveChangesAsync();
|
||||||
var updatedList = await _inventoryDbContext.Manufacturers.ToListAsync();
|
var updatedList = await _centralDbContext.Manufacturers.ToListAsync();
|
||||||
return Json(updatedList);
|
return Json(updatedList);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -111,14 +107,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 _inventoryDbContext.Manufacturers.FindAsync(id);
|
var manufacturer = await _centralDbContext.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" });
|
||||||
}
|
}
|
||||||
|
|
||||||
_inventoryDbContext.Manufacturers.Remove(manufacturer);
|
_centralDbContext.Manufacturers.Remove(manufacturer);
|
||||||
await _identityDbContext.SaveChangesAsync();
|
await _centralDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
return Ok(new { success = true, message = "Manufacturer deleted successfully" });
|
return Ok(new { success = true, message = "Manufacturer deleted successfully" });
|
||||||
}
|
}
|
||||||
@ -130,14 +126,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("ProductList")]
|
[HttpPost("ProductList")]
|
||||||
public async Task<IActionResult> ProductList()
|
public async Task<IActionResult> ProductList()
|
||||||
{
|
{
|
||||||
var productList = await _inventoryDbContext.Products.Include("Manufacturer").ToListAsync();
|
var productList = await _centralDbContext.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 _inventoryDbContext.Products
|
var productList = await _centralDbContext.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();
|
||||||
@ -169,9 +165,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";
|
||||||
}
|
}
|
||||||
_inventoryDbContext.Products.Add(product);
|
_centralDbContext.Products.Add(product);
|
||||||
await _identityDbContext.SaveChangesAsync();
|
await _centralDbContext.SaveChangesAsync();
|
||||||
var updatedList = await _inventoryDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
var updatedList = await _centralDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
||||||
return Json(updatedList);
|
return Json(updatedList);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -183,27 +179,26 @@ 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 _inventoryDbContext.Products.FindAsync(id);
|
var Product = await _centralDbContext.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" });
|
||||||
}
|
}
|
||||||
|
|
||||||
_inventoryDbContext.Products.Remove(Product);
|
_centralDbContext.Products.Remove(Product);
|
||||||
await _identityDbContext.SaveChangesAsync();
|
await _centralDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
return Ok(new { success = true, message = "Product deleted successfully" });
|
return Ok(new { success = true, message = "Product deleted successfully" });
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Product
|
#endregion Product
|
||||||
|
|
||||||
|
|
||||||
#region Supplier
|
#region Supplier
|
||||||
|
|
||||||
[HttpPost("SupplierList")]
|
[HttpPost("SupplierList")]
|
||||||
public async Task<IActionResult> SupplierList()
|
public async Task<IActionResult> SupplierList()
|
||||||
{
|
{
|
||||||
var supplierList = await _inventoryDbContext.Suppliers.ToListAsync();
|
var supplierList = await _centralDbContext.Suppliers.ToListAsync();
|
||||||
return Json(supplierList);
|
return Json(supplierList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,11 +209,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
[HttpPost("ItemList")]
|
[HttpPost("ItemList")]
|
||||||
public async Task<IActionResult> ItemList()
|
public async Task<IActionResult> ItemList()
|
||||||
{
|
{
|
||||||
var itemList = await _inventoryDbContext.Items.ToListAsync();
|
// Get the item list
|
||||||
// Retrieve the request's host and scheme
|
var itemList = await _centralDbContext.Items.Include("CreatedBy").Include("Department").Include("Product").ToListAsync();
|
||||||
var request = HttpContext.Request;
|
|
||||||
string domain = $"{request.Scheme}://{request.Host.Value}";
|
// Get the departments list (DepartmentId references Departments)
|
||||||
var itemListWithQR = itemList.Select(item => new
|
var departments = await _centralDbContext.Departments.ToListAsync();
|
||||||
|
|
||||||
|
// Now join items with users and departments manually
|
||||||
|
var itemListWithDetails = itemList.Select(item => new
|
||||||
{
|
{
|
||||||
item.ItemID,
|
item.ItemID,
|
||||||
item.UniqueID,
|
item.UniqueID,
|
||||||
@ -231,18 +229,24 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
item.PurchaseDate,
|
item.PurchaseDate,
|
||||||
item.PONo,
|
item.PONo,
|
||||||
item.Currency,
|
item.Currency,
|
||||||
item.PriceInRM,
|
item.DefaultPrice,
|
||||||
item.CurrencyRate,
|
item.CurrencyRate,
|
||||||
item.ConvertPrice,
|
item.ConvertPrice,
|
||||||
item.DODate,
|
item.DODate,
|
||||||
item.Warranty,
|
item.Warranty,
|
||||||
item.EndWDate,
|
item.EndWDate,
|
||||||
item.InvoiceDate,
|
item.InvoiceDate,
|
||||||
QRString = $"{domain}/Inventory/ItemInformation/{item.UniqueID}"
|
item.Department?.DepartmentName,
|
||||||
|
item.CreatedBy!.UserName,
|
||||||
|
item.Product!.ProductName,
|
||||||
|
QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/Inventory/ItemInformation/{item.UniqueID}" // Generate QR String
|
||||||
}).ToList();
|
}).ToList();
|
||||||
return Json(itemListWithQR);
|
|
||||||
|
return Json(itemListWithDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost("GenerateItemQr/{id}")]
|
[HttpPost("GenerateItemQr/{id}")]
|
||||||
public IActionResult GenerateItemQr(string id)
|
public IActionResult GenerateItemQr(string id)
|
||||||
{
|
{
|
||||||
@ -262,14 +266,10 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
{
|
{
|
||||||
return BadRequest(ModelState);
|
return BadRequest(ModelState);
|
||||||
}
|
}
|
||||||
if (item == null)
|
|
||||||
{
|
|
||||||
return NotFound("Item is null");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var product = await _inventoryDbContext.Products.FirstOrDefaultAsync(p => p.ProductId == item.ProductId) ?? throw new Exception("Product not found");
|
var product = await _centralDbContext.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;
|
||||||
@ -279,28 +279,30 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
item.SerialNumber = null;
|
item.SerialNumber = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_inventoryDbContext.Items.Add(item);
|
_centralDbContext.Items.Add(item);
|
||||||
_inventoryDbContext.Products.Update(product);
|
_centralDbContext.Products.Update(product);
|
||||||
await _identityDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
|
||||||
|
await _centralDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
||||||
|
|
||||||
// Fetch the generated ItemID
|
// Fetch the generated ItemID
|
||||||
var savedItem = await _inventoryDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
|
var savedItem = await _centralDbContext.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 = _inventoryDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
var itemProduct = _centralDbContext.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();
|
||||||
|
string? deptCode = companyDepartment!.DepartmentCode?.ToString();
|
||||||
char? initialCategory = itemProduct!.Category.ToString().Substring(0, 1).ToUpper().FirstOrDefault();
|
char? initialCategory = itemProduct!.Category.ToString().Substring(0, 1).ToUpper().FirstOrDefault();
|
||||||
string? productId = itemProduct!.ProductId.ToString("D3");
|
string? productId = itemProduct!.ProductId.ToString("D3");
|
||||||
string? itemId = item.ItemID.ToString("D5");
|
string? itemId = item.ItemID.ToString("D5");
|
||||||
var uniqueId = $"{companyInitial}{departmentInitial}{initialCategory}{productId}{itemId}".ToUpper();
|
var uniqueId = $"{deptCode}{initialCategory}{productId}{itemId}".ToUpper();
|
||||||
savedItem.UniqueID = uniqueId;
|
savedItem.UniqueID = uniqueId;
|
||||||
|
|
||||||
_inventoryDbContext.Items.Update(savedItem);
|
_centralDbContext.Items.Update(savedItem);
|
||||||
await _identityDbContext.SaveChangesAsync();
|
await _centralDbContext.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
var updatedItem = new
|
var updatedItem = new
|
||||||
{
|
{
|
||||||
@ -315,7 +317,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
|||||||
savedItem.PurchaseDate,
|
savedItem.PurchaseDate,
|
||||||
savedItem.PONo,
|
savedItem.PONo,
|
||||||
savedItem.Currency,
|
savedItem.Currency,
|
||||||
savedItem.PriceInRM,
|
savedItem.DefaultPrice,
|
||||||
savedItem.CurrencyRate,
|
savedItem.CurrencyRate,
|
||||||
savedItem.ConvertPrice,
|
savedItem.ConvertPrice,
|
||||||
savedItem.DODate,
|
savedItem.DODate,
|
||||||
@ -334,14 +336,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 _inventoryDbContext.Items.FindAsync(id);
|
var item = await _centralDbContext.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" });
|
||||||
}
|
}
|
||||||
|
|
||||||
_inventoryDbContext.Items.Remove(item);
|
_centralDbContext.Items.Remove(item);
|
||||||
await _identityDbContext.SaveChangesAsync();
|
await _centralDbContext.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 IdentityDBContext _authDbContext;
|
private readonly CentralSystemContext _authDbContext;
|
||||||
public ModuleAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
public ModuleAPI(ILogger<HomeController> logger, CentralSystemContext authDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_authDbContext = authDbContext;
|
||||||
|
|||||||
@ -14,10 +14,10 @@ namespace PSTW_CentralSystem.Controllers.API
|
|||||||
public class RoleAPI : Controller
|
public class RoleAPI : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<RoleAPI> _logger;
|
private readonly ILogger<RoleAPI> _logger;
|
||||||
private readonly IdentityDBContext _authDbContext;
|
private readonly CentralSystemContext _authDbContext;
|
||||||
private readonly RoleManager<RoleModel> _roleManager;
|
private readonly RoleManager<RoleModel> _roleManager;
|
||||||
|
|
||||||
public RoleAPI(ILogger<RoleAPI> logger, IdentityDBContext authDbContext, RoleManager<RoleModel> roleManager)
|
public RoleAPI(ILogger<RoleAPI> logger, CentralSystemContext authDbContext, RoleManager<RoleModel> roleManager)
|
||||||
{
|
{
|
||||||
_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 IdentityDBContext _authDbContext;
|
private readonly CentralSystemContext _authDbContext;
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
|
||||||
public AdminController(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
public AdminController(ILogger<HomeController> logger, CentralSystemContext authDbContext)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_authDbContext = authDbContext;
|
||||||
|
|||||||
@ -12,10 +12,10 @@ namespace PSTW_CentralSystem.Controllers
|
|||||||
public class IdentityController: Controller
|
public class IdentityController: Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
private readonly IdentityDBContext _authDbContext;
|
private readonly CentralSystemContext _authDbContext;
|
||||||
private readonly UserManager<UserModel> _userManager;
|
private readonly UserManager<UserModel> _userManager;
|
||||||
|
|
||||||
public IdentityController(ILogger<HomeController> logger, IdentityDBContext authDbContext, UserManager<UserModel> userManager)
|
public IdentityController(ILogger<HomeController> logger, CentralSystemContext authDbContext, UserManager<UserModel> userManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_authDbContext = authDbContext;
|
_authDbContext = authDbContext;
|
||||||
|
|||||||
@ -14,11 +14,11 @@ namespace PSTW_CentralSystem.CustomPolicy
|
|||||||
}
|
}
|
||||||
public class RoleModuleHandler : AuthorizationHandler<RoleModulePolicy>
|
public class RoleModuleHandler : AuthorizationHandler<RoleModulePolicy>
|
||||||
{
|
{
|
||||||
private readonly IdentityDBContext _authDBContext;
|
private readonly CentralSystemContext _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( IdentityDBContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
public RoleModuleHandler( CentralSystemContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
||||||
{
|
{
|
||||||
_authDBContext = authDBContext;
|
_authDBContext = authDBContext;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
|||||||
@ -9,10 +9,10 @@ using System.Text.Json;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.DBContext
|
namespace PSTW_CentralSystem.DBContext
|
||||||
{
|
{
|
||||||
public class IdentityDBContext : IdentityDbContext<UserModel, RoleModel, int>
|
public class CentralSystemContext : IdentityDbContext<UserModel, RoleModel, int>
|
||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||||
public IdentityDBContext(DbContextOptions<IdentityDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
public CentralSystemContext(DbContextOptions<CentralSystemContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||||
{
|
{
|
||||||
_hostingEnvironment = hostingEnvironment;
|
_hostingEnvironment = hostingEnvironment;
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ namespace PSTW_CentralSystem.DBContext
|
|||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
//modelBuilder.HasDefaultSchema("CentralSystem");
|
||||||
modelBuilder.Entity<ModuleSettingModel>()
|
modelBuilder.Entity<ModuleSettingModel>()
|
||||||
.Property(e => e.MethodAllowedUserType)
|
.Property(e => e.MethodAllowedUserType)
|
||||||
.HasConversion(
|
.HasConversion(
|
||||||
@ -87,6 +87,10 @@ 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; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,28 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using PSTW_CentralSystem.Areas.Inventory.Models;
|
|
||||||
using PSTW_CentralSystem.Models;
|
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.DBContext
|
|
||||||
{
|
|
||||||
public class InventoryDBContext : DbContext
|
|
||||||
{
|
|
||||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
|
||||||
public InventoryDBContext(DbContextOptions<InventoryDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
|
||||||
{
|
|
||||||
_hostingEnvironment = hostingEnvironment;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
base.OnModelCreating(modelBuilder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DbSet<ManufacturerModel> Manufacturers { get; set; }
|
|
||||||
public DbSet<ItemModel> Items { get; set; }
|
|
||||||
public DbSet<ProductModel> Products { get; set; }
|
|
||||||
public DbSet<SupplierModel> Suppliers { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -11,8 +11,8 @@ using PSTW_CentralSystem.DBContext;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.Migrations
|
namespace PSTW_CentralSystem.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(IdentityDBContext))]
|
[DbContext(typeof(CentralSystemContext))]
|
||||||
[Migration("20241218060528_Initiate")]
|
[Migration("20241223071002_Initiate")]
|
||||||
partial class Initiate
|
partial class Initiate
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -140,6 +140,185 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("AspNetUserTokens", (string)null);
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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>("DefaultPrice")
|
||||||
|
.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 =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("CompanyId")
|
b.Property<int>("CompanyId")
|
||||||
@ -357,16 +536,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "f89f9499-14a5-4bba-a003-5bbb0ef1bb12",
|
ConcurrencyStamp = "7a7ee381-cecc-4268-9fc4-1f04eebfcb2c",
|
||||||
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 = "AQAAAAIAAYagAAAAEDue4k8/8FwBvdJbbgBDLH+ibzmThXls6CmbJd99AdlrbPZrOWvWxlkv7cwVsPSM9g==",
|
PasswordHash = "AQAAAAIAAYagAAAAEKL4x2bfz8vXmcqMKqRsdQPdP9FVEhj4IR3FVvfFdeMdJb1Z7vekx6E3Qzycgpj3WA==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "d5684375-c368-409a-82e1-1e44fa05de60",
|
SecurityStamp = "5f7b5fe6-fb4d-4350-93aa-f3103c6e9a4d",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserInfoStatus = 1,
|
UserInfoStatus = 1,
|
||||||
UserName = "admin@pstw.com.my"
|
UserName = "admin@pstw.com.my"
|
||||||
@ -375,16 +554,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "d19f378c-eef5-4cf7-8ec6-c6b3904e4749",
|
ConcurrencyStamp = "fd4022cd-e08a-43c1-823c-573a86e86a9d",
|
||||||
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 = "AQAAAAIAAYagAAAAEDme/kiOHre+s0r9XvpwSr5dZIoWIbSJhI5B19mCjH4ZFoBBlF6Pay9WYJ2jcVZgfw==",
|
PasswordHash = "AQAAAAIAAYagAAAAENI+MWqt+OwSLiTBhOC5LBV7nWb8hnfcGEnUOLpadTdCHa6rV0ukUo6Hd5nGRL5rTw==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "7875eac4-323d-43cb-a083-940e52877171",
|
SecurityStamp = "0b4291c9-d818-4485-bd96-adde7e14286d",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserInfoStatus = 1,
|
UserInfoStatus = 1,
|
||||||
UserName = "sysadmin@pstw.com.my"
|
UserName = "sysadmin@pstw.com.my"
|
||||||
@ -442,6 +621,52 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||||
@ -462,6 +687,11 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Items");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Departments");
|
b.Navigation("Departments");
|
||||||
@ -53,6 +53,21 @@ 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
|
||||||
@ -75,6 +90,27 @@ 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
|
||||||
@ -123,6 +159,35 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.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(
|
migrationBuilder.CreateTable(
|
||||||
name: "AspNetUsers",
|
name: "AspNetUsers",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -264,6 +329,75 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
})
|
})
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
.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_AspNetUsers_CreatedByUserId",
|
||||||
|
column: x => x.CreatedByUserId,
|
||||||
|
principalTable: "AspNetUsers",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
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" },
|
||||||
@ -280,8 +414,8 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserInfoStatus", "UserName", "departmentId" },
|
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserInfoStatus", "UserName", "departmentId" },
|
||||||
values: new object[,]
|
values: new object[,]
|
||||||
{
|
{
|
||||||
{ 1, 0, "f89f9499-14a5-4bba-a003-5bbb0ef1bb12", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEDue4k8/8FwBvdJbbgBDLH+ibzmThXls6CmbJd99AdlrbPZrOWvWxlkv7cwVsPSM9g==", null, false, "d5684375-c368-409a-82e1-1e44fa05de60", false, 1, "admin@pstw.com.my", null },
|
{ 1, 0, "7a7ee381-cecc-4268-9fc4-1f04eebfcb2c", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEKL4x2bfz8vXmcqMKqRsdQPdP9FVEhj4IR3FVvfFdeMdJb1Z7vekx6E3Qzycgpj3WA==", null, false, "5f7b5fe6-fb4d-4350-93aa-f3103c6e9a4d", false, 1, "admin@pstw.com.my", null },
|
||||||
{ 2, 0, "d19f378c-eef5-4cf7-8ec6-c6b3904e4749", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEDme/kiOHre+s0r9XvpwSr5dZIoWIbSJhI5B19mCjH4ZFoBBlF6Pay9WYJ2jcVZgfw==", null, false, "7875eac4-323d-43cb-a083-940e52877171", false, 1, "sysadmin@pstw.com.my", null }
|
{ 2, 0, "fd4022cd-e08a-43c1-823c-573a86e86a9d", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAENI+MWqt+OwSLiTBhOC5LBV7nWb8hnfcGEnUOLpadTdCHa6rV0ukUo6Hd5nGRL5rTw==", null, false, "0b4291c9-d818-4485-bd96-adde7e14286d", false, 1, "sysadmin@pstw.com.my", null }
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.InsertData(
|
migrationBuilder.InsertData(
|
||||||
@ -339,6 +473,31 @@ 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_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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -359,18 +518,30 @@ 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");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "AspNetUsers");
|
name: "AspNetUsers");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Products");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Departments");
|
name: "Departments");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Manufacturers");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Companies");
|
name: "Companies");
|
||||||
}
|
}
|
||||||
@ -10,8 +10,8 @@ using PSTW_CentralSystem.DBContext;
|
|||||||
|
|
||||||
namespace PSTW_CentralSystem.Migrations
|
namespace PSTW_CentralSystem.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(IdentityDBContext))]
|
[DbContext(typeof(CentralSystemContext))]
|
||||||
partial class IdentityDBContextModelSnapshot : ModelSnapshot
|
partial class CentralSystemContextModelSnapshot : ModelSnapshot
|
||||||
{
|
{
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@ -137,6 +137,185 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.ToTable("AspNetUserTokens", (string)null);
|
b.ToTable("AspNetUserTokens", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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>("DefaultPrice")
|
||||||
|
.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 =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("CompanyId")
|
b.Property<int>("CompanyId")
|
||||||
@ -354,16 +533,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "f89f9499-14a5-4bba-a003-5bbb0ef1bb12",
|
ConcurrencyStamp = "7a7ee381-cecc-4268-9fc4-1f04eebfcb2c",
|
||||||
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 = "AQAAAAIAAYagAAAAEDue4k8/8FwBvdJbbgBDLH+ibzmThXls6CmbJd99AdlrbPZrOWvWxlkv7cwVsPSM9g==",
|
PasswordHash = "AQAAAAIAAYagAAAAEKL4x2bfz8vXmcqMKqRsdQPdP9FVEhj4IR3FVvfFdeMdJb1Z7vekx6E3Qzycgpj3WA==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "d5684375-c368-409a-82e1-1e44fa05de60",
|
SecurityStamp = "5f7b5fe6-fb4d-4350-93aa-f3103c6e9a4d",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserInfoStatus = 1,
|
UserInfoStatus = 1,
|
||||||
UserName = "admin@pstw.com.my"
|
UserName = "admin@pstw.com.my"
|
||||||
@ -372,16 +551,16 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
AccessFailedCount = 0,
|
AccessFailedCount = 0,
|
||||||
ConcurrencyStamp = "d19f378c-eef5-4cf7-8ec6-c6b3904e4749",
|
ConcurrencyStamp = "fd4022cd-e08a-43c1-823c-573a86e86a9d",
|
||||||
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 = "AQAAAAIAAYagAAAAEDme/kiOHre+s0r9XvpwSr5dZIoWIbSJhI5B19mCjH4ZFoBBlF6Pay9WYJ2jcVZgfw==",
|
PasswordHash = "AQAAAAIAAYagAAAAENI+MWqt+OwSLiTBhOC5LBV7nWb8hnfcGEnUOLpadTdCHa6rV0ukUo6Hd5nGRL5rTw==",
|
||||||
PhoneNumberConfirmed = false,
|
PhoneNumberConfirmed = false,
|
||||||
SecurityStamp = "7875eac4-323d-43cb-a083-940e52877171",
|
SecurityStamp = "0b4291c9-d818-4485-bd96-adde7e14286d",
|
||||||
TwoFactorEnabled = false,
|
TwoFactorEnabled = false,
|
||||||
UserInfoStatus = 1,
|
UserInfoStatus = 1,
|
||||||
UserName = "sysadmin@pstw.com.my"
|
UserName = "sysadmin@pstw.com.my"
|
||||||
@ -439,6 +618,52 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||||
@ -459,6 +684,11 @@ namespace PSTW_CentralSystem.Migrations
|
|||||||
b.Navigation("Department");
|
b.Navigation("Department");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Items");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Departments");
|
b.Navigation("Departments");
|
||||||
@ -1,394 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using PSTW_CentralSystem.DBContext;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Migrations.InventoryDB
|
|
||||||
{
|
|
||||||
[DbContext(typeof(InventoryDBContext))]
|
|
||||||
[Migration("20241206071642_Initiate")]
|
|
||||||
partial class Initiate
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.11")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
|
||||||
|
|
||||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ItemID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
|
|
||||||
|
|
||||||
b.Property<int>("CompanyId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<float>("ConvertPrice")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<int>("CreatedByUserId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Currency")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<float>("CurrencyRate")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DODate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<string>("DONo")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("DepartmentId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("EndWDate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("InvoiceDate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<string>("InvoiceNo")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("ItemLocation")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("ItemStatus")
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasComment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;");
|
|
||||||
|
|
||||||
b.Property<string>("PONo")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<float>("PriceInRM")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<int>("ProductId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("PurchaseDate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<int>("Quantity")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SerialNumber")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("Supplier")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("TeamType")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("UniqueID")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("Warranty")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("ItemID");
|
|
||||||
|
|
||||||
b.HasIndex("CompanyId");
|
|
||||||
|
|
||||||
b.HasIndex("CreatedByUserId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
|
||||||
|
|
||||||
b.HasIndex("ProductId");
|
|
||||||
|
|
||||||
b.ToTable("Items");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ManufacturerId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
|
|
||||||
|
|
||||||
b.Property<string>("ManufacturerName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("ManufacturerId");
|
|
||||||
|
|
||||||
b.ToTable("Manufacturers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ProductId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
|
|
||||||
|
|
||||||
b.Property<string>("Category")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("ImageProduct")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturerId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("ModelNo")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int?>("QuantityProduct")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("ProductId");
|
|
||||||
|
|
||||||
b.HasIndex("ManufacturerId");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("SupplierId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
|
|
||||||
|
|
||||||
b.Property<string>("SupplierEmail")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("SupplierGender")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("SupplierName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("SupplierPhoneNo")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("SupplierId");
|
|
||||||
|
|
||||||
b.ToTable("Suppliers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("CompanyId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
|
|
||||||
|
|
||||||
b.Property<string>("CompanyName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("CompanyId");
|
|
||||||
|
|
||||||
b.ToTable("CompanyModel");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("DepartmentId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
|
|
||||||
|
|
||||||
b.Property<int>("CompanyId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("DepartmentCode")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("DepartmentName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("DepartmentId");
|
|
||||||
|
|
||||||
b.HasIndex("CompanyId");
|
|
||||||
|
|
||||||
b.ToTable("DepartmentModel");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<string>("FullName")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int?>("UserInfoStatus")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int?>("departmentId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("departmentId");
|
|
||||||
|
|
||||||
b.ToTable("UserModel");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CompanyId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("PSTW_CentralSystem.Models.UserModel", "CreatedBy")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("CreatedByUserId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("DepartmentId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product")
|
|
||||||
.WithMany("Items")
|
|
||||||
.HasForeignKey("ProductId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Company");
|
|
||||||
|
|
||||||
b.Navigation("CreatedBy");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
|
||||||
|
|
||||||
b.Navigation("Product");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ManufacturerId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Manufacturer");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
|
||||||
.WithMany("Departments")
|
|
||||||
.HasForeignKey("CompanyId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Company");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("PSTW_CentralSystem.Models.DepartmentModel", "Department")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("departmentId");
|
|
||||||
|
|
||||||
b.Navigation("Department");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Items");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Departments");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,296 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Migrations.InventoryDB
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Initiate : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AlterDatabase()
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "CompanyModel",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
CompanyId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
CompanyName = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_CompanyModel", x => x.CompanyId);
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Manufacturers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ManufacturerId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
ManufacturerName = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Manufacturers", x => x.ManufacturerId);
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Suppliers",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
SupplierId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
SupplierName = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
SupplierGender = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
SupplierEmail = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
SupplierPhoneNo = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Suppliers", x => x.SupplierId);
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "DepartmentModel",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
DepartmentId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
DepartmentName = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
DepartmentCode = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
CompanyId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_DepartmentModel", x => x.DepartmentId);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_DepartmentModel_CompanyModel_CompanyId",
|
|
||||||
column: x => x.CompanyId,
|
|
||||||
principalTable: "CompanyModel",
|
|
||||||
principalColumn: "CompanyId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Products",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ProductId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
ProductName = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
ManufacturerId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
Category = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
ModelNo = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
QuantityProduct = table.Column<int>(type: "int", nullable: true),
|
|
||||||
ImageProduct = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4")
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Products", x => x.ProductId);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Products_Manufacturers_ManufacturerId",
|
|
||||||
column: x => x.ManufacturerId,
|
|
||||||
principalTable: "Manufacturers",
|
|
||||||
principalColumn: "ManufacturerId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "UserModel",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
FullName = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
UserStatus = table.Column<int>(type: "int", nullable: true),
|
|
||||||
departmentId = table.Column<int>(type: "int", nullable: true),
|
|
||||||
UserName = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
NormalizedUserName = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
Email = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
NormalizedEmail = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
EmailConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
||||||
PasswordHash = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
SecurityStamp = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
ConcurrencyStamp = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
PhoneNumber = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
PhoneNumberConfirmed = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
||||||
TwoFactorEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
||||||
LockoutEnd = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: true),
|
|
||||||
LockoutEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
||||||
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_UserModel", x => x.Id);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_UserModel_DepartmentModel_departmentId",
|
|
||||||
column: x => x.departmentId,
|
|
||||||
principalTable: "DepartmentModel",
|
|
||||||
principalColumn: "DepartmentId");
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Items",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ItemID = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
||||||
UniqueID = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
CompanyId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
DepartmentId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
ProductId = table.Column<int>(type: "int", nullable: false),
|
|
||||||
SerialNumber = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
TeamType = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
Quantity = table.Column<int>(type: "int", nullable: false),
|
|
||||||
Supplier = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
PurchaseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
||||||
PONo = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
Currency = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
PriceInRM = table.Column<float>(type: "float", nullable: false),
|
|
||||||
CurrencyRate = table.Column<float>(type: "float", nullable: false),
|
|
||||||
ConvertPrice = table.Column<float>(type: "float", nullable: false),
|
|
||||||
DONo = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
DODate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
||||||
Warranty = table.Column<int>(type: "int", nullable: false),
|
|
||||||
EndWDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
||||||
InvoiceNo = table.Column<string>(type: "longtext", nullable: true)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
InvoiceDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
|
||||||
ItemStatus = table.Column<int>(type: "int", nullable: false, comment: "1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;"),
|
|
||||||
ItemLocation = table.Column<string>(type: "longtext", nullable: false)
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
||||||
CreatedByUserId = table.Column<int>(type: "int", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Items", x => x.ItemID);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Items_CompanyModel_CompanyId",
|
|
||||||
column: x => x.CompanyId,
|
|
||||||
principalTable: "CompanyModel",
|
|
||||||
principalColumn: "CompanyId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Items_DepartmentModel_DepartmentId",
|
|
||||||
column: x => x.DepartmentId,
|
|
||||||
principalTable: "DepartmentModel",
|
|
||||||
principalColumn: "DepartmentId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Items_Products_ProductId",
|
|
||||||
column: x => x.ProductId,
|
|
||||||
principalTable: "Products",
|
|
||||||
principalColumn: "ProductId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Items_UserModel_CreatedByUserId",
|
|
||||||
column: x => x.CreatedByUserId,
|
|
||||||
principalTable: "UserModel",
|
|
||||||
principalColumn: "Id",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
})
|
|
||||||
.Annotation("MySql:CharSet", "utf8mb4");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_DepartmentModel_CompanyId",
|
|
||||||
table: "DepartmentModel",
|
|
||||||
column: "CompanyId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Items_CompanyId",
|
|
||||||
table: "Items",
|
|
||||||
column: "CompanyId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Items_CreatedByUserId",
|
|
||||||
table: "Items",
|
|
||||||
column: "CreatedByUserId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Items_DepartmentId",
|
|
||||||
table: "Items",
|
|
||||||
column: "DepartmentId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Items_ProductId",
|
|
||||||
table: "Items",
|
|
||||||
column: "ProductId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Products_ManufacturerId",
|
|
||||||
table: "Products",
|
|
||||||
column: "ManufacturerId");
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_UserModel_departmentId",
|
|
||||||
table: "UserModel",
|
|
||||||
column: "departmentId");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Items");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Suppliers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Products");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "UserModel");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Manufacturers");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "DepartmentModel");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "CompanyModel");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,391 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using PSTW_CentralSystem.DBContext;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace PSTW_CentralSystem.Migrations.InventoryDB
|
|
||||||
{
|
|
||||||
[DbContext(typeof(InventoryDBContext))]
|
|
||||||
partial class InventoryDBContextModelSnapshot : ModelSnapshot
|
|
||||||
{
|
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "8.0.11")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
|
||||||
|
|
||||||
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ItemID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
|
|
||||||
|
|
||||||
b.Property<int>("CompanyId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<float>("ConvertPrice")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<int>("CreatedByUserId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Currency")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<float>("CurrencyRate")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DODate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<string>("DONo")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("DepartmentId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("EndWDate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("InvoiceDate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<string>("InvoiceNo")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("ItemLocation")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("ItemStatus")
|
|
||||||
.HasColumnType("int")
|
|
||||||
.HasComment("1 = In stock; 2 = Item Moving; 3 = Item Out; 4 = Item Broken; 5 = Item Lost; 6 = Item Stolen; 7 = Item Damaged; 8 = Item Discarded; 9 = Item Destroyed; 10 = Item Finished;");
|
|
||||||
|
|
||||||
b.Property<string>("PONo")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<float>("PriceInRM")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<int>("ProductId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("PurchaseDate")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<int>("Quantity")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SerialNumber")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("Supplier")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("TeamType")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("UniqueID")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("Warranty")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("ItemID");
|
|
||||||
|
|
||||||
b.HasIndex("CompanyId");
|
|
||||||
|
|
||||||
b.HasIndex("CreatedByUserId");
|
|
||||||
|
|
||||||
b.HasIndex("DepartmentId");
|
|
||||||
|
|
||||||
b.HasIndex("ProductId");
|
|
||||||
|
|
||||||
b.ToTable("Items");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ManufacturerId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturerId"));
|
|
||||||
|
|
||||||
b.Property<string>("ManufacturerName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("ManufacturerId");
|
|
||||||
|
|
||||||
b.ToTable("Manufacturers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ProductId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
|
|
||||||
|
|
||||||
b.Property<string>("Category")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("ImageProduct")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int>("ManufacturerId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("ModelNo")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int?>("QuantityProduct")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("ProductId");
|
|
||||||
|
|
||||||
b.HasIndex("ManufacturerId");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("SupplierId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
|
|
||||||
|
|
||||||
b.Property<string>("SupplierEmail")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("SupplierGender")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("SupplierName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("SupplierPhoneNo")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("SupplierId");
|
|
||||||
|
|
||||||
b.ToTable("Suppliers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.CompanyModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("CompanyId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
|
|
||||||
|
|
||||||
b.Property<string>("CompanyName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("CompanyId");
|
|
||||||
|
|
||||||
b.ToTable("CompanyModel");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.DepartmentModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("DepartmentId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
|
|
||||||
|
|
||||||
b.Property<int>("CompanyId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("DepartmentCode")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("DepartmentName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.HasKey("DepartmentId");
|
|
||||||
|
|
||||||
b.HasIndex("CompanyId");
|
|
||||||
|
|
||||||
b.ToTable("DepartmentModel");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("AccessFailedCount")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("ConcurrencyStamp")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("EmailConfirmed")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<string>("FullName")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("LockoutEnabled")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
|
||||||
.HasColumnType("datetime(6)");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedEmail")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("NormalizedUserName")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("PasswordHash")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<string>("PhoneNumber")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("PhoneNumberConfirmed")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<string>("SecurityStamp")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<bool>("TwoFactorEnabled")
|
|
||||||
.HasColumnType("tinyint(1)");
|
|
||||||
|
|
||||||
b.Property<string>("UserName")
|
|
||||||
.HasColumnType("longtext");
|
|
||||||
|
|
||||||
b.Property<int?>("UserInfoStatus")
|
|
||||||
.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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
22
Program.cs
22
Program.cs
@ -11,8 +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 authConnectionString = builder.Configuration.GetConnectionString("AuthConnnection");
|
var centralConnectionString = builder.Configuration.GetConnectionString("CentralConnnection");
|
||||||
var inventoryConnectionString = builder.Configuration.GetConnectionString("InventoryConnection");
|
//var inventoryConnectionString = builder.Configuration.GetConnectionString("InventoryConnection");
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
@ -40,23 +40,23 @@ internal class Program
|
|||||||
|
|
||||||
builder.Logging.AddSerilog();
|
builder.Logging.AddSerilog();
|
||||||
|
|
||||||
builder.Services.AddDbContext<IdentityDBContext>(options =>
|
builder.Services.AddDbContext<CentralSystemContext>(options =>
|
||||||
{
|
{
|
||||||
options.UseMySql(authConnectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
options.UseMySql(centralConnectionString, 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)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
//builder.Services.AddDbContext<InventoryDBContext>(options =>
|
||||||
|
//{
|
||||||
|
// options.UseMySql(inventoryConnectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
||||||
|
// mysqlOptions => mysqlOptions.CommandTimeout(120)
|
||||||
|
// );
|
||||||
|
//});
|
||||||
|
|
||||||
//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<IdentityDBContext>()
|
.AddEntityFrameworkStores<CentralSystemContext>()
|
||||||
.AddDefaultUI()
|
.AddDefaultUI()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +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"
|
||||||
"AuthConnnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_auth;", //DB_dev connection
|
"CentralConnnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs;", //DB_dev connection
|
||||||
"InventoryConnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_inventory;" //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