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 string PONo { 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 ConvertPrice { get; set; }
|
||||
public string? DONo { get; set; }
|
||||
|
||||
@ -24,14 +24,37 @@
|
||||
</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-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-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>
|
||||
</div>
|
||||
<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>
|
||||
@ -65,7 +88,7 @@
|
||||
<label class="col-sm-4 col-form-label">Company:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="dropdown">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedCompany" required>
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="selectedCompany" :disabled="currentUserCompanyDept != null" required>
|
||||
<option class="btn-light" value="" disabled selected>Select Company</option>
|
||||
<option class="btn-light" v-for="(item, index) in companies" :key="index" :value="item.companyId">{{item.companyName}}</option>
|
||||
</select>
|
||||
@ -88,7 +111,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-4 col-form-label">Team:</label>
|
||||
<div class="col-sm-8">
|
||||
<select class="btn btn-primary dropdown-toggle col-md-10" v-model="teamType" required>
|
||||
<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" v-for="(team, index) in teamTypes" :key="index" :value="team">{{ team }}</option>
|
||||
</select>
|
||||
@ -202,9 +225,9 @@
|
||||
<div class="col-md-6">
|
||||
@* Item Price in RM *@
|
||||
<div class="form-group row">
|
||||
<label for="priceInRM" class="col-sm-4">Default Item Price:</label>
|
||||
<label for="DefaultPrice" class="col-sm-4">Default Item Price:</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" id="priceInRM" name="priceInRM" class="form-control" placeholder="RM 00.00" step="0.01" min="0.01" v-on:input="convertCurrency()" required v-model="priceInRM">
|
||||
<input type="number" id="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>
|
||||
|
||||
@ -355,9 +378,9 @@
|
||||
purchaseDate: null,
|
||||
PO: null,
|
||||
currency: "MYR",
|
||||
priceInRM: 0.01,
|
||||
DefaultPrice: 0.01,
|
||||
currencyRate: 1,
|
||||
convertPrice: 0,
|
||||
convertPrice: 0.01,
|
||||
DONo:null,
|
||||
DODate: null,
|
||||
warranty: 0,
|
||||
@ -381,24 +404,28 @@
|
||||
selectedSupplier: "",
|
||||
selectedCompany: "",
|
||||
selectedDepartment: "",
|
||||
selectedTeamType: "",
|
||||
currencies: {},
|
||||
showItemModal: false,
|
||||
loading: false,
|
||||
thisQR: null,
|
||||
thisQRInfo: {
|
||||
uniqueID: null,
|
||||
departmentName: null,
|
||||
serialNumber: null,
|
||||
endWDate: null,
|
||||
},
|
||||
items: [],
|
||||
currentUser: null,
|
||||
|
||||
currentUserCompanyDept: null,
|
||||
}
|
||||
},
|
||||
mounted() {// Log the token to check its value
|
||||
|
||||
// Fetch companies, depts, and products from the API
|
||||
mounted() {
|
||||
this.fetchUser();
|
||||
this.fetchItem();
|
||||
this.fetchCurrencyData();
|
||||
this.fetchCompanies();
|
||||
this.fetchProducts();
|
||||
this.fetchSuppliers();
|
||||
this.fetchUser();
|
||||
},
|
||||
computed: {
|
||||
filteredDepartments() {
|
||||
@ -406,6 +433,7 @@
|
||||
return []; // No company selected, return empty list
|
||||
}
|
||||
const company = this.companies.find(c => c.companyId === this.selectedCompany);
|
||||
this.selectedDepartment = '';
|
||||
return company ? company.departments : [];
|
||||
},
|
||||
showProduct() {
|
||||
@ -434,14 +462,15 @@
|
||||
PurchaseDate: this.purchaseDate,
|
||||
PONo: this.PO,
|
||||
Currency: this.currency,
|
||||
PriceInRM: this.priceInRM,
|
||||
DefaultPrice: this.DefaultPrice,
|
||||
CurrencyRate: this.currencyRate,
|
||||
ConvertPrice: this.convertPrice,
|
||||
DODate: this.DODate,
|
||||
Warranty: this.warranty,
|
||||
EndWDate: this.EndWDate,
|
||||
InvoiceDate: this.invoiceDate,
|
||||
CreatedByUserId: this.currentUser,
|
||||
CreatedByUserId: this.currentUser.id,
|
||||
TeamType: this.selectedTeamType,
|
||||
};
|
||||
|
||||
try {
|
||||
@ -548,7 +577,7 @@
|
||||
{
|
||||
"title": "Print",
|
||||
"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>`;
|
||||
return printButton;
|
||||
},
|
||||
@ -708,7 +737,7 @@
|
||||
this.purchaseDate = null;
|
||||
this.PO = null;
|
||||
this.currency = null;
|
||||
this.priceInRM = null;
|
||||
this.DefaultPrice = null;
|
||||
this.currencyRate = null;
|
||||
this.convertPrice = null;
|
||||
this.DODate = null;
|
||||
@ -719,15 +748,17 @@
|
||||
this.selectedSupplier = "";
|
||||
this.selectedCompany = "";
|
||||
this.selectedDepartment = "";
|
||||
this.currentUserCompanyDept = null;
|
||||
this.selectedTeamType = "";
|
||||
},
|
||||
|
||||
// FRONT END FUNCTIONS
|
||||
//----------------------//
|
||||
//Calculate Total Price
|
||||
convertCurrency() {
|
||||
const total = this.priceInRM * this.currencyRate;
|
||||
const total = this.DefaultPrice * this.currencyRate;
|
||||
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(/(\..*)\..*/g, '$1') // Allow only one decimal point
|
||||
// .replace(/^(\d*\.\d{0,2})\d*$/, '$1'); // Limit to two decimal places
|
||||
@ -812,14 +843,28 @@
|
||||
},
|
||||
async printItem(itemId, imgSrc) {
|
||||
try {
|
||||
this.thisQR = itemId;
|
||||
this.thisQRInfo.uniqueID = itemId;
|
||||
const uniqueQR = itemId;
|
||||
const container = document.getElementById("QrContainer");
|
||||
|
||||
if (!container) {
|
||||
console.error(`Container not found.`);
|
||||
console.error("Container not found.");
|
||||
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) {
|
||||
console.error("Error generating QR code:", error);
|
||||
@ -833,7 +878,10 @@
|
||||
});
|
||||
if (response.ok) {
|
||||
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 {
|
||||
console.error(`Failed to fetch user: ${response.statusText}`);
|
||||
@ -843,6 +891,13 @@
|
||||
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>
|
||||
|
||||
@ -18,12 +18,12 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
public class AdminAPI : Controller
|
||||
{
|
||||
private readonly ILogger<AdminAPI> _logger;
|
||||
private readonly IdentityDBContext _identityDbContext;
|
||||
private readonly CentralSystemContext _identityDbContext;
|
||||
private readonly UserManager<UserModel> _userManager;
|
||||
private readonly SignInManager<UserModel> _signInManager;
|
||||
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;
|
||||
_identityDbContext = authDbContext;
|
||||
|
||||
@ -14,14 +14,14 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
public class IdentityAPI : Controller
|
||||
{
|
||||
private readonly ILogger<IdentityAPI> _logger;
|
||||
private readonly IdentityDBContext _identityDbContext;
|
||||
private readonly CentralSystemContext _identityDbContext;
|
||||
private readonly UserManager<UserModel> _userManager;
|
||||
private readonly SignInManager<UserModel> _signInManager;
|
||||
// Communication Key for API. Not API authentication key
|
||||
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;
|
||||
_identityDbContext = authDbContext;
|
||||
@ -29,6 +29,7 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
_signInManager = signInManager;
|
||||
}
|
||||
|
||||
#region User
|
||||
[HttpPost("GetUserInformation")]
|
||||
public async Task<IActionResult> GetUserInformation()
|
||||
{
|
||||
@ -62,7 +63,9 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
return StatusCode(500, $"An error occurred: {ex.Message}");
|
||||
}
|
||||
}
|
||||
#endregion User
|
||||
|
||||
#region LDAP Login
|
||||
[HttpPost("LdapLogin")]
|
||||
public async Task<IActionResult> LdapLogin([FromBody] LdapLoginCredential ldapLoginInfo)
|
||||
{
|
||||
@ -135,7 +138,7 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
|
||||
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") });
|
||||
}
|
||||
@ -143,6 +146,8 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
return Ok(new { RedirectUrl = Url.Action("Index", "Home") });
|
||||
|
||||
}
|
||||
#endregion LDAP Login
|
||||
|
||||
#region Company
|
||||
|
||||
[HttpPost("CompanyDepartmentList")]
|
||||
@ -183,8 +188,6 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
return Json(itemDepartment);
|
||||
}
|
||||
|
||||
#endregion Department
|
||||
|
||||
[HttpPost("UserComptDeptAssignment/{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") });
|
||||
}
|
||||
|
||||
#endregion Department
|
||||
|
||||
public async Task<UserModel?> doUserExists(string username)
|
||||
{
|
||||
var user = await _userManager.FindByNameAsync(username);
|
||||
|
||||
@ -18,14 +18,12 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
public class InvMainAPI : Controller
|
||||
{
|
||||
private readonly ILogger<InvMainAPI> _logger;
|
||||
private readonly IdentityDBContext _identityDbContext;
|
||||
private readonly InventoryDBContext _inventoryDbContext;
|
||||
private readonly CentralSystemContext _centralDbContext;
|
||||
|
||||
public InvMainAPI(ILogger<InvMainAPI> logger, IdentityDBContext authDbContext, InventoryDBContext inventoryDbContext)
|
||||
public InvMainAPI(ILogger<InvMainAPI> logger, CentralSystemContext centralDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_identityDbContext = authDbContext;
|
||||
_inventoryDbContext = inventoryDbContext;
|
||||
_centralDbContext = centralDbContext;
|
||||
}
|
||||
|
||||
public class DepartmentCompany
|
||||
@ -34,12 +32,13 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
public string? DepartmentName { get; set; }
|
||||
public int CompanyId { get; set; }
|
||||
public string? CompanyName { get; set; }
|
||||
public string? DepartmentCode { get; set; }
|
||||
}
|
||||
|
||||
public async Task<List<DepartmentCompany>> GetDepartmentWithCompanyList()
|
||||
{
|
||||
var departmentList = await _identityDbContext.Departments.ToListAsync();
|
||||
var companyList = await _identityDbContext.Companies.ToListAsync();
|
||||
var departmentList = await _centralDbContext.Departments.ToListAsync();
|
||||
var companyList = await _centralDbContext.Companies.ToListAsync();
|
||||
|
||||
// Create a new list to store departments with their company name
|
||||
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)
|
||||
{
|
||||
var departmentList = await _identityDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
||||
var companyList = await _identityDbContext.Companies.FirstOrDefaultAsync(c => c.CompanyId == companyId);
|
||||
var departmentList = await _centralDbContext.Departments.FirstOrDefaultAsync(d => d.DepartmentId == departmentId );
|
||||
var companyList = await _centralDbContext.Companies.FirstOrDefaultAsync(c => c.CompanyId == companyId);
|
||||
|
||||
// Create a new list to store departments with their company name
|
||||
var departmentWithCompany = new DepartmentCompany
|
||||
@ -64,7 +63,8 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
DepartmentId = departmentList!.DepartmentId,
|
||||
DepartmentName = departmentList.DepartmentName,
|
||||
CompanyId = departmentList.CompanyId,
|
||||
CompanyName = companyList?.CompanyName
|
||||
CompanyName = companyList?.CompanyName,
|
||||
DepartmentCode = departmentList.DepartmentCode,
|
||||
};
|
||||
|
||||
// Return the constructed list as JSON
|
||||
@ -76,7 +76,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("ManufacturerList")]
|
||||
public async Task<IActionResult> ManufacturerList()
|
||||
{
|
||||
var manifacturerList = await _inventoryDbContext.Manufacturers.ToListAsync();
|
||||
var manifacturerList = await _centralDbContext.Manufacturers.ToListAsync();
|
||||
return Json(manifacturerList);
|
||||
}
|
||||
|
||||
@ -87,19 +87,15 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
if (manufacturer == null)
|
||||
{
|
||||
return NotFound("Manufacturer is null");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_inventoryDbContext.Manufacturers.Add(new ManufacturerModel
|
||||
_centralDbContext.Manufacturers.Add(new ManufacturerModel
|
||||
{
|
||||
ManufacturerName = manufacturer.ManufacturerName,
|
||||
});
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
var updatedList = await _inventoryDbContext.Manufacturers.ToListAsync();
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
var updatedList = await _centralDbContext.Manufacturers.ToListAsync();
|
||||
return Json(updatedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -111,14 +107,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpDelete("DeleteManufacturer/{id}")]
|
||||
public async Task<IActionResult> DeleteManufacturer(int id)
|
||||
{
|
||||
var manufacturer = await _inventoryDbContext.Manufacturers.FindAsync(id);
|
||||
var manufacturer = await _centralDbContext.Manufacturers.FindAsync(id);
|
||||
if (manufacturer == null)
|
||||
{
|
||||
return NotFound(new { success = false, message = "Manufacturer not found" });
|
||||
}
|
||||
|
||||
_inventoryDbContext.Manufacturers.Remove(manufacturer);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_centralDbContext.Manufacturers.Remove(manufacturer);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
|
||||
return Ok(new { success = true, message = "Manufacturer deleted successfully" });
|
||||
}
|
||||
@ -130,14 +126,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("ProductList")]
|
||||
public async Task<IActionResult> ProductList()
|
||||
{
|
||||
var productList = await _inventoryDbContext.Products.Include("Manufacturer").ToListAsync();
|
||||
var productList = await _centralDbContext.Products.Include("Manufacturer").ToListAsync();
|
||||
return Json(productList);
|
||||
}
|
||||
|
||||
[HttpPost("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.Manufacturer) // Include related manufacturer
|
||||
.ToListAsync();
|
||||
@ -169,9 +165,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
await System.IO.File.WriteAllBytesAsync(filePath, bytes);
|
||||
product.ImageProduct = "/media/inventory/images/" + product.ModelNo + ".jpg";
|
||||
}
|
||||
_inventoryDbContext.Products.Add(product);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
var updatedList = await _inventoryDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
||||
_centralDbContext.Products.Add(product);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
var updatedList = await _centralDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
|
||||
return Json(updatedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -183,27 +179,26 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpDelete("DeleteProduct/{id}")]
|
||||
public async Task<IActionResult> DeleteProduct(int id)
|
||||
{
|
||||
var Product = await _inventoryDbContext.Products.FindAsync(id);
|
||||
var Product = await _centralDbContext.Products.FindAsync(id);
|
||||
if (Product == null)
|
||||
{
|
||||
return NotFound(new { success = false, message = "Product not found" });
|
||||
}
|
||||
|
||||
_inventoryDbContext.Products.Remove(Product);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_centralDbContext.Products.Remove(Product);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
|
||||
return Ok(new { success = true, message = "Product deleted successfully" });
|
||||
}
|
||||
|
||||
#endregion Product
|
||||
|
||||
|
||||
#region Supplier
|
||||
|
||||
[HttpPost("SupplierList")]
|
||||
public async Task<IActionResult> SupplierList()
|
||||
{
|
||||
var supplierList = await _inventoryDbContext.Suppliers.ToListAsync();
|
||||
var supplierList = await _centralDbContext.Suppliers.ToListAsync();
|
||||
return Json(supplierList);
|
||||
}
|
||||
|
||||
@ -214,11 +209,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpPost("ItemList")]
|
||||
public async Task<IActionResult> ItemList()
|
||||
{
|
||||
var itemList = await _inventoryDbContext.Items.ToListAsync();
|
||||
// Retrieve the request's host and scheme
|
||||
var request = HttpContext.Request;
|
||||
string domain = $"{request.Scheme}://{request.Host.Value}";
|
||||
var itemListWithQR = itemList.Select(item => new
|
||||
// Get the item list
|
||||
var itemList = await _centralDbContext.Items.Include("CreatedBy").Include("Department").Include("Product").ToListAsync();
|
||||
|
||||
// Get the departments list (DepartmentId references Departments)
|
||||
var departments = await _centralDbContext.Departments.ToListAsync();
|
||||
|
||||
// Now join items with users and departments manually
|
||||
var itemListWithDetails = itemList.Select(item => new
|
||||
{
|
||||
item.ItemID,
|
||||
item.UniqueID,
|
||||
@ -231,18 +229,24 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
item.PurchaseDate,
|
||||
item.PONo,
|
||||
item.Currency,
|
||||
item.PriceInRM,
|
||||
item.DefaultPrice,
|
||||
item.CurrencyRate,
|
||||
item.ConvertPrice,
|
||||
item.DODate,
|
||||
item.Warranty,
|
||||
item.EndWDate,
|
||||
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();
|
||||
return Json(itemListWithQR);
|
||||
|
||||
return Json(itemListWithDetails);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost("GenerateItemQr/{id}")]
|
||||
public IActionResult GenerateItemQr(string id)
|
||||
{
|
||||
@ -262,14 +266,10 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
{
|
||||
return BadRequest(ModelState);
|
||||
}
|
||||
if (item == null)
|
||||
{
|
||||
return NotFound("Item is null");
|
||||
}
|
||||
|
||||
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;
|
||||
product.QuantityProduct += addToProduct;
|
||||
@ -279,28 +279,30 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
item.SerialNumber = null;
|
||||
}
|
||||
|
||||
_inventoryDbContext.Items.Add(item);
|
||||
_inventoryDbContext.Products.Update(product);
|
||||
await _identityDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
||||
_centralDbContext.Items.Add(item);
|
||||
_centralDbContext.Products.Update(product);
|
||||
|
||||
await _centralDbContext.SaveChangesAsync(); // This generates the auto-incremented ItemID
|
||||
|
||||
// Fetch the generated ItemID
|
||||
var savedItem = await _inventoryDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
|
||||
var savedItem = await _centralDbContext.Items.FirstOrDefaultAsync(i => i.ItemID == item.ItemID);
|
||||
|
||||
if (savedItem != null)
|
||||
{
|
||||
var companyDepartment = await GetDepartmentWithCompany(item.CompanyId, item.DepartmentId);
|
||||
var itemProduct = _inventoryDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
||||
var itemProduct = _centralDbContext.Products.Where(p => p.ProductId == item.ProductId).FirstOrDefault();
|
||||
|
||||
string? companyInitial = companyDepartment!.CompanyName?.ToString().Substring(0, 1).ToUpper();
|
||||
string? departmentInitial = companyDepartment!.DepartmentName?.ToString().Substring(0, 1).ToUpper();
|
||||
string? deptCode = companyDepartment!.DepartmentCode?.ToString();
|
||||
char? initialCategory = itemProduct!.Category.ToString().Substring(0, 1).ToUpper().FirstOrDefault();
|
||||
string? productId = itemProduct!.ProductId.ToString("D3");
|
||||
string? itemId = item.ItemID.ToString("D5");
|
||||
var uniqueId = $"{companyInitial}{departmentInitial}{initialCategory}{productId}{itemId}".ToUpper();
|
||||
var uniqueId = $"{deptCode}{initialCategory}{productId}{itemId}".ToUpper();
|
||||
savedItem.UniqueID = uniqueId;
|
||||
|
||||
_inventoryDbContext.Items.Update(savedItem);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_centralDbContext.Items.Update(savedItem);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
}
|
||||
var updatedItem = new
|
||||
{
|
||||
@ -315,7 +317,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
savedItem.PurchaseDate,
|
||||
savedItem.PONo,
|
||||
savedItem.Currency,
|
||||
savedItem.PriceInRM,
|
||||
savedItem.DefaultPrice,
|
||||
savedItem.CurrencyRate,
|
||||
savedItem.ConvertPrice,
|
||||
savedItem.DODate,
|
||||
@ -334,14 +336,14 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
|
||||
[HttpDelete("DeleteItem/{id}")]
|
||||
public async Task<IActionResult> DeleteItem(int id)
|
||||
{
|
||||
var item = await _inventoryDbContext.Items.FindAsync(id);
|
||||
var item = await _centralDbContext.Items.FindAsync(id);
|
||||
if (item == null)
|
||||
{
|
||||
return NotFound(new { success = false, message = "Item not found" });
|
||||
}
|
||||
|
||||
_inventoryDbContext.Items.Remove(item);
|
||||
await _identityDbContext.SaveChangesAsync();
|
||||
_centralDbContext.Items.Remove(item);
|
||||
await _centralDbContext.SaveChangesAsync();
|
||||
|
||||
return Ok(new { success = true, message = "Item deleted successfully" });
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
public class ModuleAPI : Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
public ModuleAPI(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||
private readonly CentralSystemContext _authDbContext;
|
||||
public ModuleAPI(ILogger<HomeController> logger, CentralSystemContext authDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_authDbContext = authDbContext;
|
||||
|
||||
@ -14,10 +14,10 @@ namespace PSTW_CentralSystem.Controllers.API
|
||||
public class RoleAPI : Controller
|
||||
{
|
||||
private readonly ILogger<RoleAPI> _logger;
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
private readonly CentralSystemContext _authDbContext;
|
||||
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;
|
||||
_authDbContext = authDbContext;
|
||||
|
||||
@ -9,10 +9,10 @@ namespace PSTW_CentralSystem.Controllers
|
||||
[Authorize(Policy = "RoleModulePolicy")]
|
||||
public class AdminController : Controller
|
||||
{
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
private readonly CentralSystemContext _authDbContext;
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
|
||||
public AdminController(ILogger<HomeController> logger, IdentityDBContext authDbContext)
|
||||
public AdminController(ILogger<HomeController> logger, CentralSystemContext authDbContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_authDbContext = authDbContext;
|
||||
|
||||
@ -12,10 +12,10 @@ namespace PSTW_CentralSystem.Controllers
|
||||
public class IdentityController: Controller
|
||||
{
|
||||
private readonly ILogger<HomeController> _logger;
|
||||
private readonly IdentityDBContext _authDbContext;
|
||||
private readonly CentralSystemContext _authDbContext;
|
||||
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;
|
||||
_authDbContext = authDbContext;
|
||||
|
||||
@ -14,11 +14,11 @@ namespace PSTW_CentralSystem.CustomPolicy
|
||||
}
|
||||
public class RoleModuleHandler : AuthorizationHandler<RoleModulePolicy>
|
||||
{
|
||||
private readonly IdentityDBContext _authDBContext;
|
||||
private readonly CentralSystemContext _authDBContext;
|
||||
private readonly UserManager<UserModel> _userManager;
|
||||
private readonly RoleManager<RoleModel> _roleManager;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
public RoleModuleHandler( IdentityDBContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
||||
public RoleModuleHandler( CentralSystemContext authDBContext, UserManager<UserModel> userManager, RoleManager<RoleModel> roleManager, IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_authDBContext = authDBContext;
|
||||
_userManager = userManager;
|
||||
|
||||
@ -9,10 +9,10 @@ using System.Text.Json;
|
||||
|
||||
namespace PSTW_CentralSystem.DBContext
|
||||
{
|
||||
public class IdentityDBContext : IdentityDbContext<UserModel, RoleModel, int>
|
||||
public class CentralSystemContext : IdentityDbContext<UserModel, RoleModel, int>
|
||||
{
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
public IdentityDBContext(DbContextOptions<IdentityDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||
public CentralSystemContext(DbContextOptions<CentralSystemContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||
{
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
@ -20,7 +20,7 @@ namespace PSTW_CentralSystem.DBContext
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
//modelBuilder.HasDefaultSchema("CentralSystem");
|
||||
modelBuilder.Entity<ModuleSettingModel>()
|
||||
.Property(e => e.MethodAllowedUserType)
|
||||
.HasConversion(
|
||||
@ -87,6 +87,10 @@ namespace PSTW_CentralSystem.DBContext
|
||||
public DbSet<ModuleSettingModel> ModuleSettings { get; set; }
|
||||
public DbSet<CompanyModel> Companies { get; set; }
|
||||
public DbSet<DepartmentModel> Departments { get; set; }
|
||||
public DbSet<ManufacturerModel> Manufacturers { get; set; }
|
||||
public DbSet<ItemModel> Items { get; set; }
|
||||
public DbSet<ProductModel> Products { get; set; }
|
||||
public DbSet<SupplierModel> Suppliers { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using PSTW_CentralSystem.Areas.Inventory.Models;
|
||||
using PSTW_CentralSystem.Models;
|
||||
|
||||
namespace PSTW_CentralSystem.DBContext
|
||||
{
|
||||
public class InventoryDBContext : DbContext
|
||||
{
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
public InventoryDBContext(DbContextOptions<InventoryDBContext> options, IWebHostEnvironment hostingEnvironment) : base(options)
|
||||
{
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
public DbSet<ManufacturerModel> Manufacturers { get; set; }
|
||||
public DbSet<ItemModel> Items { get; set; }
|
||||
public DbSet<ProductModel> Products { get; set; }
|
||||
public DbSet<SupplierModel> Suppliers { get; set; }
|
||||
}
|
||||
}
|
||||
@ -11,8 +11,8 @@ using PSTW_CentralSystem.DBContext;
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
[DbContext(typeof(IdentityDBContext))]
|
||||
[Migration("20241218060528_Initiate")]
|
||||
[DbContext(typeof(CentralSystemContext))]
|
||||
[Migration("20241223071002_Initiate")]
|
||||
partial class Initiate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@ -140,6 +140,185 @@ namespace PSTW_CentralSystem.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.Property<int>("CompanyId")
|
||||
@ -357,16 +536,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 1,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "f89f9499-14a5-4bba-a003-5bbb0ef1bb12",
|
||||
ConcurrencyStamp = "7a7ee381-cecc-4268-9fc4-1f04eebfcb2c",
|
||||
Email = "admin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "MAAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEDue4k8/8FwBvdJbbgBDLH+ibzmThXls6CmbJd99AdlrbPZrOWvWxlkv7cwVsPSM9g==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEKL4x2bfz8vXmcqMKqRsdQPdP9FVEhj4IR3FVvfFdeMdJb1Z7vekx6E3Qzycgpj3WA==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "d5684375-c368-409a-82e1-1e44fa05de60",
|
||||
SecurityStamp = "5f7b5fe6-fb4d-4350-93aa-f3103c6e9a4d",
|
||||
TwoFactorEnabled = false,
|
||||
UserInfoStatus = 1,
|
||||
UserName = "admin@pstw.com.my"
|
||||
@ -375,16 +554,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 2,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "d19f378c-eef5-4cf7-8ec6-c6b3904e4749",
|
||||
ConcurrencyStamp = "fd4022cd-e08a-43c1-823c-573a86e86a9d",
|
||||
Email = "sysadmin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "SysAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEDme/kiOHre+s0r9XvpwSr5dZIoWIbSJhI5B19mCjH4ZFoBBlF6Pay9WYJ2jcVZgfw==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAENI+MWqt+OwSLiTBhOC5LBV7nWb8hnfcGEnUOLpadTdCHa6rV0ukUo6Hd5nGRL5rTw==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "7875eac4-323d-43cb-a083-940e52877171",
|
||||
SecurityStamp = "0b4291c9-d818-4485-bd96-adde7e14286d",
|
||||
TwoFactorEnabled = false,
|
||||
UserInfoStatus = 1,
|
||||
UserName = "sysadmin@pstw.com.my"
|
||||
@ -442,6 +621,52 @@ namespace PSTW_CentralSystem.Migrations
|
||||
.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 =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
@ -462,6 +687,11 @@ namespace PSTW_CentralSystem.Migrations
|
||||
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");
|
||||
@ -53,6 +53,21 @@ namespace PSTW_CentralSystem.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Manufacturers",
|
||||
columns: table => new
|
||||
{
|
||||
ManufacturerId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ManufacturerName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Manufacturers", x => x.ManufacturerId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ModuleSettings",
|
||||
columns: table => new
|
||||
@ -75,6 +90,27 @@ namespace PSTW_CentralSystem.Migrations
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Suppliers",
|
||||
columns: table => new
|
||||
{
|
||||
SupplierId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SupplierName = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierGender = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierEmail = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
SupplierPhoneNo = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Suppliers", x => x.SupplierId);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "AspNetRoleClaims",
|
||||
columns: table => new
|
||||
@ -123,6 +159,35 @@ namespace PSTW_CentralSystem.Migrations
|
||||
})
|
||||
.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: "AspNetUsers",
|
||||
columns: table => new
|
||||
@ -264,6 +329,75 @@ namespace PSTW_CentralSystem.Migrations
|
||||
})
|
||||
.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(
|
||||
table: "AspNetRoles",
|
||||
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" },
|
||||
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 },
|
||||
{ 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 }
|
||||
{ 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, "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(
|
||||
@ -339,6 +473,31 @@ namespace PSTW_CentralSystem.Migrations
|
||||
name: "IX_Departments_CompanyId",
|
||||
table: "Departments",
|
||||
column: "CompanyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Items_CompanyId",
|
||||
table: "Items",
|
||||
column: "CompanyId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Items_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 />
|
||||
@ -359,18 +518,30 @@ namespace PSTW_CentralSystem.Migrations
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUserTokens");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ModuleSettings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Suppliers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetRoles");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "AspNetUsers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Products");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Departments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Manufacturers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Companies");
|
||||
}
|
||||
@ -10,8 +10,8 @@ using PSTW_CentralSystem.DBContext;
|
||||
|
||||
namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
[DbContext(typeof(IdentityDBContext))]
|
||||
partial class IdentityDBContextModelSnapshot : ModelSnapshot
|
||||
[DbContext(typeof(CentralSystemContext))]
|
||||
partial class CentralSystemContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
@ -137,6 +137,185 @@ namespace PSTW_CentralSystem.Migrations
|
||||
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 =>
|
||||
{
|
||||
b.Property<int>("CompanyId")
|
||||
@ -354,16 +533,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 1,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "f89f9499-14a5-4bba-a003-5bbb0ef1bb12",
|
||||
ConcurrencyStamp = "7a7ee381-cecc-4268-9fc4-1f04eebfcb2c",
|
||||
Email = "admin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "MAAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "ADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "ADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEDue4k8/8FwBvdJbbgBDLH+ibzmThXls6CmbJd99AdlrbPZrOWvWxlkv7cwVsPSM9g==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEKL4x2bfz8vXmcqMKqRsdQPdP9FVEhj4IR3FVvfFdeMdJb1Z7vekx6E3Qzycgpj3WA==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "d5684375-c368-409a-82e1-1e44fa05de60",
|
||||
SecurityStamp = "5f7b5fe6-fb4d-4350-93aa-f3103c6e9a4d",
|
||||
TwoFactorEnabled = false,
|
||||
UserInfoStatus = 1,
|
||||
UserName = "admin@pstw.com.my"
|
||||
@ -372,16 +551,16 @@ namespace PSTW_CentralSystem.Migrations
|
||||
{
|
||||
Id = 2,
|
||||
AccessFailedCount = 0,
|
||||
ConcurrencyStamp = "d19f378c-eef5-4cf7-8ec6-c6b3904e4749",
|
||||
ConcurrencyStamp = "fd4022cd-e08a-43c1-823c-573a86e86a9d",
|
||||
Email = "sysadmin@pstw.com.my",
|
||||
EmailConfirmed = true,
|
||||
FullName = "SysAdmin",
|
||||
LockoutEnabled = false,
|
||||
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
|
||||
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAEDme/kiOHre+s0r9XvpwSr5dZIoWIbSJhI5B19mCjH4ZFoBBlF6Pay9WYJ2jcVZgfw==",
|
||||
PasswordHash = "AQAAAAIAAYagAAAAENI+MWqt+OwSLiTBhOC5LBV7nWb8hnfcGEnUOLpadTdCHa6rV0ukUo6Hd5nGRL5rTw==",
|
||||
PhoneNumberConfirmed = false,
|
||||
SecurityStamp = "7875eac4-323d-43cb-a083-940e52877171",
|
||||
SecurityStamp = "0b4291c9-d818-4485-bd96-adde7e14286d",
|
||||
TwoFactorEnabled = false,
|
||||
UserInfoStatus = 1,
|
||||
UserName = "sysadmin@pstw.com.my"
|
||||
@ -439,6 +618,52 @@ namespace PSTW_CentralSystem.Migrations
|
||||
.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 =>
|
||||
{
|
||||
b.HasOne("PSTW_CentralSystem.Models.CompanyModel", "Company")
|
||||
@ -459,6 +684,11 @@ namespace PSTW_CentralSystem.Migrations
|
||||
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");
|
||||
@ -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)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var authConnectionString = builder.Configuration.GetConnectionString("AuthConnnection");
|
||||
var inventoryConnectionString = builder.Configuration.GetConnectionString("InventoryConnection");
|
||||
var centralConnectionString = builder.Configuration.GetConnectionString("CentralConnnection");
|
||||
//var inventoryConnectionString = builder.Configuration.GetConnectionString("InventoryConnection");
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
@ -40,23 +40,23 @@ internal class Program
|
||||
|
||||
builder.Logging.AddSerilog();
|
||||
|
||||
builder.Services.AddDbContext<IdentityDBContext>(options =>
|
||||
builder.Services.AddDbContext<CentralSystemContext>(options =>
|
||||
{
|
||||
options.UseMySql(authConnectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
||||
mysqlOptions => mysqlOptions.CommandTimeout(120)
|
||||
);
|
||||
});
|
||||
builder.Services.AddDbContext<InventoryDBContext>(options =>
|
||||
{
|
||||
options.UseMySql(inventoryConnectionString, new MySqlServerVersion(new Version(8, 0, 39)),
|
||||
options.UseMySql(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)
|
||||
// );
|
||||
//});
|
||||
|
||||
//builder.Services.AddDefaultIdentity<UserModel>(options => options.SignIn.RequireConfirmedAccount = true).AddEntityFrameworkStores<AuthDBContext>();
|
||||
|
||||
builder.Services.AddIdentity<UserModel, RoleModel>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<IdentityDBContext>()
|
||||
.AddEntityFrameworkStores<CentralSystemContext>()
|
||||
.AddDefaultUI()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
"ConnectionStrings": {
|
||||
//"DefaultConnection": "Server=localhost;uid=root;Password='';Database=web_interface;"
|
||||
//"DefaultConnection": "server=175.136.244.102;user id=root;password=tw_mysql_root;port=3306;database=web_interface"
|
||||
"AuthConnnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_auth;", //DB_dev connection
|
||||
"InventoryConnection": "Server=219.92.7.60;Port=3307;uid=installer;password='pstw_mysql_installer';database=pstw_cs_inventory;" //DB_dev connection
|
||||
"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
|
||||
//"DefaultConnection": "Server=219.92.7.60;Port=3307;uid=intern;password='intern_mysql_acct';database=web_interface;"//DB_dev connection
|
||||
},
|
||||
"Logging": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user