From bc14a32230258ba21d3f1b19b65a3bd83655828d Mon Sep 17 00:00:00 2001 From: barhen Date: Sun, 2 Jul 2023 10:44:02 -0500 Subject: [PATCH 1/4] Cloud setup --- Biskilog_Cloud.sln | 18 +- .../Controllers/WeatherForecastController.cs | 32 +++ ServerManager/Program.cs | 31 ++- ServerManager/Properties/launchSettings.json | 34 ++- ServerManager/ServerManager.csproj | 38 ++- ServerManager/WeatherForecast.cs | 12 + ServerManager/Worker.cs | 22 +- ServerManager/appsettings.Development.json | 2 +- ServerManager/appsettings.json | 5 +- Shared/Biskilog_Cloud.Shared.csproj | 22 ++ Shared/ClientContractModels/Authtype.cs | 11 + Shared/ClientContractModels/Clientbusiness.cs | 21 ++ Shared/ClientContractModels/Clientinfo.cs | 15 ++ Shared/ClientContractModels/Contract.cs | 21 ++ Shared/ClientContractModels/Databasemap.cs | 16 ++ .../Siteaccesspermission.cs | 16 ++ Shared/ClientContractModels/Userauth.cs | 27 ++ Shared/CustomModels/CancelledSales.cs | 16 ++ Shared/CustomModels/CustomerAccounts.cs | 15 ++ Shared/CustomModels/MostPurchaseItem.cs | 29 +++ Shared/CustomModels/ProductItem.cs | 18 ++ Shared/CustomModels/ProductPriceChange.cs | 23 ++ Shared/CustomModels/ProductUnits.cs | 26 ++ Shared/CustomModels/SaleItem.cs | 22 ++ Shared/CustomModels/TradeSummary.cs | 16 ++ Shared/CustomModels/WeeklySaleItem.cs | 21 ++ Shared/Enums/AuthEnums.cs | 17 ++ Shared/Enums/ConnectionEnums.cs | 14 + Shared/Interfaces/IAnalytics.cs | 86 +++++++ Shared/Interfaces/IAuthService.cs | 19 ++ Shared/Interfaces/ICalculator.cs | 17 ++ Shared/Interfaces/ICompanyInfo.cs | 18 ++ Shared/Interfaces/IConnectionService.cs | 24 ++ Shared/Interfaces/ICustomer.cs | 11 + Shared/Interfaces/IMainInterface.cs | 15 ++ Shared/Interfaces/IProducts.cs | 32 +++ Shared/Interfaces/ISalesInterface.cs | 24 ++ Shared/Interfaces/ISearchService.cs | 16 ++ Shared/Interfaces/ITokenService.cs | 22 ++ Shared/Interfaces/IUser.cs | 15 ++ Shared/POSModels/Creditpurchase.cs | 21 ++ Shared/POSModels/Customeraccount.cs | 25 ++ Shared/POSModels/Productaltunit.cs | 21 ++ Shared/POSModels/Restocklevel.cs | 15 ++ Shared/POSModels/Systemuserrole.cs | 19 ++ Shared/POSModels/Tblbranch.cs | 19 ++ Shared/POSModels/Tblbrand.cs | 13 + Shared/POSModels/Tblcancelledtransaction.cs | 17 ++ Shared/POSModels/Tblcart.cs | 35 +++ Shared/POSModels/Tblcategory.cs | 13 + Shared/POSModels/Tblcompanydetail.cs | 21 ++ Shared/POSModels/Tblcustomer.cs | 35 +++ Shared/POSModels/Tblcustomerpurchase.cs | 15 ++ Shared/POSModels/Tbldeliverydetail.cs | 21 ++ Shared/POSModels/Tbldeliveryhead.cs | 25 ++ Shared/POSModels/Tbldeliveryrecipient.cs | 25 ++ Shared/POSModels/Tbldiscountlog.cs | 19 ++ Shared/POSModels/Tbldriver.cs | 33 +++ Shared/POSModels/Tblinventory.cs | 15 ++ Shared/POSModels/Tblinventoryentry.cs | 17 ++ Shared/POSModels/Tblinvoice.cs | 29 +++ Shared/POSModels/Tblpricechange.cs | 19 ++ Shared/POSModels/Tblproduct.cs | 31 +++ Shared/POSModels/Tbltruck.cs | 19 ++ Shared/POSModels/TbltruckDrivermapping.cs | 19 ++ Shared/POSModels/Tbltruckassignment.cs | 21 ++ Shared/POSModels/Tbltruckinventory.cs | 19 ++ Shared/POSModels/Tbluser.cs | 33 +++ Shared/POSModels/Tbstock.cs | 21 ++ Shared/POSModels/Unitofmeasure.cs | 17 ++ Shared/ServiceRepo/CalculatorService.cs | 63 +++++ Shared/ServiceRepo/SearchService.cs | 33 +++ Shared/ServiceRepo/TokenService.cs | 239 ++++++++++++++++++ Shared/SharedClass.cs | 1 + 74 files changed, 1797 insertions(+), 50 deletions(-) create mode 100644 ServerManager/Controllers/WeatherForecastController.cs create mode 100644 ServerManager/WeatherForecast.cs create mode 100644 Shared/Biskilog_Cloud.Shared.csproj create mode 100644 Shared/ClientContractModels/Authtype.cs create mode 100644 Shared/ClientContractModels/Clientbusiness.cs create mode 100644 Shared/ClientContractModels/Clientinfo.cs create mode 100644 Shared/ClientContractModels/Contract.cs create mode 100644 Shared/ClientContractModels/Databasemap.cs create mode 100644 Shared/ClientContractModels/Siteaccesspermission.cs create mode 100644 Shared/ClientContractModels/Userauth.cs create mode 100644 Shared/CustomModels/CancelledSales.cs create mode 100644 Shared/CustomModels/CustomerAccounts.cs create mode 100644 Shared/CustomModels/MostPurchaseItem.cs create mode 100644 Shared/CustomModels/ProductItem.cs create mode 100644 Shared/CustomModels/ProductPriceChange.cs create mode 100644 Shared/CustomModels/ProductUnits.cs create mode 100644 Shared/CustomModels/SaleItem.cs create mode 100644 Shared/CustomModels/TradeSummary.cs create mode 100644 Shared/CustomModels/WeeklySaleItem.cs create mode 100644 Shared/Enums/AuthEnums.cs create mode 100644 Shared/Enums/ConnectionEnums.cs create mode 100644 Shared/Interfaces/IAnalytics.cs create mode 100644 Shared/Interfaces/IAuthService.cs create mode 100644 Shared/Interfaces/ICalculator.cs create mode 100644 Shared/Interfaces/ICompanyInfo.cs create mode 100644 Shared/Interfaces/IConnectionService.cs create mode 100644 Shared/Interfaces/ICustomer.cs create mode 100644 Shared/Interfaces/IMainInterface.cs create mode 100644 Shared/Interfaces/IProducts.cs create mode 100644 Shared/Interfaces/ISalesInterface.cs create mode 100644 Shared/Interfaces/ISearchService.cs create mode 100644 Shared/Interfaces/ITokenService.cs create mode 100644 Shared/Interfaces/IUser.cs create mode 100644 Shared/POSModels/Creditpurchase.cs create mode 100644 Shared/POSModels/Customeraccount.cs create mode 100644 Shared/POSModels/Productaltunit.cs create mode 100644 Shared/POSModels/Restocklevel.cs create mode 100644 Shared/POSModels/Systemuserrole.cs create mode 100644 Shared/POSModels/Tblbranch.cs create mode 100644 Shared/POSModels/Tblbrand.cs create mode 100644 Shared/POSModels/Tblcancelledtransaction.cs create mode 100644 Shared/POSModels/Tblcart.cs create mode 100644 Shared/POSModels/Tblcategory.cs create mode 100644 Shared/POSModels/Tblcompanydetail.cs create mode 100644 Shared/POSModels/Tblcustomer.cs create mode 100644 Shared/POSModels/Tblcustomerpurchase.cs create mode 100644 Shared/POSModels/Tbldeliverydetail.cs create mode 100644 Shared/POSModels/Tbldeliveryhead.cs create mode 100644 Shared/POSModels/Tbldeliveryrecipient.cs create mode 100644 Shared/POSModels/Tbldiscountlog.cs create mode 100644 Shared/POSModels/Tbldriver.cs create mode 100644 Shared/POSModels/Tblinventory.cs create mode 100644 Shared/POSModels/Tblinventoryentry.cs create mode 100644 Shared/POSModels/Tblinvoice.cs create mode 100644 Shared/POSModels/Tblpricechange.cs create mode 100644 Shared/POSModels/Tblproduct.cs create mode 100644 Shared/POSModels/Tbltruck.cs create mode 100644 Shared/POSModels/TbltruckDrivermapping.cs create mode 100644 Shared/POSModels/Tbltruckassignment.cs create mode 100644 Shared/POSModels/Tbltruckinventory.cs create mode 100644 Shared/POSModels/Tbluser.cs create mode 100644 Shared/POSModels/Tbstock.cs create mode 100644 Shared/POSModels/Unitofmeasure.cs create mode 100644 Shared/ServiceRepo/CalculatorService.cs create mode 100644 Shared/ServiceRepo/SearchService.cs create mode 100644 Shared/ServiceRepo/TokenService.cs create mode 100644 Shared/SharedClass.cs diff --git a/Biskilog_Cloud.sln b/Biskilog_Cloud.sln index 63b5b11..72a78cb 100644 --- a/Biskilog_Cloud.sln +++ b/Biskilog_Cloud.sln @@ -3,9 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientManager", "ClientManager\ClientManager.csproj", "{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientManager", "ClientManager\ClientManager.csproj", "{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerManager", "ServerManager\ServerManager.csproj", "{7A6AAC33-5ED1-4CAD-AA67-E107245354B3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerManager", "ServerManager\ServerManager.csproj", "{48786C44-14A8-4510-9DC2-167C431DDE95}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Biskilog_Cloud.Shared", "Shared\Biskilog_Cloud.Shared.csproj", "{1D368EE7-D1D3-4D50-83ED-57B0EB9CC6F4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,10 +19,14 @@ Global {AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Debug|Any CPU.Build.0 = Debug|Any CPU {AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Release|Any CPU.ActiveCfg = Release|Any CPU {AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Release|Any CPU.Build.0 = Release|Any CPU - {7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7A6AAC33-5ED1-4CAD-AA67-E107245354B3}.Release|Any CPU.Build.0 = Release|Any CPU + {48786C44-14A8-4510-9DC2-167C431DDE95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48786C44-14A8-4510-9DC2-167C431DDE95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48786C44-14A8-4510-9DC2-167C431DDE95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48786C44-14A8-4510-9DC2-167C431DDE95}.Release|Any CPU.Build.0 = Release|Any CPU + {1D368EE7-D1D3-4D50-83ED-57B0EB9CC6F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D368EE7-D1D3-4D50-83ED-57B0EB9CC6F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D368EE7-D1D3-4D50-83ED-57B0EB9CC6F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D368EE7-D1D3-4D50-83ED-57B0EB9CC6F4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ServerManager/Controllers/WeatherForecastController.cs b/ServerManager/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..f720c70 --- /dev/null +++ b/ServerManager/Controllers/WeatherForecastController.cs @@ -0,0 +1,32 @@ +using Microsoft.AspNetCore.Mvc; + +namespace ServerManager.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase +{ + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } +} diff --git a/ServerManager/Program.cs b/ServerManager/Program.cs index 15b1d11..1e614fc 100644 --- a/ServerManager/Program.cs +++ b/ServerManager/Program.cs @@ -1,10 +1,25 @@ -using ServerManager; +var builder = WebApplication.CreateBuilder(args); -IHost host = Host.CreateDefaultBuilder(args) - .ConfigureServices(services => - { - services.AddHostedService(); - }) - .Build(); +// Add services to the container. +builder.Services.AddSignalR(); +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); -host.Run(); +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/ServerManager/Properties/launchSettings.json b/ServerManager/Properties/launchSettings.json index 5699968..e3833aa 100644 --- a/ServerManager/Properties/launchSettings.json +++ b/ServerManager/Properties/launchSettings.json @@ -1,10 +1,40 @@ { + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:21664", + "sslPort": 44321 + } + }, "profiles": { - "ServerManager": { + "http": { "commandName": "Project", "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "http://localhost:5110", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7022;http://localhost:5110", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", "environmentVariables": { - "DOTNET_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development" } } } diff --git a/ServerManager/ServerManager.csproj b/ServerManager/ServerManager.csproj index 3095783..f4f1c1b 100644 --- a/ServerManager/ServerManager.csproj +++ b/ServerManager/ServerManager.csproj @@ -1,13 +1,31 @@ - + - - net7.0 - enable - enable - dotnet-ServerManager-52a85e73-fd4f-461a-8b7b-99494934c716 - + + net7.0 + enable + enable + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + - - - diff --git a/ServerManager/WeatherForecast.cs b/ServerManager/WeatherForecast.cs new file mode 100644 index 0000000..15ad497 --- /dev/null +++ b/ServerManager/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace ServerManager; + +public class WeatherForecast +{ + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } +} diff --git a/ServerManager/Worker.cs b/ServerManager/Worker.cs index 846bd2d..5f28270 100644 --- a/ServerManager/Worker.cs +++ b/ServerManager/Worker.cs @@ -1,21 +1 @@ -namespace ServerManager -{ - public class Worker : BackgroundService - { - private readonly ILogger _logger; - - public Worker(ILogger logger) - { - _logger = logger; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - while (!stoppingToken.IsCancellationRequested) - { - _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - await Task.Delay(1000, stoppingToken); - } - } - } -} \ No newline at end of file + \ No newline at end of file diff --git a/ServerManager/appsettings.Development.json b/ServerManager/appsettings.Development.json index b2dcdb6..0c208ae 100644 --- a/ServerManager/appsettings.Development.json +++ b/ServerManager/appsettings.Development.json @@ -2,7 +2,7 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" + "Microsoft.AspNetCore": "Warning" } } } diff --git a/ServerManager/appsettings.json b/ServerManager/appsettings.json index b2dcdb6..10f68b8 100644 --- a/ServerManager/appsettings.json +++ b/ServerManager/appsettings.json @@ -2,7 +2,8 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" + "Microsoft.AspNetCore": "Warning" } - } + }, + "AllowedHosts": "*" } diff --git a/Shared/Biskilog_Cloud.Shared.csproj b/Shared/Biskilog_Cloud.Shared.csproj new file mode 100644 index 0000000..4e8ed53 --- /dev/null +++ b/Shared/Biskilog_Cloud.Shared.csproj @@ -0,0 +1,22 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + + + + diff --git a/Shared/ClientContractModels/Authtype.cs b/Shared/ClientContractModels/Authtype.cs new file mode 100644 index 0000000..d54bd04 --- /dev/null +++ b/Shared/ClientContractModels/Authtype.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.ClientContractModels; + +public partial class Authtype +{ + public int Id { get; set; } + + public string? Type { get; set; } +} diff --git a/Shared/ClientContractModels/Clientbusiness.cs b/Shared/ClientContractModels/Clientbusiness.cs new file mode 100644 index 0000000..6dc3766 --- /dev/null +++ b/Shared/ClientContractModels/Clientbusiness.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.ClientContractModels; + +public partial class Clientbusiness +{ + /// + /// there could be multiple branches of the same business + /// + public int BusinessId { get; set; } + + public int ClientId { get; set; } + + public string BusinessName { get; set; } = null!; + + public string BiskilogVersion { get; set; } = null!; + + public DateTime DateJoined { get; set; } + public string BusinessExternalId { get; set; } = string.Empty!; +} diff --git a/Shared/ClientContractModels/Clientinfo.cs b/Shared/ClientContractModels/Clientinfo.cs new file mode 100644 index 0000000..c08c0cf --- /dev/null +++ b/Shared/ClientContractModels/Clientinfo.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.ClientContractModels; + +public partial class Clientinfo +{ + public int ClientId { get; set; } + + public string? Fullname { get; set; } + + public string? PhoneNumber { get; set; } + + public string? Email { get; set; } +} diff --git a/Shared/ClientContractModels/Contract.cs b/Shared/ClientContractModels/Contract.cs new file mode 100644 index 0000000..049bad2 --- /dev/null +++ b/Shared/ClientContractModels/Contract.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.ClientContractModels; + +public partial class Contract +{ + public int ContractId { get; set; } + + public int ClientId { get; set; } + + public int? BusinessId { get; set; } + + public DateTime? StartDate { get; set; } + + public DateTime? EndDate { get; set; } + + public decimal? Bill { get; set; } + + public string Comments { get; set; } = null!; +} diff --git a/Shared/ClientContractModels/Databasemap.cs b/Shared/ClientContractModels/Databasemap.cs new file mode 100644 index 0000000..f0ab40f --- /dev/null +++ b/Shared/ClientContractModels/Databasemap.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.ClientContractModels; + +public partial class Databasemap +{ + public int DbNo { get; set; } + + public string DbName { get; set; } = null!; + + public int ClientId { get; set; } + public string Domain { get; set; } + + public DateTime LastSyncDate { get; set; } +} diff --git a/Shared/ClientContractModels/Siteaccesspermission.cs b/Shared/ClientContractModels/Siteaccesspermission.cs new file mode 100644 index 0000000..b09b408 --- /dev/null +++ b/Shared/ClientContractModels/Siteaccesspermission.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.ClientContractModels; + +public partial class Siteaccesspermission +{ + public int UserId { get; set; } + + /// + /// businessIds could also been seen as branchID + /// + public int BusinessId { get; set; } + + public int ClientId { get; set; } +} diff --git a/Shared/ClientContractModels/Userauth.cs b/Shared/ClientContractModels/Userauth.cs new file mode 100644 index 0000000..f8960b9 --- /dev/null +++ b/Shared/ClientContractModels/Userauth.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.ClientContractModels; + +public partial class Userauth +{ + public int UserId { get; set; } + + public int ClientId { get; set; } + + public string? Username { get; set; } + + public string? Email { get; set; } + + public string? Passsword { get; set; } + + public string? PhoneNumber { get; set; } + + public int AuthType { get; set; } + + public ulong Isactive { get; set; } + + public ulong? Isowner { get; set; } + + public DateTime? LastLogin { get; set; } +} diff --git a/Shared/CustomModels/CancelledSales.cs b/Shared/CustomModels/CancelledSales.cs new file mode 100644 index 0000000..77a2148 --- /dev/null +++ b/Shared/CustomModels/CancelledSales.cs @@ -0,0 +1,16 @@ +using Biskilog_Cloud.Shared.POSModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class CancelledSales + { + public Tblcancelledtransaction? CancelledTransaction { get; set; } + public string Customer { get; set; } = "WALK-IN Purchase"; + public decimal? Value { get; set; } + } +} diff --git a/Shared/CustomModels/CustomerAccounts.cs b/Shared/CustomModels/CustomerAccounts.cs new file mode 100644 index 0000000..a55e838 --- /dev/null +++ b/Shared/CustomModels/CustomerAccounts.cs @@ -0,0 +1,15 @@ +using Biskilog_Cloud.Shared.POSModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class CustomerAccounts + { + public Tblcustomer Customer { get; set; } + public decimal Debt { get; set; } = 0; + } +} diff --git a/Shared/CustomModels/MostPurchaseItem.cs b/Shared/CustomModels/MostPurchaseItem.cs new file mode 100644 index 0000000..2ff58ea --- /dev/null +++ b/Shared/CustomModels/MostPurchaseItem.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class MostPurchasedItem + { + /// + /// Specifies the id of the product + /// + public string ProductId { get; set; } = string.Empty; + /// + /// Specifies the name of the product + /// + public string ProductName { get; set; } = string.Empty; + /// + /// The total revenue generated from the sale + /// + public decimal? Revenue { get; set; } + /// + /// This is the number of times the item has been sold + /// + public int? NbrTimesSold { get; set; } + + } +} diff --git a/Shared/CustomModels/ProductItem.cs b/Shared/CustomModels/ProductItem.cs new file mode 100644 index 0000000..07fad59 --- /dev/null +++ b/Shared/CustomModels/ProductItem.cs @@ -0,0 +1,18 @@ +using Biskilog_Cloud.Shared.POSModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class ProductItem + { + public Tblproduct? Product { get; set; } + public Tblinventory? Stock { get; set; } + public Restocklevel? Restocklevel { get; set; } + public List Units { get; set; } = new List(); + public string BaseUnit { get; set; } = string.Empty; + } +} diff --git a/Shared/CustomModels/ProductPriceChange.cs b/Shared/CustomModels/ProductPriceChange.cs new file mode 100644 index 0000000..0750961 --- /dev/null +++ b/Shared/CustomModels/ProductPriceChange.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class ProductPriceChange + { + public string? Pcode { get; set; } + public string? ProductName { get; set; } + public decimal? PreviousPrice { get; set; } + + public decimal? CurrentPrice { get; set; } + + public DateTime? ChangeDate { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; + } +} diff --git a/Shared/CustomModels/ProductUnits.cs b/Shared/CustomModels/ProductUnits.cs new file mode 100644 index 0000000..e50ebc1 --- /dev/null +++ b/Shared/CustomModels/ProductUnits.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class ProductUnits + { + public string? Pcode { get; set; } + + public string? UnitCode { get; set; } + public string? UnitName { get; set; } + + public string? UnitBarcode { get; set; } + + public decimal? PriceUnit { get; set; } + + public int? QuantityUnit { get; set; } + + public string DistinctiveCode { get; set; } = null!; + + public string BranchId { get; set; } = null!; + } +} diff --git a/Shared/CustomModels/SaleItem.cs b/Shared/CustomModels/SaleItem.cs new file mode 100644 index 0000000..b88673a --- /dev/null +++ b/Shared/CustomModels/SaleItem.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class SaleItem + { + public string? Transno { get; set; } + + public DateTime? Date { get; set; } + + public string? Cashier { get; set; } + public string? Status { get; set; } + public decimal? Total { get; set; } + public string BranchId { get; set; } = null!; + + public string Customer { get; set; } = "Walk-In Purchase"!; + } +} diff --git a/Shared/CustomModels/TradeSummary.cs b/Shared/CustomModels/TradeSummary.cs new file mode 100644 index 0000000..895397c --- /dev/null +++ b/Shared/CustomModels/TradeSummary.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class TradeSummary + { + public DateTime CurrentTradeDate { get; set; } = DateTime.Now; + public DateTime LastTradeDate { get; set; } = DateTime.Now.AddDays(-1); + public double CurrentTradeSales { get; set; } = 0; + public double LastTradeSales { get; set; } = 0; + } +} diff --git a/Shared/CustomModels/WeeklySaleItem.cs b/Shared/CustomModels/WeeklySaleItem.cs new file mode 100644 index 0000000..15667d9 --- /dev/null +++ b/Shared/CustomModels/WeeklySaleItem.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class WeeklySaleItem + { + public DateTime Date { get; set; } + public decimal? Total { get; set; } + public string BranchId { get; set; } = null!; + } + + public class WeeklyCategorySummary + { + public decimal? Total { get; set; } + public string Category { get; set; } = string.Empty!; + } +} diff --git a/Shared/Enums/AuthEnums.cs b/Shared/Enums/AuthEnums.cs new file mode 100644 index 0000000..26b9726 --- /dev/null +++ b/Shared/Enums/AuthEnums.cs @@ -0,0 +1,17 @@ +namespace Biskilog_Cloud.Shared.Enums +{ + public enum AuthEnums + { + Registered, + AleadyLoggedin, + WrongPassword, + NotFound, + Found, + Expired, + Invalid, + Valid, + Successful, + Error + } +} + diff --git a/Shared/Enums/ConnectionEnums.cs b/Shared/Enums/ConnectionEnums.cs new file mode 100644 index 0000000..caf592b --- /dev/null +++ b/Shared/Enums/ConnectionEnums.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Enums +{ + public enum ConnectionEnums + { + ConnectionEstablished, + ConnectionNotEstablished, + } +} diff --git a/Shared/Interfaces/IAnalytics.cs b/Shared/Interfaces/IAnalytics.cs new file mode 100644 index 0000000..9b136ea --- /dev/null +++ b/Shared/Interfaces/IAnalytics.cs @@ -0,0 +1,86 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.POSModels; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface IAnalytics + { + /// + /// Fetches a collection of sales transaction made from the specified start date to the end date + /// + /// Specified Start Date + /// Specified end Date + /// + IEnumerable GetSalesTransaction(DateTime a_start, DateTime a_end); + /// + /// Fetches a collection of sales transaction made within a one week period + /// + /// + IEnumerable GetWeeklySalesTransaction(); + /// + /// Fetches a collection of in-debt customers + /// + IEnumerable GetInDebtCustomers(); + /// + /// Fetches a collection of Product Items which are currently out of stock + /// + /// + IEnumerable GetOutOfStockItems(); + /// + /// Fetches a collection of the most purchased Product Items within a specified date range + /// + /// + /// + /// + IEnumerable GetMostPurchasedItem(DateTime a_start, DateTime a_end); + /// + /// Fetches a collection of cancelled transaction within a specified date range + /// + /// + /// + /// + IEnumerable GetCancelledSales(DateTime a_start, DateTime a_end); + /// + /// Fetches a collection of transaction made by employees within a specified date range + /// + /// + /// + /// A dictionary of transactions made by employees with employee name as key + Dictionary> GetEmployeeSales(DateTime a_start, DateTime a_end); + /// + /// Fetches a collection of product price changes with a specified date range + /// + /// + /// + /// + IEnumerable GetPriceChanges(DateTime a_start, DateTime a_end); + /// + /// Fetch the trade summary which is made of the total sales made currently and previous trade + /// + /// + TradeSummary GetTradeSummary(); + /// + /// Fetches the most recent sales transactions + /// + /// The number of rows to return + /// + IEnumerable GetRecentSales(int a_limit); + /// + /// Fetches a collection of product price changes recently made + /// + /// the number of rows to return + /// + IEnumerable GetRecentPriceChanges(int a_limit); + /// + /// Fetches a collection of price change history per product + /// + /// the number of products to fetch history + /// + IEnumerable GetProductPriceChangeHistory(int a_limit); + /// + /// Fetches a collection of sales transaction grouped by category made within a one week period + /// + /// + IEnumerable GetWeeklySalesCategoryTransaction(int a_limit); + } +} diff --git a/Shared/Interfaces/IAuthService.cs b/Shared/Interfaces/IAuthService.cs new file mode 100644 index 0000000..a72f077 --- /dev/null +++ b/Shared/Interfaces/IAuthService.cs @@ -0,0 +1,19 @@ +using Biskilog_Cloud.Shared.ClientContractModels; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface IAuthService + { + /// + /// Authenticates user or client + /// + /// + /// + /// A tokenized string with relevant information on the authenticated user + Task AuthenticateClient(string a_username, string a_password); + Contract? GetContract(int a_clientId, List a_businessId); + Databasemap GetClientDB(int a_clientId); + List GetSiteaccesspermission(int a_clientId, int a_userId); + List GetClientbusiness(int a_clientId, int userId); + } +} diff --git a/Shared/Interfaces/ICalculator.cs b/Shared/Interfaces/ICalculator.cs new file mode 100644 index 0000000..80b2c06 --- /dev/null +++ b/Shared/Interfaces/ICalculator.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface ICalculator + { + double CalculatePercentage(); + string FormatMoneyWithCurrency(double a_amount); + string FormatMoneyWithCurrencyKilo(double a_amount); + NumberFormatInfo GetCurrencyCode(); + } +} diff --git a/Shared/Interfaces/ICompanyInfo.cs b/Shared/Interfaces/ICompanyInfo.cs new file mode 100644 index 0000000..124a28f --- /dev/null +++ b/Shared/Interfaces/ICompanyInfo.cs @@ -0,0 +1,18 @@ +using Biskilog_Cloud.Shared.POSModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface ICompanyInfo + { + IEnumerable FetchBranches(); + Task GetCompanyInfoAsync(); + Task> GetBranches(); + string GetCompanyName(); + string GetBranchName(string a_branchId); + } +} diff --git a/Shared/Interfaces/IConnectionService.cs b/Shared/Interfaces/IConnectionService.cs new file mode 100644 index 0000000..3a80bb3 --- /dev/null +++ b/Shared/Interfaces/IConnectionService.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface IConnectionService + { + /// + /// Prepares and returns the connection string for a client using the specified database id + /// + /// Specified database id to use + /// + string GetClientConnectionString(int a_databaseId); + /// + /// Prepare the DB context from the specified connection string + /// + /// + /// A configured BiskAcdbContext + object PrepareDBContext(string a_connectionString); + } +} diff --git a/Shared/Interfaces/ICustomer.cs b/Shared/Interfaces/ICustomer.cs new file mode 100644 index 0000000..e0870e3 --- /dev/null +++ b/Shared/Interfaces/ICustomer.cs @@ -0,0 +1,11 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.POSModels; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface ICustomer + { + IEnumerable FetchCustomers(); + Task> GetCustomers(); + } +} diff --git a/Shared/Interfaces/IMainInterface.cs b/Shared/Interfaces/IMainInterface.cs new file mode 100644 index 0000000..8e565e0 --- /dev/null +++ b/Shared/Interfaces/IMainInterface.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface IMainInterface + { + void ShowReceipt(string a_receipt); + DateOnly CurrentTradeDate(); + DateOnly PreviousTradeDate(); + } +} diff --git a/Shared/Interfaces/IProducts.cs b/Shared/Interfaces/IProducts.cs new file mode 100644 index 0000000..3607168 --- /dev/null +++ b/Shared/Interfaces/IProducts.cs @@ -0,0 +1,32 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.POSModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface IProduct + { + IEnumerable GetUnitofmeasures(); + IEnumerable GetProducts(string a_productKey = ""); + IEnumerable GetBrands(string a_brandKey = ""); + IEnumerable GetCategories(string a_categoryKey = ""); + IEnumerable GetLowstockItems(); + Task FetchProducts(); + Task FetchLowStockProducts(); + Task FetchUnits(); + Task FetchBrands(); + Task FetchCategories(); + void RefreshList(); + ProductItem GetProductById(string a_id); + ProductItem GetProductByName(string name); + string GetUnitName(string a_unitCode); + event EventHandler ProductsChanged; + event EventHandler UnitsChanged; + event EventHandler BrandsChanged; + event EventHandler CategoriesChanged; + } +} diff --git a/Shared/Interfaces/ISalesInterface.cs b/Shared/Interfaces/ISalesInterface.cs new file mode 100644 index 0000000..17e7d9b --- /dev/null +++ b/Shared/Interfaces/ISalesInterface.cs @@ -0,0 +1,24 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.POSModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface ISalesInterface + { + Task FetchRecentTransaction(int a_limit); + Task FetchTransaction(DateTime a_start, DateTime a_end); + IEnumerable GetTransactions(DateTime a_start, DateTime a_end); + IEnumerable GetRecentTransaction(); + Task FetchReceipt(string a_receiptId); + IEnumerable GetReceipt(string a_receiptId); + Task> GetReceiptDetail(string a_receiptId); + event EventHandler TransactionsChanged; + event EventHandler FetchComplete; + event EventHandler FetchStart; + } +} diff --git a/Shared/Interfaces/ISearchService.cs b/Shared/Interfaces/ISearchService.cs new file mode 100644 index 0000000..4d96e90 --- /dev/null +++ b/Shared/Interfaces/ISearchService.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface ISearchService + { + public event Action SearchValueChanged; + public event Action ClearTextBox; + void PerformSearch(string a_searchKey); + void Clear(); + } +} diff --git a/Shared/Interfaces/ITokenService.cs b/Shared/Interfaces/ITokenService.cs new file mode 100644 index 0000000..d9a8076 --- /dev/null +++ b/Shared/Interfaces/ITokenService.cs @@ -0,0 +1,22 @@ +using Biskilog_Cloud.Shared.ClientContractModels; +using Biskilog_Cloud.Shared.Enums; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface ITokenService + { + AuthEnums ValidateToken(string a_token); + string GenerateToken(Userauth a_user, Contract a_clientContract, Databasemap a_database, List a_business, bool a_comparison); + int? GetDatabaseIdFromToken(string a_token); + int? GetUserIdFromToken(string a_token); + string? GetUserNameFromToken(string a_token); + string? GetBaseBranch(string a_token); + bool? GetComparison(string a_token); + IEnumerable BranchIds(string a_token); + string? GetAllBranch(string a_token); + Task SetToken(string a_token, bool a_remember); + Task GetToken(); + Task ClearToken(); + Task IsTokenSet(); + } +} diff --git a/Shared/Interfaces/IUser.cs b/Shared/Interfaces/IUser.cs new file mode 100644 index 0000000..d260b21 --- /dev/null +++ b/Shared/Interfaces/IUser.cs @@ -0,0 +1,15 @@ +using Biskilog_Cloud.Shared.POSModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.Interfaces +{ + public interface IUser + { + IEnumerable FetchUsers(); + Task> GetUsers(); + } +} diff --git a/Shared/POSModels/Creditpurchase.cs b/Shared/POSModels/Creditpurchase.cs new file mode 100644 index 0000000..5b1672c --- /dev/null +++ b/Shared/POSModels/Creditpurchase.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Creditpurchase +{ + public string ReceiptId { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public DateTime Date { get; set; } + + public decimal TotalBill { get; set; } + + public decimal Paid { get; set; } + + public string CustomerId { get; set; } = null!; + + public string Status { get; set; } = null!; +} diff --git a/Shared/POSModels/Customeraccount.cs b/Shared/POSModels/Customeraccount.cs new file mode 100644 index 0000000..d406e51 --- /dev/null +++ b/Shared/POSModels/Customeraccount.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Customeraccount +{ + public string CustomerId { get; set; } = null!; + + public string TransactionId { get; set; } = null!; + + public DateTime Date { get; set; } + + public decimal Debit { get; set; } + + public decimal Credit { get; set; } + + public decimal Balance { get; set; } + + public string Comments { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Productaltunit.cs b/Shared/POSModels/Productaltunit.cs new file mode 100644 index 0000000..0159f30 --- /dev/null +++ b/Shared/POSModels/Productaltunit.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Productaltunit +{ + public string? Pcode { get; set; } + + public string? UnitCode { get; set; } + + public string? UnitBarcode { get; set; } + + public decimal? PriceUnit { get; set; } + + public int? QuantityUnit { get; set; } + + public string DistinctiveCode { get; set; } = null!; + + public string BranchId { get; set; } = null!; +} diff --git a/Shared/POSModels/Restocklevel.cs b/Shared/POSModels/Restocklevel.cs new file mode 100644 index 0000000..54afc49 --- /dev/null +++ b/Shared/POSModels/Restocklevel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Restocklevel +{ + public string ProductId { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public int? WarnLevel { get; set; } + + public string? Unit { get; set; } +} diff --git a/Shared/POSModels/Systemuserrole.cs b/Shared/POSModels/Systemuserrole.cs new file mode 100644 index 0000000..1137a29 --- /dev/null +++ b/Shared/POSModels/Systemuserrole.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Systemuserrole +{ + public string? Roles { get; set; } + + public sbyte? Owner { get; set; } + + public sbyte? Manager { get; set; } + + public sbyte? Assist { get; set; } + + public sbyte? Cashier { get; set; } + + public int Id { get; set; } +} diff --git a/Shared/POSModels/Tblbranch.cs b/Shared/POSModels/Tblbranch.cs new file mode 100644 index 0000000..5094f91 --- /dev/null +++ b/Shared/POSModels/Tblbranch.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblbranch +{ + public string? BranchName { get; set; } + + public string BranchId { get; set; } = null!; + + public string? Address { get; set; } + + public string? City { get; set; } + + public string? StateOrProvince { get; set; } + + public string? BranchTelephone { get; set; } +} diff --git a/Shared/POSModels/Tblbrand.cs b/Shared/POSModels/Tblbrand.cs new file mode 100644 index 0000000..cde00f6 --- /dev/null +++ b/Shared/POSModels/Tblbrand.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblbrand +{ + public string Id { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? Brand { get; set; } +} diff --git a/Shared/POSModels/Tblcancelledtransaction.cs b/Shared/POSModels/Tblcancelledtransaction.cs new file mode 100644 index 0000000..a017f57 --- /dev/null +++ b/Shared/POSModels/Tblcancelledtransaction.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblcancelledtransaction +{ + public string? Transno { get; set; } + + public DateTime? DateCancelled { get; set; } + + public string? CancelledBy { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tblcart.cs b/Shared/POSModels/Tblcart.cs new file mode 100644 index 0000000..aab15c6 --- /dev/null +++ b/Shared/POSModels/Tblcart.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblcart +{ + public string? Transno { get; set; } + + public string? Id { get; set; } + + public int? Quantity { get; set; } + + public DateTime? Date { get; set; } + + public decimal? Price { get; set; } + + public string? Cashier { get; set; } + + public string? Status { get; set; } + + public decimal? Total { get; set; } + + public string? Unit { get; set; } + public decimal? Tendered { get; set; } + public decimal? Balance { get; set; } + public decimal? ValueAddTax { get; set; } + public decimal? Discount { get; set; } = 0; + + public decimal? Costprice { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tblcategory.cs b/Shared/POSModels/Tblcategory.cs new file mode 100644 index 0000000..bdd04b1 --- /dev/null +++ b/Shared/POSModels/Tblcategory.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblcategory +{ + public string Id { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? Category { get; set; } +} diff --git a/Shared/POSModels/Tblcompanydetail.cs b/Shared/POSModels/Tblcompanydetail.cs new file mode 100644 index 0000000..ed8322c --- /dev/null +++ b/Shared/POSModels/Tblcompanydetail.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblcompanydetail +{ + public string? CompanyName { get; set; } + + public string? Address { get; set; } + + public string? Website { get; set; } + + public string? Email { get; set; } + + public string Tin { get; set; } = null!; + + public string? MainTelephone { get; set; } + + public string? Vatno { get; set; } +} diff --git a/Shared/POSModels/Tblcustomer.cs b/Shared/POSModels/Tblcustomer.cs new file mode 100644 index 0000000..fa2a220 --- /dev/null +++ b/Shared/POSModels/Tblcustomer.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblcustomer +{ + public string CustomerId { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? Firstname { get; set; } + + public string? Surname { get; set; } + + public string? Address { get; set; } + + public string? Telephone { get; set; } + + public DateTime? DateAdded { get; set; } + + public string? Status { get; set; } + + public string? Tin { get; set; } + + public DateTime? DateExit { get; set; } + + public string? Email { get; set; } + + public string? FinancialStatus { get; set; } + + public string? NameKey1 { get; set; } + + public string? NameKey2 { get; set; } +} diff --git a/Shared/POSModels/Tblcustomerpurchase.cs b/Shared/POSModels/Tblcustomerpurchase.cs new file mode 100644 index 0000000..fa8896e --- /dev/null +++ b/Shared/POSModels/Tblcustomerpurchase.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblcustomerpurchase +{ + public string? CustomerId { get; set; } + + public string? TransactionId { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tbldeliverydetail.cs b/Shared/POSModels/Tbldeliverydetail.cs new file mode 100644 index 0000000..cab0c0c --- /dev/null +++ b/Shared/POSModels/Tbldeliverydetail.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbldeliverydetail +{ + public string? DeliveryId { get; set; } + + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public string? Unit { get; set; } + + public decimal? Cost { get; set; } + + public string CountId { get; set; } = null!; + + public string BranchId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tbldeliveryhead.cs b/Shared/POSModels/Tbldeliveryhead.cs new file mode 100644 index 0000000..32bf7a8 --- /dev/null +++ b/Shared/POSModels/Tbldeliveryhead.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbldeliveryhead +{ + public string DeliveryId { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? GeneratedBy { get; set; } + + public DateTime? DateInitiated { get; set; } + + public DateTime? DateCompleted { get; set; } + + public string? Destination { get; set; } + + public string? CustomerId { get; set; } + + public decimal? TotalCost { get; set; } + + public string? Status { get; set; } +} diff --git a/Shared/POSModels/Tbldeliveryrecipient.cs b/Shared/POSModels/Tbldeliveryrecipient.cs new file mode 100644 index 0000000..0316678 --- /dev/null +++ b/Shared/POSModels/Tbldeliveryrecipient.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbldeliveryrecipient +{ + public string DeliveryId { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? Fullname { get; set; } + + public string? Address { get; set; } + + public string? Telephone { get; set; } + + public string? Email { get; set; } + + public string? CustomerId { get; set; } + + public DateOnly? FromDate { get; set; } + + public DateOnly? ToDate { get; set; } +} diff --git a/Shared/POSModels/Tbldiscountlog.cs b/Shared/POSModels/Tbldiscountlog.cs new file mode 100644 index 0000000..ef04d2a --- /dev/null +++ b/Shared/POSModels/Tbldiscountlog.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbldiscountlog +{ + public string? ReceiptId { get; set; } + + public string? Cashier { get; set; } + + public DateTime? Date { get; set; } + + public decimal? Discount { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tbldriver.cs b/Shared/POSModels/Tbldriver.cs new file mode 100644 index 0000000..90f5397 --- /dev/null +++ b/Shared/POSModels/Tbldriver.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbldriver +{ + public string DriverId { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? Firstname { get; set; } + + public string? Surname { get; set; } + + public string? Middlename { get; set; } + + public DateOnly? DateOfBirth { get; set; } + + public string? Address1 { get; set; } + + public string? Address2 { get; set; } + + public string? Telephone { get; set; } + + public string? Email { get; set; } + + public string? City { get; set; } + + public string? State { get; set; } + + public string? Status { get; set; } +} diff --git a/Shared/POSModels/Tblinventory.cs b/Shared/POSModels/Tblinventory.cs new file mode 100644 index 0000000..7805dd7 --- /dev/null +++ b/Shared/POSModels/Tblinventory.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblinventory +{ + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tblinventoryentry.cs b/Shared/POSModels/Tblinventoryentry.cs new file mode 100644 index 0000000..d9cebf8 --- /dev/null +++ b/Shared/POSModels/Tblinventoryentry.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblinventoryentry +{ + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public DateTime? Date { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tblinvoice.cs b/Shared/POSModels/Tblinvoice.cs new file mode 100644 index 0000000..15c5a37 --- /dev/null +++ b/Shared/POSModels/Tblinvoice.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblinvoice +{ + public string? InvoiceId { get; set; } + + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public decimal? Unitprice { get; set; } + + public string? Unit { get; set; } + + public decimal? Totalprice { get; set; } + + public DateOnly? DateGenerated { get; set; } + + public string? Status { get; set; } + + public string? GeneratedBy { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tblpricechange.cs b/Shared/POSModels/Tblpricechange.cs new file mode 100644 index 0000000..4252692 --- /dev/null +++ b/Shared/POSModels/Tblpricechange.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblpricechange +{ + public string? Pcode { get; set; } + + public decimal? PreviousPrice { get; set; } + + public decimal? CurrentPrice { get; set; } + + public DateTime? ChangeDate { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tblproduct.cs b/Shared/POSModels/Tblproduct.cs new file mode 100644 index 0000000..78d1ad3 --- /dev/null +++ b/Shared/POSModels/Tblproduct.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tblproduct +{ + public string? Pcode { get; set; } + + public string? Barcode { get; set; } + + public string? Pdesc { get; set; } + + public string? Bid { get; set; } + + public string? Cid { get; set; } + + public decimal? Price { get; set; } + + public decimal? Costprice { get; set; } + + public string? BaseUnit { get; set; } + + public string? ProductName { get; set; } + + public string? Status { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tbltruck.cs b/Shared/POSModels/Tbltruck.cs new file mode 100644 index 0000000..330477e --- /dev/null +++ b/Shared/POSModels/Tbltruck.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbltruck +{ + public string TruckId { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? LicensePlate { get; set; } + + public string? Brand { get; set; } + + public string? Driver { get; set; } + + public decimal? Weight { get; set; } +} diff --git a/Shared/POSModels/TbltruckDrivermapping.cs b/Shared/POSModels/TbltruckDrivermapping.cs new file mode 100644 index 0000000..5bb5f5c --- /dev/null +++ b/Shared/POSModels/TbltruckDrivermapping.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class TbltruckDrivermapping +{ + public string? TruckId { get; set; } + + public string? DriverId { get; set; } + + public DateTime? DateEntry { get; set; } + + public string? Operation { get; set; } + + public string CountId { get; set; } = null!; + + public string BranchId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tbltruckassignment.cs b/Shared/POSModels/Tbltruckassignment.cs new file mode 100644 index 0000000..e979a48 --- /dev/null +++ b/Shared/POSModels/Tbltruckassignment.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbltruckassignment +{ + public string? OrderId { get; set; } + + public decimal? Cost { get; set; } + + public string? TruckId { get; set; } + + public string? Status { get; set; } + + public DateTime? DateAssigned { get; set; } + + public string CountId { get; set; } = null!; + + public string BranchId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tbltruckinventory.cs b/Shared/POSModels/Tbltruckinventory.cs new file mode 100644 index 0000000..76329e0 --- /dev/null +++ b/Shared/POSModels/Tbltruckinventory.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbltruckinventory +{ + public string? TruckId { get; set; } + + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public string? Unit { get; set; } + + public string CountId { get; set; } = null!; + + public string BranchId { get; set; } = null!; +} diff --git a/Shared/POSModels/Tbluser.cs b/Shared/POSModels/Tbluser.cs new file mode 100644 index 0000000..6427653 --- /dev/null +++ b/Shared/POSModels/Tbluser.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbluser +{ + public string Username { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? Password { get; set; } + + public string? Firstname { get; set; } + + public string? Surname { get; set; } + + public string? StreetAddress1 { get; set; } + + public string? StreetAddress2 { get; set; } + + public string? City { get; set; } + + public string? StateOrProvince { get; set; } + + public string? Telephone { get; set; } + + public string? Email { get; set; } + + public string? AccessLevel { get; set; } + + public DateTime? LastLogin { get; set; } +} diff --git a/Shared/POSModels/Tbstock.cs b/Shared/POSModels/Tbstock.cs new file mode 100644 index 0000000..4557323 --- /dev/null +++ b/Shared/POSModels/Tbstock.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Tbstock +{ + public string? Refno { get; set; } + + public string? Pcode { get; set; } + + public int? Qty { get; set; } + + public DateOnly? Sdate { get; set; } + + public string? Stockinby { get; set; } + + public string BranchId { get; set; } = null!; + + public string CountId { get; set; } = null!; +} diff --git a/Shared/POSModels/Unitofmeasure.cs b/Shared/POSModels/Unitofmeasure.cs new file mode 100644 index 0000000..b72f983 --- /dev/null +++ b/Shared/POSModels/Unitofmeasure.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.POSModels; + +public partial class Unitofmeasure +{ + public string UnitCode { get; set; } = null!; + + public string BranchId { get; set; } = null!; + + public string? Unitname { get; set; } + + public string? Unitshort { get; set; } + + public string? Status { get; set; } +} diff --git a/Shared/ServiceRepo/CalculatorService.cs b/Shared/ServiceRepo/CalculatorService.cs new file mode 100644 index 0000000..2bf104d --- /dev/null +++ b/Shared/ServiceRepo/CalculatorService.cs @@ -0,0 +1,63 @@ +using Biskilog_Cloud.Shared.Interfaces; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.ServiceRepo +{ + public class CalculatorService : ICalculator + { + public double CalculatePercentage() + { + throw new NotImplementedException(); + } + + public string FormatMoneyWithCurrency(double a_amount) + { + return string.Format(GetCurrencyCode(), " {0:C2}", a_amount); + } + public string FormatMoneyWithCurrencyKilo(double a_amount) + { + return GetCurrencyCode().CurrencySymbol + FormatNumber(a_amount); + } + public NumberFormatInfo GetCurrencyCode() + { + //TODO have a better implementation + + // Specify the locale for Ghana + string locale = "en-GH"; + + // Get the NumberFormatInfo for the specified locale + NumberFormatInfo numberFormatInfo = new CultureInfo(locale).NumberFormat; + + // Set the currency symbol to Ghanaian cedi + numberFormatInfo.CurrencySymbol = "GH₵ "; + + return numberFormatInfo; + } + private string FormatNumber(double a_amount) + { + if (a_amount >= 100000000) + { + return (a_amount / 1000000D).ToString("0.#M"); + } + if (a_amount >= 1000000) + { + return (a_amount / 1000000D).ToString("0.##M"); + } + if (a_amount >= 100000) + { + return (a_amount / 1000D).ToString("0.#k"); + } + if (a_amount >= 10000) + { + return (a_amount / 1000D).ToString("0.##k"); + } + + return a_amount.ToString("#,0"); + } + } +} diff --git a/Shared/ServiceRepo/SearchService.cs b/Shared/ServiceRepo/SearchService.cs new file mode 100644 index 0000000..0af6ab3 --- /dev/null +++ b/Shared/ServiceRepo/SearchService.cs @@ -0,0 +1,33 @@ +using Biskilog_Cloud.Shared.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.ServiceRepo +{ + public class SearchService : ISearchService + { + public event Action SearchValueChanged; + public event Action ClearTextBox; + + // Method that raises the event + protected virtual void OnSearchValueChanged(string a_searchKey) + { + SearchValueChanged?.Invoke(a_searchKey); + } + + // Method that triggers the event + public void PerformSearch(string a_searchKey) + { + OnSearchValueChanged(a_searchKey); + } + + public void Clear() + { + ClearTextBox?.Invoke(); + } + } + +} diff --git a/Shared/ServiceRepo/TokenService.cs b/Shared/ServiceRepo/TokenService.cs new file mode 100644 index 0000000..4ac8c7d --- /dev/null +++ b/Shared/ServiceRepo/TokenService.cs @@ -0,0 +1,239 @@ +using Biskilog_Cloud.Shared.ClientContractModels; +using Biskilog_Cloud.Shared.Enums; +using Biskilog_Cloud.Shared.Interfaces; +using Blazored.LocalStorage; +using Blazored.SessionStorage; +using Microsoft.Extensions.Configuration; +using Microsoft.IdentityModel.Tokens; +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; +using System.Text; + +namespace Biskilog_Cloud.ServiceRepo +{ + public class TokenService : ITokenService + { + private IConfiguration m_configuration { get; } + private readonly ISessionStorageService m_sessionStorage; + private readonly ILocalStorageService m_localStorage; + public TokenService(IConfiguration a_configuration, ISessionStorageService a_sessionStorage = null, ILocalStorageService a_localStorage = null) + { + m_configuration = a_configuration; + m_sessionStorage = a_sessionStorage; + m_localStorage = a_localStorage; + } + + /// + /// Validates a user access token + /// + /// AuthEnums.Valid if token is a valid and unexpired token + public AuthEnums ValidateToken(string a_token) + { + try + { + string token = a_token.Substring(6).Trim(); + var handler = new JwtSecurityTokenHandler(); + JwtSecurityToken jwtToken = (JwtSecurityToken)handler.ReadToken(token); + + if (jwtToken.ValidFrom <= DateTime.Now && jwtToken.ValidTo > DateTime.Now) + return AuthEnums.Valid; + return AuthEnums.Expired; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + return AuthEnums.Invalid; + } + } + /// + /// Generates an access token based on the user + /// + /// A tokenized string + public string GenerateToken(Userauth a_user, Contract a_clientContract, Databasemap a_database, List a_business, bool a_comparison) + { + try + { + //create claims details based on the user information + var claims = new[] { + new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()), + new Claim(JwtRegisteredClaimNames.Iat, DateTime.UtcNow.ToString()), + new Claim("ContractStart",a_clientContract.StartDate !.Value.ToString()), + new Claim("ContractEnd",a_clientContract.EndDate!.Value.ToString()), + new Claim("UserId", a_user.UserId.ToString()), + new Claim("Username", a_user.Username.ToString()), + new Claim("DbId",a_database.DbNo.ToString()), + new Claim("ComparisonMode",a_comparison.ToString()), + new Claim("BranchId",a_business[0].ToString()), + new Claim("BranchAccess",string.Join(", ", a_business.ToArray())), + new Claim("ClientId", a_user.ClientId.ToString()), + }; + + var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(m_configuration["Jwt:Key"]!)); + + var signIn = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); + + var token = new JwtSecurityToken(m_configuration["Jwt:Issuer"], m_configuration["Jwt:Audience"], claims, expires: DateTime.UtcNow.AddDays(14), signingCredentials: signIn); + return $"{new JwtSecurityTokenHandler().WriteToken(token)}"; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + return AuthEnums.Error.ToString(); + } + } + /// + ///Deserializes the token string if valid to return the specified user role id in the token string + /// + /// + /// RoleId + public int? GetDatabaseIdFromToken(string a_token) + { + if (ValidateToken(a_token) == AuthEnums.Valid) + { + string token = a_token.Substring(6).Trim(); + var handler = new JwtSecurityTokenHandler(); + JwtSecurityToken jwtToken = (JwtSecurityToken)handler.ReadToken(token); + return int.Parse(jwtToken.Claims.First(claim => claim.Type == "DbId").Value); + } + return null; + } + /// + ///Deserializes the token string if valid to return the specified user id in the token string + /// + /// + /// UserId + public int? GetUserIdFromToken(string a_token) + { + if (ValidateToken(a_token) == AuthEnums.Valid) + { + string token = a_token.Substring(6).Trim(); + var handler = new JwtSecurityTokenHandler(); + JwtSecurityToken jwtToken = (JwtSecurityToken)handler.ReadToken(token); + return int.Parse(jwtToken.Claims.First(claim => claim.Type == "UserId").Value); + } + return null; + } + /// + ///Deserializes the token string if valid to return the specified username in the token string + /// + /// + /// Username + public string? GetUserNameFromToken(string a_token) + { + if (ValidateToken(a_token) == AuthEnums.Valid) + { + string token = a_token.Substring(6).Trim(); + var handler = new JwtSecurityTokenHandler(); + JwtSecurityToken jwtToken = (JwtSecurityToken)handler.ReadToken(token); + return jwtToken.Claims.First(claim => claim.Type == "Username").Value; + } + return null; + } + /// + ///Deserializes the token string if valid to return the specified branchId in the token string + /// + /// + /// Username + public string? GetBaseBranch(string a_token) + { + if (ValidateToken(a_token) == AuthEnums.Valid) + { + string token = a_token.Substring(6).Trim(); + var handler = new JwtSecurityTokenHandler(); + JwtSecurityToken jwtToken = (JwtSecurityToken)handler.ReadToken(token); + return jwtToken.Claims.First(claim => claim.Type == "BranchId").Value; + } + return null; + } + + public bool? GetComparison(string a_token) + { + if (ValidateToken(a_token) == AuthEnums.Valid) + { + string token = a_token.Substring(6).Trim(); + var handler = new JwtSecurityTokenHandler(); + JwtSecurityToken jwtToken = (JwtSecurityToken)handler.ReadToken(token); + return bool.Parse(jwtToken.Claims.First(claim => claim.Type == "ComparisonMode").Value); + } + return null; + } + /// + ///Deserializes the token string if valid to return the specified list of branches a user has access to in the token string + /// + /// + /// Username + public string? GetAllBranch(string a_token) + { + if (ValidateToken(a_token) == AuthEnums.Valid) + { + string token = a_token.Substring(6).Trim(); + var handler = new JwtSecurityTokenHandler(); + JwtSecurityToken jwtToken = (JwtSecurityToken)handler.ReadToken(token); + return jwtToken.Claims.First(claim => claim.Type == "BranchAccess").Value; + } + return null; + } + /// + /// Return a specified list of branches a user has access if comparison mode is set otherwise returns only the + /// active branch on the list + /// + /// + /// + public IEnumerable BranchIds(string a_token) + { + List branchIds = new List(); + if (ValidateToken(a_token) == AuthEnums.Valid) + { + bool comparison = GetComparison(a_token)!.Value; + if (comparison) + { + string? branches = GetAllBranch(a_token); + if (branches != null) + { + string[] branchArray = branches!.Split(); + branchIds.AddRange(branchArray); + } + } + else + { + string? baseBranch = GetBaseBranch(a_token); + branchIds.Add(baseBranch!); + } + } + return branchIds.AsEnumerable(); + } + + public async Task SetToken(string a_token, bool a_remember) + { + if (a_remember) + { + await m_localStorage.SetItemAsStringAsync("token", $"Bearer {a_token}"); + } + else + { + await m_sessionStorage.SetItemAsStringAsync("token", $"Bearer {a_token}"); + } + } + + public async Task GetToken() + { + string token = await m_localStorage.GetItemAsStringAsync("token"); + if (String.IsNullOrEmpty(token)) + { + token = await m_sessionStorage.GetItemAsStringAsync("token"); + } + return token; + } + + public async Task ClearToken() + { + await m_localStorage.ClearAsync(); + await m_sessionStorage.ClearAsync(); + } + + public async Task IsTokenSet() + { + return await m_localStorage.ContainKeyAsync("token") || await m_sessionStorage.ContainKeyAsync("token"); + } + } +} diff --git a/Shared/SharedClass.cs b/Shared/SharedClass.cs new file mode 100644 index 0000000..bb016a8 --- /dev/null +++ b/Shared/SharedClass.cs @@ -0,0 +1 @@ +/* Shared classes can be referenced by both the Client and Server */ -- 2.25.1 From f0555cb9771b3da954ec560f2790f1dae3ba4442 Mon Sep 17 00:00:00 2001 From: barhen Date: Sun, 2 Jul 2023 11:43:18 -0500 Subject: [PATCH 2/4] Server Manager Setup --- ClientManager/ClientManager.csproj | 5 + ServerManager/BiskAcdbContext.cs | 1374 +++++++++++++++++++++++ ServerManager/BiskilogContext.cs | 278 +++++ ServerManager/ServerManager.csproj | 6 +- ServerManager/appsettings.json | 13 +- Shared/ServiceRepo/CalculatorService.cs | 63 -- Shared/ServiceRepo/SearchService.cs | 33 - 7 files changed, 1672 insertions(+), 100 deletions(-) create mode 100644 ServerManager/BiskAcdbContext.cs create mode 100644 ServerManager/BiskilogContext.cs delete mode 100644 Shared/ServiceRepo/CalculatorService.cs delete mode 100644 Shared/ServiceRepo/SearchService.cs diff --git a/ClientManager/ClientManager.csproj b/ClientManager/ClientManager.csproj index 2299ab1..cb64f7b 100644 --- a/ClientManager/ClientManager.csproj +++ b/ClientManager/ClientManager.csproj @@ -8,6 +8,11 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/ServerManager/BiskAcdbContext.cs b/ServerManager/BiskAcdbContext.cs new file mode 100644 index 0000000..d3a0c72 --- /dev/null +++ b/ServerManager/BiskAcdbContext.cs @@ -0,0 +1,1374 @@ +using Azure.Core; +using Biskilog_Cloud.Shared.Enums; +using Biskilog_Cloud.Shared.Interfaces; +using Biskilog_Cloud.Shared.POSModels; +using Microsoft.EntityFrameworkCore; +using Microsoft.Net.Http.Headers; + +namespace ServerManager.Server.POSModels; + +public partial class BiskAcdbContext : DbContext +{ + private readonly HttpContext m_httpContext; + private readonly IConnectionService m_connection; + private readonly ITokenService m_tokenService; + public BiskAcdbContext() + { + } + public BiskAcdbContext(DbContextOptions options, ITokenService tokenService, IConnectionService connection, IHttpContextAccessor a_httpContextAccessor = null) + : base(options) + { + m_tokenService = tokenService; + m_connection = connection; + m_httpContext = a_httpContextAccessor?.HttpContext; + } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { + string token = m_httpContext.Request.Headers[HeaderNames.Authorization]!; + if (AuthEnums.Valid == m_tokenService.ValidateToken(token)) + { + int? databaseId = m_tokenService.GetDatabaseIdFromToken(token); + string connectionString = m_connection.GetClientConnectionString(databaseId!.Value); + optionsBuilder.UseMySql(connectionString, new MariaDbServerVersion(new Version())); + } + else + { + m_httpContext.Abort(); + } + } + } + public virtual DbSet Creditpurchases { get; set; } + + public virtual DbSet Customeraccounts { get; set; } + + public virtual DbSet Productaltunits { get; set; } + + public virtual DbSet Restocklevels { get; set; } + + public virtual DbSet Systemuserroles { get; set; } + + public virtual DbSet Tblbranches { get; set; } + + public virtual DbSet Tblbrands { get; set; } + + public virtual DbSet Tblcancelledtransactions { get; set; } + + public virtual DbSet Tblcarts { get; set; } + + public virtual DbSet Tblcategories { get; set; } + + public virtual DbSet Tblcompanydetails { get; set; } + + public virtual DbSet Tblcustomers { get; set; } + + public virtual DbSet Tblcustomerpurchases { get; set; } + + public virtual DbSet Tbldeliverydetails { get; set; } + + public virtual DbSet Tbldeliveryheads { get; set; } + + public virtual DbSet Tbldeliveryrecipients { get; set; } + + public virtual DbSet Tbldiscountlogs { get; set; } + + public virtual DbSet Tbldrivers { get; set; } + + public virtual DbSet Tblinventories { get; set; } + + public virtual DbSet Tblinventoryentries { get; set; } + + public virtual DbSet Tblinvoices { get; set; } + + public virtual DbSet Tblpricechanges { get; set; } + + public virtual DbSet Tblproducts { get; set; } + + public virtual DbSet Tbltrucks { get; set; } + + public virtual DbSet TbltruckDrivermappings { get; set; } + + public virtual DbSet Tbltruckassignments { get; set; } + + public virtual DbSet Tbltruckinventories { get; set; } + + public virtual DbSet Tblusers { get; set; } + + public virtual DbSet Tbstocks { get; set; } + + public virtual DbSet Unitofmeasures { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.ReceiptId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("creditpurchases") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.ReceiptId) + .HasMaxLength(120) + .HasColumnName("receiptID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("'0'") + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.CustomerId) + .HasMaxLength(120) + .HasDefaultValueSql("'0'") + .HasColumnName("customerID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Date) + .ValueGeneratedOnAddOrUpdate() + .HasDefaultValueSql("current_timestamp()") + .HasColumnType("timestamp") + .HasColumnName("date"); + entity.Property(e => e.Paid) + .HasPrecision(19, 2) + .HasColumnName("paid"); + entity.Property(e => e.Status) + .HasMaxLength(10) + .HasDefaultValueSql("'0'") + .IsFixedLength() + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.TotalBill) + .HasPrecision(19, 2) + .HasColumnName("totalBill"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.BranchId, e.CountId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("customeraccounts") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.CountId) + .HasMaxLength(120) + .HasDefaultValueSql("''") + .HasColumnName("countID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Balance) + .HasPrecision(19, 2) + .HasColumnName("balance"); + entity.Property(e => e.Comments) + .HasColumnType("text") + .HasColumnName("comments") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Credit) + .HasPrecision(19, 2) + .HasColumnName("credit"); + entity.Property(e => e.CustomerId) + .HasMaxLength(120) + .HasColumnName("customerID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Date) + .ValueGeneratedOnAddOrUpdate() + .HasDefaultValueSql("current_timestamp()") + .HasColumnType("timestamp") + .HasColumnName("date"); + entity.Property(e => e.Debit) + .HasPrecision(19, 2) + .HasColumnName("debit"); + entity.Property(e => e.TransactionId) + .HasMaxLength(120) + .HasColumnName("transactionID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.DistinctiveCode, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("productaltunit") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.DistinctiveCode) + .HasMaxLength(120) + .HasColumnName("distinctiveCode") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BranchId) + .HasMaxLength(120) + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Pcode) + .HasMaxLength(120) + .HasColumnName("pcode") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.PriceUnit) + .HasPrecision(19, 2) + .HasColumnName("price/unit"); + entity.Property(e => e.QuantityUnit) + .HasColumnType("int(11)") + .HasColumnName("quantity/unit"); + entity.Property(e => e.UnitBarcode) + .HasMaxLength(20) + .HasColumnName("unitBarcode") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.UnitCode) + .HasMaxLength(120) + .HasColumnName("unitCode") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.ProductId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("restocklevels") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.ProductId) + .HasMaxLength(150) + .HasColumnName("productID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BranchId) + .HasMaxLength(20) + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Unit) + .HasMaxLength(150) + .HasColumnName("unit") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.WarnLevel) + .HasColumnType("int(11)") + .HasColumnName("warnLevel"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PRIMARY"); + + entity + .ToTable("systemuserroles") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnType("int(11)") + .HasColumnName("id"); + entity.Property(e => e.Assist) + .HasColumnType("tinyint(4)") + .HasColumnName("assist"); + entity.Property(e => e.Cashier) + .HasColumnType("tinyint(4)") + .HasColumnName("cashier"); + entity.Property(e => e.Manager) + .HasColumnType("tinyint(4)") + .HasColumnName("manager"); + entity.Property(e => e.Owner) + .HasColumnType("tinyint(4)") + .HasColumnName("owner"); + entity.Property(e => e.Roles) + .HasColumnName("roles") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.BranchId).HasName("PRIMARY"); + + entity + .ToTable("tblbranches") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Address) + .HasMaxLength(50) + .HasColumnName("address") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BranchName) + .HasMaxLength(50) + .HasColumnName("branchName") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BranchTelephone) + .HasMaxLength(50) + .HasColumnName("branch_telephone") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.City) + .HasMaxLength(50) + .HasColumnName("city") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.StateOrProvince) + .HasMaxLength(50) + .HasColumnName("state_or_province") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.Id, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblbrand") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.Id) + .HasMaxLength(50) + .HasColumnName("id"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Brand) + .HasMaxLength(50) + .HasColumnName("brand") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.BranchId, e.CountId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblcancelledtransactions") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.CancelledBy) + .HasMaxLength(50) + .HasColumnName("cancelledBy") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.DateCancelled) + .HasColumnType("timestamp") + .HasColumnName("dateCancelled"); + entity.Property(e => e.Transno) + .HasColumnName("transno") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.BranchId, e.CountId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblcart") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.CountId) + .HasMaxLength(200) + .HasColumnName("countID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Cashier) + .HasMaxLength(50) + .HasColumnName("cashier"); + entity.Property(e => e.Costprice) + .HasPrecision(19, 2) + .HasColumnName("costprice"); + entity.Property(e => e.Date) + .HasColumnType("timestamp") + .HasColumnName("date"); + entity.Property(e => e.Id) + .HasMaxLength(50) + .HasColumnName("id"); + entity.Property(e => e.Price) + .HasPrecision(19, 2) + .HasColumnName("price"); + entity.Property(e => e.Quantity) + .HasColumnType("int(11)") + .HasColumnName("quantity"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Total) + .HasPrecision(19, 2) + .HasColumnName("total"); + entity.Property(e => e.Transno) + .HasColumnName("transno") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .HasColumnName("unit") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Tendered) + .HasPrecision(19, 2) + .HasColumnName("tendered"); + entity.Property(e => e.Balance) + .HasPrecision(19, 2) + .HasColumnName("balance"); + entity.Property(e => e.ValueAddTax) + .HasPrecision(19, 2) + .HasColumnName("valueAddTax"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.Id, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblcategory") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.Id) + .HasMaxLength(50) + .HasColumnName("id"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Category) + .HasMaxLength(50) + .HasColumnName("category") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Tin).HasName("PRIMARY"); + + entity + .ToTable("tblcompanydetails") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.Tin) + .HasMaxLength(60) + .HasColumnName("tin"); + entity.Property(e => e.Address) + .HasMaxLength(50) + .HasColumnName("address") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.CompanyName) + .HasMaxLength(50) + .HasColumnName("company_name") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .HasColumnName("email") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.MainTelephone) + .HasMaxLength(50) + .HasColumnName("main_telephone"); + entity.Property(e => e.Vatno) + .HasMaxLength(60) + .HasColumnName("vatno"); + entity.Property(e => e.Website) + .HasMaxLength(50) + .HasColumnName("website") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CustomerId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblcustomers") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CustomerId) + .HasMaxLength(30) + .HasColumnName("customerID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.Address) + .HasMaxLength(50) + .HasColumnName("address") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.DateAdded) + .HasColumnType("timestamp") + .HasColumnName("dateAdded"); + entity.Property(e => e.DateExit) + .HasColumnType("timestamp") + .HasColumnName("dateExit"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .HasColumnName("email"); + entity.Property(e => e.FinancialStatus) + .HasMaxLength(20) + .HasColumnName("financialStatus") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Firstname) + .HasMaxLength(50) + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.NameKey1) + .HasMaxLength(120) + .HasColumnName("name_key1") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.NameKey2) + .HasMaxLength(120) + .HasColumnName("name_key2") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Status) + .HasMaxLength(20) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Surname) + .HasMaxLength(50) + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Telephone) + .HasMaxLength(50) + .HasColumnName("telephone") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Tin) + .HasMaxLength(50) + .HasColumnName("tin"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.BranchId, e.CountId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblcustomerpurchases") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.CustomerId) + .HasMaxLength(50) + .HasColumnName("customerID"); + entity.Property(e => e.TransactionId) + .HasMaxLength(50) + .HasColumnName("transactionID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbldeliverydetails") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(100) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Cost) + .HasPrecision(19, 2) + .HasColumnName("cost"); + entity.Property(e => e.DeliveryId) + .HasMaxLength(60) + .HasColumnName("deliveryID"); + entity.Property(e => e.Pcode) + .HasMaxLength(60) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity) + .HasColumnType("int(11)") + .HasColumnName("quantity"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .HasColumnName("unit") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.DeliveryId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbldeliveryhead") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.DeliveryId) + .HasMaxLength(60) + .HasColumnName("deliveryID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.CustomerId) + .HasMaxLength(60) + .HasColumnName("customerID"); + entity.Property(e => e.DateCompleted) + .HasMaxLength(6) + .HasColumnName("dateCompleted"); + entity.Property(e => e.DateInitiated) + .HasMaxLength(6) + .HasColumnName("dateInitiated"); + entity.Property(e => e.Destination) + .HasMaxLength(60) + .HasColumnName("destination"); + entity.Property(e => e.GeneratedBy) + .HasMaxLength(50) + .HasColumnName("generatedBy") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Status) + .HasMaxLength(20) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.TotalCost) + .HasPrecision(19, 2) + .HasColumnName("totalCost"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.DeliveryId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbldeliveryrecipients") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.DeliveryId) + .HasMaxLength(60) + .HasColumnName("deliveryID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Address) + .HasMaxLength(60) + .HasColumnName("address"); + entity.Property(e => e.CustomerId) + .HasMaxLength(60) + .HasColumnName("customerID"); + entity.Property(e => e.Email) + .HasMaxLength(60) + .HasColumnName("email"); + entity.Property(e => e.FromDate).HasColumnName("fromDate"); + entity.Property(e => e.Fullname) + .HasColumnName("fullname") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Telephone) + .HasMaxLength(15) + .HasColumnName("telephone") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.ToDate).HasColumnName("toDate"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.BranchId, e.CountId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbldiscountlogs") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.CountId) + .HasMaxLength(150) + .HasDefaultValueSql("''") + .HasColumnName("countID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Cashier) + .HasMaxLength(50) + .HasColumnName("cashier") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Date) + .HasMaxLength(6) + .HasColumnName("date"); + entity.Property(e => e.Discount) + .HasPrecision(19, 2) + .HasColumnName("discount"); + entity.Property(e => e.ReceiptId) + .HasMaxLength(50) + .HasColumnName("receiptID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.DriverId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbldrivers") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.DriverId) + .HasMaxLength(50) + .HasColumnName("driverID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.Address1) + .HasMaxLength(50) + .HasColumnName("address1") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Address2) + .HasMaxLength(50) + .HasColumnName("address2") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.City) + .HasMaxLength(50) + .HasColumnName("city") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.DateOfBirth).HasColumnName("dateOfBirth"); + entity.Property(e => e.Email) + .HasMaxLength(120) + .HasColumnName("email") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Firstname) + .HasMaxLength(50) + .HasColumnName("firstname") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Middlename) + .HasMaxLength(50) + .HasColumnName("middlename") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.State) + .HasMaxLength(50) + .HasColumnName("state") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Surname) + .HasMaxLength(50) + .HasColumnName("surname") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Telephone) + .HasMaxLength(20) + .HasColumnName("telephone") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.BranchId, e.CountId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblinventory") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity) + .HasColumnType("int(11)") + .HasColumnName("quantity"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblinventoryentries") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(120) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.Date) + .HasMaxLength(6) + .HasColumnName("date"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity) + .HasColumnType("int(11)") + .HasColumnName("quantity"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblinvoice") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.DateGenerated).HasColumnName("dateGenerated"); + entity.Property(e => e.GeneratedBy) + .HasMaxLength(50) + .HasColumnName("generatedBy"); + entity.Property(e => e.InvoiceId) + .HasMaxLength(60) + .HasColumnName("invoiceID"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity) + .HasColumnType("int(11)") + .HasColumnName("quantity"); + entity.Property(e => e.Status) + .HasMaxLength(16) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Totalprice) + .HasPrecision(19, 2) + .HasColumnName("totalprice"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .HasColumnName("unit") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Unitprice) + .HasPrecision(19, 2) + .HasColumnName("unitprice"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblpricechanges") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(70) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.ChangeDate) + .HasMaxLength(6) + .HasColumnName("change_date"); + entity.Property(e => e.CurrentPrice) + .HasPrecision(19, 2) + .HasColumnName("current_price"); + entity.Property(e => e.Pcode) + .HasMaxLength(120) + .HasColumnName("pcode"); + entity.Property(e => e.PreviousPrice) + .HasPrecision(19, 2) + .HasColumnName("previous_price"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblproduct") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.Barcode) + .HasMaxLength(50) + .HasColumnName("barcode") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BaseUnit) + .HasMaxLength(120) + .HasColumnName("baseUnit") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Bid) + .HasMaxLength(50) + .HasColumnName("bid"); + entity.Property(e => e.Cid) + .HasMaxLength(50) + .HasColumnName("cid"); + entity.Property(e => e.Costprice) + .HasPrecision(19, 2) + .HasColumnName("costprice"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Pdesc) + .HasColumnName("pdesc") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Price) + .HasPrecision(19, 2) + .HasColumnName("price"); + entity.Property(e => e.ProductName) + .HasColumnName("product_name") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Status) + .HasMaxLength(20) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.TruckId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbltrucks") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.TruckId) + .HasMaxLength(60) + .HasColumnName("truckID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.Brand) + .HasMaxLength(50) + .HasColumnName("brand") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Driver) + .HasMaxLength(50) + .HasColumnName("driver"); + entity.Property(e => e.LicensePlate) + .HasMaxLength(60) + .HasColumnName("licensePlate"); + entity.Property(e => e.Weight) + .HasPrecision(19, 2) + .HasColumnName("weight"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbltruck_drivermapping") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(60) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.DateEntry) + .HasMaxLength(6) + .HasColumnName("dateEntry"); + entity.Property(e => e.DriverId) + .HasMaxLength(50) + .HasColumnName("driverID"); + entity.Property(e => e.Operation) + .HasMaxLength(50) + .HasColumnName("operation") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.TruckId) + .HasMaxLength(50) + .HasColumnName("truckID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbltruckassignments") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(100) + .HasColumnName("countID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Cost) + .HasPrecision(19, 2) + .HasColumnName("cost"); + entity.Property(e => e.DateAssigned) + .HasMaxLength(6) + .HasColumnName("dateAssigned"); + entity.Property(e => e.OrderId) + .HasMaxLength(50) + .HasColumnName("orderID"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.TruckId) + .HasMaxLength(50) + .HasColumnName("truckID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbltruckinventory") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity) + .HasColumnType("int(11)") + .HasColumnName("quantity"); + entity.Property(e => e.TruckId) + .HasMaxLength(50) + .HasColumnName("truckID"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .HasColumnName("unit") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.Username, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tblusers") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.Username) + .HasMaxLength(50) + .HasColumnName("username"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.AccessLevel) + .HasMaxLength(10) + .HasColumnName("access_level") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.City) + .HasMaxLength(50) + .HasColumnName("city") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .HasColumnName("email") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Firstname) + .HasMaxLength(50) + .HasColumnName("firstname") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.LastLogin) + .HasMaxLength(6) + .HasColumnName("last_login"); + entity.Property(e => e.Password) + .HasColumnName("password") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.StateOrProvince) + .HasMaxLength(50) + .HasColumnName("state_or_province") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.StreetAddress1) + .HasMaxLength(50) + .HasColumnName("street_address1") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.StreetAddress2) + .HasMaxLength(50) + .HasColumnName("street_address2") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Surname) + .HasMaxLength(50) + .HasColumnName("surname") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Telephone) + .HasMaxLength(15) + .HasColumnName("telephone") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.CountId, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("tbstock") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsFixedLength() + .HasColumnName("branchID"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Qty) + .HasColumnType("int(11)") + .HasColumnName("qty"); + entity.Property(e => e.Refno) + .HasMaxLength(50) + .HasColumnName("refno"); + entity.Property(e => e.Sdate).HasColumnName("sdate"); + entity.Property(e => e.Stockinby) + .HasMaxLength(50) + .HasColumnName("stockinby") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.UnitCode, e.BranchId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("unitofmeasure") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.UnitCode) + .HasMaxLength(120) + .HasColumnName("unitCode"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .HasDefaultValueSql("''") + .IsFixedLength() + .HasColumnName("branchID") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .HasColumnName("status") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Unitname) + .HasMaxLength(120) + .HasColumnName("unitname") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Unitshort) + .HasMaxLength(120) + .HasColumnName("unitshort") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/ServerManager/BiskilogContext.cs b/ServerManager/BiskilogContext.cs new file mode 100644 index 0000000..9e4a350 --- /dev/null +++ b/ServerManager/BiskilogContext.cs @@ -0,0 +1,278 @@ +using Biskilog_Cloud.Shared.ClientContractModels; +using Microsoft.EntityFrameworkCore; + +namespace ServerManager; +/// +/// This is the main EF DbContext for the Biskilog Accounting +/// +public partial class BiskilogContext : DbContext +{ + public BiskilogContext() + { + } + public BiskilogContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Authtypes { get; set; } + + public virtual DbSet Clientbusinesses { get; set; } + + public virtual DbSet Clientinfos { get; set; } + + public virtual DbSet Contracts { get; set; } + + public virtual DbSet Databasemaps { get; set; } + + public virtual DbSet Siteaccesspermissions { get; set; } + + public virtual DbSet Userauths { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PRIMARY"); + + entity + .ToTable("authtypes") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.Id) + .HasColumnType("int(11)") + .HasColumnName("id"); + entity.Property(e => e.Type) + .HasMaxLength(50) + .HasColumnName("type") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.BusinessId, e.ClientId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); + + entity + .ToTable("clientbusiness") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.BusinessId) + .HasComment("there could be multiple branches of the same business") + .HasColumnType("int(11)") + .HasColumnName("businessId"); + entity.Property(e => e.ClientId) + .HasColumnType("int(11)") + .HasColumnName("clientID"); + entity.Property(e => e.BiskilogVersion) + .HasMaxLength(50) + .HasDefaultValueSql("''") + .HasColumnName("biskilog_version") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.BusinessName) + .HasMaxLength(50) + .HasDefaultValueSql("''") + .HasColumnName("business_name") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.DateJoined) + .HasDefaultValueSql("current_timestamp()") + .HasColumnType("datetime") + .HasColumnName("date_joined"); + entity.Property(e => e.BusinessExternalId) + .HasMaxLength(50) + .HasDefaultValueSql("''") + .HasColumnName("businessExternalId") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ClientId).HasName("PRIMARY"); + + entity + .ToTable("clientinfo") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.ClientId) + .HasColumnType("int(11)") + .HasColumnName("clientID"); + entity.Property(e => e.Email) + .HasMaxLength(200) + .HasColumnName("email") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Fullname) + .HasMaxLength(200) + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.PhoneNumber) + .HasMaxLength(200) + .HasColumnName("phoneNumber") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ContractId).HasName("PRIMARY"); + + entity + .ToTable("contracts") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.HasIndex(e => new { e.ClientId, e.BusinessId }, "clientId_businessId").IsUnique(); + + entity.Property(e => e.ContractId) + .HasColumnType("int(11)") + .HasColumnName("contractId"); + entity.Property(e => e.Bill) + .HasPrecision(18, 2) + .HasColumnName("bill"); + entity.Property(e => e.BusinessId) + .HasColumnType("int(11)") + .HasColumnName("businessId"); + entity.Property(e => e.ClientId) + .HasColumnType("int(11)") + .HasColumnName("clientId"); + entity.Property(e => e.Comments) + .HasColumnType("text") + .HasColumnName("comments") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.EndDate) + .HasColumnType("datetime") + .HasColumnName("end_date"); + entity.Property(e => e.StartDate) + .HasColumnType("datetime") + .HasColumnName("start_date"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.DbNo).HasName("PRIMARY"); + + entity + .ToTable("databasemap") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.HasIndex(e => e.ClientId, "businessId").IsUnique(); + + entity.Property(e => e.DbNo) + .HasColumnType("int(11)") + .HasColumnName("db_no"); + entity.Property(e => e.ClientId) + .HasColumnType("int(11)") + .HasColumnName("clientID"); + entity.Property(e => e.DbName) + .HasMaxLength(50) + .HasDefaultValueSql("''") + .HasColumnName("db_name") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Domain) + .HasMaxLength(50) + .HasDefaultValueSql("''") + .HasColumnName("domain") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.LastSyncDate) + .HasColumnType("datetime") + .HasColumnName("last_sync_date"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.UserId, e.BusinessId, e.ClientId }) + .HasName("PRIMARY") + .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0, 0 }); + + entity + .ToTable("siteaccesspermission") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.Property(e => e.UserId) + .HasColumnType("int(11)") + .HasColumnName("userID"); + entity.Property(e => e.BusinessId) + .HasComment("businessIds could also been seen as branchID") + .HasColumnType("int(11)") + .HasColumnName("businessId"); + entity.Property(e => e.ClientId) + .HasColumnType("int(11)") + .HasColumnName("clientId"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.UserId).HasName("PRIMARY"); + + entity + .ToTable("userauth") + .HasCharSet("utf8") + .UseCollation("utf8_general_ci"); + + entity.HasIndex(e => e.AuthType, "authType"); + + entity.HasIndex(e => new { e.ClientId, e.Username, e.Email }, "clientId_username_email").IsUnique(); + + entity.Property(e => e.UserId) + .HasColumnType("int(11)") + .HasColumnName("userId"); + entity.Property(e => e.AuthType) + .HasColumnType("int(11)") + .HasColumnName("authType"); + entity.Property(e => e.ClientId) + .HasColumnType("int(11)") + .HasColumnName("clientId"); + entity.Property(e => e.Email) + .HasMaxLength(200) + .HasColumnName("email") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Isactive) + .HasColumnType("bit(1)") + .HasColumnName("isactive"); + entity.Property(e => e.Isowner) + .HasColumnType("bit(1)") + .HasColumnName("isowner"); + entity.Property(e => e.LastLogin) + .HasColumnType("datetime") + .HasColumnName("last_login"); + entity.Property(e => e.Passsword) + .HasMaxLength(200) + .HasColumnName("passsword") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.PhoneNumber) + .HasMaxLength(50) + .HasColumnName("phoneNumber") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + entity.Property(e => e.Username) + .HasMaxLength(30) + .HasColumnName("username") + .UseCollation("utf8mb4_general_ci") + .HasCharSet("utf8mb4"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/ServerManager/ServerManager.csproj b/ServerManager/ServerManager.csproj index f4f1c1b..c991855 100644 --- a/ServerManager/ServerManager.csproj +++ b/ServerManager/ServerManager.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -27,5 +27,7 @@ - + + + diff --git a/ServerManager/appsettings.json b/ServerManager/appsettings.json index 10f68b8..984fb06 100644 --- a/ServerManager/appsettings.json +++ b/ServerManager/appsettings.json @@ -5,5 +5,14 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" -} + "ConnectionStrings": { + "Connection": "server=54.37.19.162;database=dev_biskilogclients;user=biskilog;password=mefbuk-6niFsu-fytrew", + "PrivateConnection": "server={0};database={1};user=biskilog;password=mefbuk-6niFsu-fytrew;default command timeout=0;" + }, + "AllowedHosts": "*", + "JWT": { + "Key": "@@BISKILOGACCOUNTING2023DEV??//##$", + "Issuer": "AUTH SERVER", + "Audience": "BISKILOG" + } +} \ No newline at end of file diff --git a/Shared/ServiceRepo/CalculatorService.cs b/Shared/ServiceRepo/CalculatorService.cs deleted file mode 100644 index 2bf104d..0000000 --- a/Shared/ServiceRepo/CalculatorService.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Biskilog_Cloud.Shared.Interfaces; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Biskilog_Cloud.Shared.ServiceRepo -{ - public class CalculatorService : ICalculator - { - public double CalculatePercentage() - { - throw new NotImplementedException(); - } - - public string FormatMoneyWithCurrency(double a_amount) - { - return string.Format(GetCurrencyCode(), " {0:C2}", a_amount); - } - public string FormatMoneyWithCurrencyKilo(double a_amount) - { - return GetCurrencyCode().CurrencySymbol + FormatNumber(a_amount); - } - public NumberFormatInfo GetCurrencyCode() - { - //TODO have a better implementation - - // Specify the locale for Ghana - string locale = "en-GH"; - - // Get the NumberFormatInfo for the specified locale - NumberFormatInfo numberFormatInfo = new CultureInfo(locale).NumberFormat; - - // Set the currency symbol to Ghanaian cedi - numberFormatInfo.CurrencySymbol = "GH₵ "; - - return numberFormatInfo; - } - private string FormatNumber(double a_amount) - { - if (a_amount >= 100000000) - { - return (a_amount / 1000000D).ToString("0.#M"); - } - if (a_amount >= 1000000) - { - return (a_amount / 1000000D).ToString("0.##M"); - } - if (a_amount >= 100000) - { - return (a_amount / 1000D).ToString("0.#k"); - } - if (a_amount >= 10000) - { - return (a_amount / 1000D).ToString("0.##k"); - } - - return a_amount.ToString("#,0"); - } - } -} diff --git a/Shared/ServiceRepo/SearchService.cs b/Shared/ServiceRepo/SearchService.cs deleted file mode 100644 index 0af6ab3..0000000 --- a/Shared/ServiceRepo/SearchService.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Biskilog_Cloud.Shared.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Biskilog_Cloud.Shared.ServiceRepo -{ - public class SearchService : ISearchService - { - public event Action SearchValueChanged; - public event Action ClearTextBox; - - // Method that raises the event - protected virtual void OnSearchValueChanged(string a_searchKey) - { - SearchValueChanged?.Invoke(a_searchKey); - } - - // Method that triggers the event - public void PerformSearch(string a_searchKey) - { - OnSearchValueChanged(a_searchKey); - } - - public void Clear() - { - ClearTextBox?.Invoke(); - } - } - -} -- 2.25.1 From ad02131d76790ed6547ec7be6433c86fb8f827d7 Mon Sep 17 00:00:00 2001 From: barhen Date: Sun, 9 Jul 2023 18:11:53 -0500 Subject: [PATCH 3/4] Server Manager part setup --- ClientManager/BiskPosContext.cs | 1172 ++++++++++++++++++++++ ClientManager/ClientManager.csproj | 9 + ServerManager/Hubs/SalesHub.cs | 18 + ServerManager/Interface/ISalesHub.cs | 7 + Shared/Models/CreditPurchase.cs | 23 + Shared/Models/CustomerAccount.cs | 27 + Shared/Models/ProductAltUnit.cs | 23 + Shared/Models/RestockLevel.cs | 17 + Shared/Models/SystemUserRole.cs | 21 + Shared/Models/TbStock.cs | 23 + Shared/Models/TblBranch.cs | 21 + Shared/Models/TblBrand.cs | 15 + Shared/Models/TblCancelledTransaction.cs | 19 + Shared/Models/TblCart.cs | 39 + Shared/Models/TblCategory.cs | 15 + Shared/Models/TblCompanyDetail.cs | 23 + Shared/Models/TblCustomer.cs | 37 + Shared/Models/TblCustomerPurchase.cs | 17 + Shared/Models/TblDeliveryDetail.cs | 21 + Shared/Models/TblDeliveryHead.cs | 27 + Shared/Models/TblDeliveryRecipient.cs | 25 + Shared/Models/TblDiscountLog.cs | 21 + Shared/Models/TblDriver.cs | 35 + Shared/Models/TblHeldTransaction.cs | 41 + Shared/Models/TblInventory.cs | 17 + Shared/Models/TblInventoryEntry.cs | 19 + Shared/Models/TblInvoice.cs | 31 + Shared/Models/TblPriceChange.cs | 21 + Shared/Models/TblProduct.cs | 33 + Shared/Models/TblTruck.cs | 21 + Shared/Models/TblTruckAssignment.cs | 21 + Shared/Models/TblTruckDriverMapping.cs | 19 + Shared/Models/TblTruckInventory.cs | 19 + Shared/Models/TblUser.cs | 35 + Shared/Models/TblUserActivity.cs | 15 + Shared/Models/UnitOfMeasure.cs | 19 + 36 files changed, 1966 insertions(+) create mode 100644 ClientManager/BiskPosContext.cs create mode 100644 ServerManager/Hubs/SalesHub.cs create mode 100644 ServerManager/Interface/ISalesHub.cs create mode 100644 Shared/Models/CreditPurchase.cs create mode 100644 Shared/Models/CustomerAccount.cs create mode 100644 Shared/Models/ProductAltUnit.cs create mode 100644 Shared/Models/RestockLevel.cs create mode 100644 Shared/Models/SystemUserRole.cs create mode 100644 Shared/Models/TbStock.cs create mode 100644 Shared/Models/TblBranch.cs create mode 100644 Shared/Models/TblBrand.cs create mode 100644 Shared/Models/TblCancelledTransaction.cs create mode 100644 Shared/Models/TblCart.cs create mode 100644 Shared/Models/TblCategory.cs create mode 100644 Shared/Models/TblCompanyDetail.cs create mode 100644 Shared/Models/TblCustomer.cs create mode 100644 Shared/Models/TblCustomerPurchase.cs create mode 100644 Shared/Models/TblDeliveryDetail.cs create mode 100644 Shared/Models/TblDeliveryHead.cs create mode 100644 Shared/Models/TblDeliveryRecipient.cs create mode 100644 Shared/Models/TblDiscountLog.cs create mode 100644 Shared/Models/TblDriver.cs create mode 100644 Shared/Models/TblHeldTransaction.cs create mode 100644 Shared/Models/TblInventory.cs create mode 100644 Shared/Models/TblInventoryEntry.cs create mode 100644 Shared/Models/TblInvoice.cs create mode 100644 Shared/Models/TblPriceChange.cs create mode 100644 Shared/Models/TblProduct.cs create mode 100644 Shared/Models/TblTruck.cs create mode 100644 Shared/Models/TblTruckAssignment.cs create mode 100644 Shared/Models/TblTruckDriverMapping.cs create mode 100644 Shared/Models/TblTruckInventory.cs create mode 100644 Shared/Models/TblUser.cs create mode 100644 Shared/Models/TblUserActivity.cs create mode 100644 Shared/Models/UnitOfMeasure.cs diff --git a/ClientManager/BiskPosContext.cs b/ClientManager/BiskPosContext.cs new file mode 100644 index 0000000..c0dc102 --- /dev/null +++ b/ClientManager/BiskPosContext.cs @@ -0,0 +1,1172 @@ +using System; +using System.Collections.Generic; +using Biskilog_Cloud.Shared.Models; +using Microsoft.EntityFrameworkCore; + +namespace ClientManager; + +public partial class BiskPosContext : DbContext +{ + public BiskPosContext() + { + } + + public BiskPosContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet CreditPurchases { get; set; } + + public virtual DbSet CustomerAccounts { get; set; } + + public virtual DbSet ProductAltUnits { get; set; } + + public virtual DbSet RestockLevels { get; set; } + + public virtual DbSet SystemUserRoles { get; set; } + + public virtual DbSet TbStocks { get; set; } + + public virtual DbSet TblBranches { get; set; } + + public virtual DbSet TblBrands { get; set; } + + public virtual DbSet TblCancelledTransactions { get; set; } + + public virtual DbSet TblCarts { get; set; } + + public virtual DbSet TblCategories { get; set; } + + public virtual DbSet TblCompanyDetails { get; set; } + + public virtual DbSet TblCustomers { get; set; } + + public virtual DbSet TblCustomerPurchases { get; set; } + + public virtual DbSet TblDeliveryDetails { get; set; } + + public virtual DbSet TblDeliveryHeads { get; set; } + + public virtual DbSet TblDeliveryRecipients { get; set; } + + public virtual DbSet TblDiscountLogs { get; set; } + + public virtual DbSet TblDrivers { get; set; } + + public virtual DbSet TblHeldTransactions { get; set; } + + public virtual DbSet TblInventories { get; set; } + + public virtual DbSet TblInventoryEntries { get; set; } + + public virtual DbSet TblInvoices { get; set; } + + public virtual DbSet TblPriceChanges { get; set; } + + public virtual DbSet TblProducts { get; set; } + + public virtual DbSet TblTrucks { get; set; } + + public virtual DbSet TblTruckAssignments { get; set; } + + public virtual DbSet TblTruckDriverMappings { get; set; } + + public virtual DbSet TblTruckInventories { get; set; } + + public virtual DbSet TblUsers { get; set; } + + public virtual DbSet TblUserActivities { get; set; } + + public virtual DbSet UnitOfMeasures { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. + => optionsBuilder.UseSqlServer("Server=BarhenVM\\SqlExpress;Database=BISK_POS;Integrated Security=True;TrustServerCertificate=true"); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ReceiptId); + + entity.ToTable(tb => tb.HasTrigger("trg_UpdateLastModifiedOnCreditPurchases")); + + entity.Property(e => e.ReceiptId) + .HasMaxLength(120) + .HasColumnName("receiptID"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsUnicode(false) + .HasColumnName("branchID"); + entity.Property(e => e.CustomerId) + .HasMaxLength(120) + .HasColumnName("customerID"); + entity.Property(e => e.Date).HasColumnName("date"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Paid) + .HasColumnType("decimal(19, 2)") + .HasColumnName("paid"); + entity.Property(e => e.Status) + .HasMaxLength(10) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.TotalBill) + .HasColumnType("decimal(19, 2)") + .HasColumnName("totalBill"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable(tb => tb.HasTrigger("trg_UpdateLastModifiedOnCustomerAccounts")); + + entity.Property(e => e.CountId) + .HasMaxLength(120) + .HasColumnName("countID"); + entity.Property(e => e.Balance) + .HasColumnType("decimal(19, 2)") + .HasColumnName("balance"); + entity.Property(e => e.BranchId) + .HasMaxLength(10) + .IsUnicode(false) + .HasColumnName("branchID"); + entity.Property(e => e.Comments) + .IsUnicode(false) + .HasColumnName("comments"); + entity.Property(e => e.Credit) + .HasColumnType("decimal(19, 2)") + .HasColumnName("credit"); + entity.Property(e => e.CustomerId) + .HasMaxLength(120) + .HasColumnName("customerID"); + entity.Property(e => e.Date).HasColumnName("date"); + entity.Property(e => e.Debit) + .HasColumnType("decimal(19, 2)") + .HasColumnName("debit"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.TransactionId) + .HasMaxLength(120) + .HasColumnName("transactionID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.DistinctiveCode).HasName("PK_ProductUnitPricing"); + + entity.ToTable("ProductAltUnit", tb => tb.HasTrigger("trg_UpdateLastModifiedOnProductAltUnit")); + + entity.Property(e => e.DistinctiveCode) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("distinctiveCode"); + entity.Property(e => e.BranchId) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("branchID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("pcode"); + entity.Property(e => e.PriceUnit) + .HasColumnType("decimal(19, 2)") + .HasColumnName("price/unit"); + entity.Property(e => e.QuantityUnit).HasColumnName("quantity/unit"); + entity.Property(e => e.UnitBarcode) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("unitBarcode"); + entity.Property(e => e.UnitCode) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unitCode"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ProductId).HasName("PK_ProductRestockLevels"); + + entity.ToTable(tb => tb.HasTrigger("trg_UpdateLastModifiedOnRestockLevels")); + + entity.Property(e => e.ProductId) + .HasMaxLength(150) + .IsUnicode(false) + .HasColumnName("productID"); + entity.Property(e => e.BranchId) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("branchID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Unit) + .HasMaxLength(150) + .IsUnicode(false) + .HasColumnName("unit"); + entity.Property(e => e.WarnLevel).HasColumnName("warnLevel"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("systemUserRoles", tb => tb.HasTrigger("trg_UpdateLastModifiedOnsystemUserRoles")); + + entity.Property(e => e.Id) + .ValueGeneratedNever() + .HasColumnName("id"); + entity.Property(e => e.Assist).HasColumnName("assist"); + entity.Property(e => e.Cashier).HasColumnName("cashier"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Manager).HasColumnName("manager"); + entity.Property(e => e.Owner).HasColumnName("owner"); + entity.Property(e => e.Roles) + .IsUnicode(false) + .HasColumnName("roles"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tbStock", tb => tb.HasTrigger("trg_UpdateLastModifiedOntbStock")); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Qty).HasColumnName("qty"); + entity.Property(e => e.Refno) + .HasMaxLength(50) + .HasColumnName("refno"); + entity.Property(e => e.Sdate) + .HasColumnType("date") + .HasColumnName("sdate"); + entity.Property(e => e.Stockinby) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("stockinby"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.BranchId); + + entity.ToTable("tblBranches", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblBranches")); + + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Address) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("address"); + entity.Property(e => e.BranchName) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("branchName"); + entity.Property(e => e.BranchTelephone) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("branch_telephone"); + entity.Property(e => e.City) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("city"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.StateOrProvince) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("state_or_province"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tblBrand", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblBrand")); + + entity.Property(e => e.Id) + .HasMaxLength(50) + .HasColumnName("id"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Brand) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("brand"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblCancelledTransactions", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblCancelledTransactions")); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.CancelledBy) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("cancelledBy"); + entity.Property(e => e.DateCancelled) + .HasColumnType("datetime") + .HasColumnName("dateCancelled"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Transno) + .IsUnicode(false) + .HasColumnName("transno"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblCart", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblCart")); + + entity.Property(e => e.CountId) + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnName("countID"); + entity.Property(e => e.Balance) + .HasDefaultValueSql("((0))") + .HasColumnType("decimal(19, 2)") + .HasColumnName("balance"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Cashier) + .HasMaxLength(50) + .HasColumnName("cashier"); + entity.Property(e => e.Costprice) + .HasColumnType("decimal(19, 2)") + .HasColumnName("costprice"); + entity.Property(e => e.Date).HasColumnName("date"); + entity.Property(e => e.Id) + .HasMaxLength(50) + .HasColumnName("id"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Price) + .HasColumnType("decimal(19, 2)") + .HasColumnName("price"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.Tendered) + .HasDefaultValueSql("((0))") + .HasColumnType("decimal(19, 2)") + .HasColumnName("tendered"); + entity.Property(e => e.Total) + .HasColumnType("decimal(19, 2)") + .HasColumnName("total"); + entity.Property(e => e.Transno).HasColumnName("transno"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unit"); + entity.Property(e => e.ValueAddTax) + .HasColumnType("decimal(19, 2)") + .HasColumnName("valueAddTax"); + }); + + modelBuilder.Entity(entity => + { + entity.ToTable("tblCategory", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblCategory")); + + entity.Property(e => e.Id) + .HasMaxLength(50) + .HasColumnName("id"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Category) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("category"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Tin); + + entity.ToTable("tblCompanyDetails", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblCompanyDetails")); + + entity.Property(e => e.Tin) + .HasMaxLength(60) + .HasColumnName("tin"); + entity.Property(e => e.Address) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("address"); + entity.Property(e => e.CompanyName) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("company_name"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("email"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.MainTelephone) + .HasMaxLength(50) + .HasColumnName("main_telephone"); + entity.Property(e => e.Vatno) + .HasMaxLength(60) + .HasColumnName("vatno"); + entity.Property(e => e.Website) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("website"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CustomerId); + + entity.ToTable("tblCustomers", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblCustomers")); + + entity.Property(e => e.CustomerId) + .HasMaxLength(30) + .HasColumnName("customerID"); + entity.Property(e => e.Address) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("address"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.DateAdded) + .HasColumnType("date") + .HasColumnName("dateAdded"); + entity.Property(e => e.DateExit) + .HasColumnType("date") + .HasColumnName("dateExit"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .HasColumnName("email"); + entity.Property(e => e.FinancialStatus) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("financialStatus"); + entity.Property(e => e.Firstname) + .HasMaxLength(50) + .IsUnicode(false); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.NameKey1) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("name_key1"); + entity.Property(e => e.NameKey2) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("name_key2"); + entity.Property(e => e.Status) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.Surname) + .HasMaxLength(50) + .IsUnicode(false); + entity.Property(e => e.Telephone) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("telephone"); + entity.Property(e => e.Tin) + .HasMaxLength(50) + .HasColumnName("tin"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblCustomerPurchases", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblCustomerPurchases")); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("branchID"); + entity.Property(e => e.CustomerId) + .HasMaxLength(50) + .HasColumnName("customerID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.TransactionId) + .HasMaxLength(50) + .HasColumnName("transactionID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblDeliveryDetails", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblDeliveryDetails")); + + entity.Property(e => e.CountId) + .HasMaxLength(100) + .HasColumnName("countID"); + entity.Property(e => e.Cost) + .HasColumnType("decimal(19, 2)") + .HasColumnName("cost"); + entity.Property(e => e.DeliveryId) + .HasMaxLength(60) + .HasColumnName("deliveryID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(60) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unit"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.DeliveryId); + + entity.ToTable("tblDeliveryHead", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblDeliveryHead")); + + entity.Property(e => e.DeliveryId) + .HasMaxLength(60) + .HasColumnName("deliveryID"); + entity.Property(e => e.BranchId) + .HasMaxLength(20) + .HasColumnName("branchID"); + entity.Property(e => e.CustomerId) + .HasMaxLength(60) + .HasColumnName("customerID"); + entity.Property(e => e.DateCompleted).HasColumnName("dateCompleted"); + entity.Property(e => e.DateInitiated).HasColumnName("dateInitiated"); + entity.Property(e => e.Destination) + .HasMaxLength(60) + .HasColumnName("destination"); + entity.Property(e => e.GeneratedBy) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("generatedBy"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Status) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.TotalCost) + .HasColumnType("decimal(19, 2)") + .HasColumnName("totalCost"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.DeliveryId); + + entity.ToTable("tblDeliveryRecipients", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblDeliveryRecipients")); + + entity.Property(e => e.DeliveryId) + .HasMaxLength(60) + .HasColumnName("deliveryID"); + entity.Property(e => e.Address) + .HasMaxLength(60) + .HasColumnName("address"); + entity.Property(e => e.CustomerId) + .HasMaxLength(60) + .HasColumnName("customerID"); + entity.Property(e => e.Email) + .HasMaxLength(60) + .HasColumnName("email"); + entity.Property(e => e.FromDate) + .HasColumnType("date") + .HasColumnName("fromDate"); + entity.Property(e => e.Fullname) + .IsUnicode(false) + .HasColumnName("fullname"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Telephone) + .HasMaxLength(15) + .IsUnicode(false) + .HasColumnName("telephone"); + entity.Property(e => e.ToDate) + .HasColumnType("date") + .HasColumnName("toDate"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblDiscountLogs", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblDiscountLogs")); + + entity.Property(e => e.CountId) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("branchID"); + entity.Property(e => e.Cashier) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("cashier"); + entity.Property(e => e.Date).HasColumnName("date"); + entity.Property(e => e.Discount) + .HasColumnType("decimal(19, 2)") + .HasColumnName("discount"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.ReceiptId) + .HasMaxLength(50) + .HasColumnName("receiptID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.DriverId); + + entity.ToTable("tblDrivers", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblDrivers")); + + entity.Property(e => e.DriverId) + .HasMaxLength(50) + .HasColumnName("driverID"); + entity.Property(e => e.Address1) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("address1"); + entity.Property(e => e.Address2) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("address2"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.City) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("city"); + entity.Property(e => e.DateOfBirth) + .HasColumnType("date") + .HasColumnName("dateOfBirth"); + entity.Property(e => e.Email) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("email"); + entity.Property(e => e.Firstname) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("firstname"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Middlename) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("middlename"); + entity.Property(e => e.State) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("state"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.Surname) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("surname"); + entity.Property(e => e.Telephone) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("telephone"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblHeldTransaction", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblHeldTransaction")); + + entity.Property(e => e.CountId) + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Cashier) + .HasMaxLength(50) + .HasColumnName("cashier"); + entity.Property(e => e.Costprice) + .HasColumnType("decimal(19, 2)") + .HasColumnName("costprice"); + entity.Property(e => e.CustomerId) + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnName("customerID"); + entity.Property(e => e.Date).HasColumnName("date"); + entity.Property(e => e.Discount) + .HasColumnType("decimal(19, 2)") + .HasColumnName("discount"); + entity.Property(e => e.Distinctive) + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnName("distinctive"); + entity.Property(e => e.InvoiceId) + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnName("invoiceID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Price) + .HasColumnType("decimal(19, 2)") + .HasColumnName("price"); + entity.Property(e => e.ProductId) + .HasMaxLength(50) + .HasColumnName("productId"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.Total) + .HasColumnType("decimal(19, 2)") + .HasColumnName("total"); + entity.Property(e => e.TransactionId) + .HasMaxLength(200) + .IsUnicode(false) + .HasColumnName("transactionID"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unit"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblInventory", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblInventory")); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblInventoryEntries", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblInventoryEntries")); + + entity.Property(e => e.CountId) + .HasMaxLength(120) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(60) + .HasColumnName("branchID"); + entity.Property(e => e.Date).HasColumnName("date"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId).HasName("PK_tblinvoice"); + + entity.ToTable("tblInvoice", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblInvoice")); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.DateGenerated) + .HasColumnType("date") + .HasColumnName("dateGenerated"); + entity.Property(e => e.GeneratedBy) + .HasMaxLength(50) + .HasColumnName("generatedBy"); + entity.Property(e => e.InvoiceId) + .HasMaxLength(60) + .HasColumnName("invoiceID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + entity.Property(e => e.Status) + .HasMaxLength(16) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.Totalprice) + .HasColumnType("decimal(19, 2)") + .HasColumnName("totalprice"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unit"); + entity.Property(e => e.Unitprice) + .HasColumnType("decimal(19, 2)") + .HasColumnName("unitprice"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblPriceChanges", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblPriceChanges")); + + entity.Property(e => e.CountId) + .HasMaxLength(70) + .HasColumnName("countID"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.ChangeDate).HasColumnName("change_date"); + entity.Property(e => e.CurrentPrice) + .HasColumnType("decimal(19, 2)") + .HasColumnName("current_price"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(120) + .HasColumnName("pcode"); + entity.Property(e => e.PreviousPrice) + .HasColumnType("decimal(19, 2)") + .HasColumnName("previous_price"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblProduct", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblProduct")); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.Barcode) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("barcode"); + entity.Property(e => e.BaseUnit) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("baseUnit"); + entity.Property(e => e.Bid) + .HasMaxLength(50) + .HasColumnName("bid"); + entity.Property(e => e.BranchId) + .HasMaxLength(12) + .HasColumnName("branchID"); + entity.Property(e => e.Cid) + .HasMaxLength(50) + .HasColumnName("cid"); + entity.Property(e => e.Costprice) + .HasColumnType("decimal(19, 2)") + .HasColumnName("costprice"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Pdesc).HasColumnName("pdesc"); + entity.Property(e => e.Price) + .HasColumnType("decimal(19, 2)") + .HasColumnName("price"); + entity.Property(e => e.ProductName) + .IsUnicode(false) + .HasColumnName("product_name"); + entity.Property(e => e.Status) + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnName("status"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.TruckId); + + entity.ToTable("tblTrucks", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblTrucks")); + + entity.Property(e => e.TruckId) + .HasMaxLength(60) + .HasColumnName("truckID"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.Brand) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("brand"); + entity.Property(e => e.Driver) + .HasMaxLength(50) + .HasColumnName("driver"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.LicensePlate) + .HasMaxLength(60) + .HasColumnName("licensePlate"); + entity.Property(e => e.Weight) + .HasColumnType("decimal(19, 2)") + .HasColumnName("weight"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblTruckAssignments", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblTruckAssignments")); + + entity.Property(e => e.CountId) + .HasMaxLength(100) + .IsUnicode(false) + .HasColumnName("countID"); + entity.Property(e => e.Cost) + .HasColumnType("decimal(19, 2)") + .HasColumnName("cost"); + entity.Property(e => e.DateAssigned).HasColumnName("dateAssigned"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.OrderId) + .HasMaxLength(50) + .HasColumnName("orderID"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.TruckId) + .HasMaxLength(50) + .HasColumnName("truckID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblTruck_DriverMapping", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblTruck_DriverMapping")); + + entity.Property(e => e.CountId) + .HasMaxLength(60) + .HasColumnName("countID"); + entity.Property(e => e.DateEntry).HasColumnName("dateEntry"); + entity.Property(e => e.DriverId) + .HasMaxLength(50) + .HasColumnName("driverID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Operation) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("operation"); + entity.Property(e => e.TruckId) + .HasMaxLength(50) + .HasColumnName("truckID"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CountId); + + entity.ToTable("tblTruckInventory", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblTruckInventory")); + + entity.Property(e => e.CountId) + .HasMaxLength(50) + .HasColumnName("countID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Pcode) + .HasMaxLength(50) + .HasColumnName("pcode"); + entity.Property(e => e.Quantity).HasColumnName("quantity"); + entity.Property(e => e.TruckId) + .HasMaxLength(50) + .HasColumnName("truckID"); + entity.Property(e => e.Unit) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unit"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Username); + + entity.ToTable("tblUsers", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblUsers")); + + entity.Property(e => e.Username) + .HasMaxLength(50) + .HasColumnName("username"); + entity.Property(e => e.AccessLevel) + .HasMaxLength(10) + .IsUnicode(false) + .HasColumnName("access_level"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .HasColumnName("branchID"); + entity.Property(e => e.City) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("city"); + entity.Property(e => e.Email) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("email"); + entity.Property(e => e.Firstname) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("firstname"); + entity.Property(e => e.LastLogin).HasColumnName("last_login"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Password) + .IsUnicode(false) + .HasColumnName("password"); + entity.Property(e => e.StateOrProvince) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("state_or_province"); + entity.Property(e => e.StreetAddress1) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("street_address1"); + entity.Property(e => e.StreetAddress2) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("street_address2"); + entity.Property(e => e.Surname) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("surname"); + entity.Property(e => e.Telephone) + .HasMaxLength(15) + .IsUnicode(false) + .HasColumnName("telephone"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Username); + + entity.ToTable("tblUser_activity", tb => tb.HasTrigger("trg_UpdateLastModifiedOntblUser_activity")); + + entity.Property(e => e.Username) + .HasMaxLength(50) + .HasColumnName("username"); + entity.Property(e => e.LastActive).HasColumnName("last_active"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Workstation) + .HasMaxLength(100) + .HasColumnName("workstation"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.UnitCode); + + entity.ToTable("UnitOfMeasure", tb => tb.HasTrigger("trg_UpdateLastModifiedOnUnitOfMeasure")); + + entity.Property(e => e.UnitCode) + .HasMaxLength(120) + .HasColumnName("unitCode"); + entity.Property(e => e.BranchId) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("branchID"); + entity.Property(e => e.LastModified) + .HasDefaultValueSql("(getdate())") + .HasColumnName("last_modified"); + entity.Property(e => e.Status) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("status"); + entity.Property(e => e.Unitname) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unitname"); + entity.Property(e => e.Unitshort) + .HasMaxLength(120) + .IsUnicode(false) + .HasColumnName("unitshort"); + }); + + OnModelCreatingPartial(modelBuilder); + } + + partial void OnModelCreatingPartial(ModelBuilder modelBuilder); +} diff --git a/ClientManager/ClientManager.csproj b/ClientManager/ClientManager.csproj index cb64f7b..0b99a7c 100644 --- a/ClientManager/ClientManager.csproj +++ b/ClientManager/ClientManager.csproj @@ -8,6 +8,7 @@ + all @@ -15,4 +16,12 @@ + + + + + + + + diff --git a/ServerManager/Hubs/SalesHub.cs b/ServerManager/Hubs/SalesHub.cs new file mode 100644 index 0000000..636bd47 --- /dev/null +++ b/ServerManager/Hubs/SalesHub.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.SignalR; +using ServerManager.Interface; + +namespace ServerManager.Hubs +{ + public class SalesHub : Hub + { + public override Task OnConnectedAsync() + { + Clients. + return base.OnConnectedAsync(); + } + public async Task Publish(string a_companyId) + { + await Clients.OthersInGroup(a_companyId).AddTransaction(); + } + } +} diff --git a/ServerManager/Interface/ISalesHub.cs b/ServerManager/Interface/ISalesHub.cs new file mode 100644 index 0000000..47f8910 --- /dev/null +++ b/ServerManager/Interface/ISalesHub.cs @@ -0,0 +1,7 @@ +namespace ServerManager.Interface +{ + public interface ISalesHub + { + Task AddTransaction(); + } +} diff --git a/Shared/Models/CreditPurchase.cs b/Shared/Models/CreditPurchase.cs new file mode 100644 index 0000000..a3a9392 --- /dev/null +++ b/Shared/Models/CreditPurchase.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class CreditPurchase +{ + public string ReceiptId { get; set; } = null!; + + public DateTime? Date { get; set; } + + public decimal? Paid { get; set; } + + public decimal? TotalBill { get; set; } + + public string? CustomerId { get; set; } + + public string? Status { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/CustomerAccount.cs b/Shared/Models/CustomerAccount.cs new file mode 100644 index 0000000..13bbc38 --- /dev/null +++ b/Shared/Models/CustomerAccount.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class CustomerAccount +{ + public string? CustomerId { get; set; } + + public string? TransactionId { get; set; } + + public DateTime? Date { get; set; } + + public decimal? Debit { get; set; } + + public decimal? Credit { get; set; } + + public decimal? Balance { get; set; } + + public string? Comments { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/ProductAltUnit.cs b/Shared/Models/ProductAltUnit.cs new file mode 100644 index 0000000..de4fc97 --- /dev/null +++ b/Shared/Models/ProductAltUnit.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class ProductAltUnit +{ + public string? Pcode { get; set; } + + public string? UnitCode { get; set; } + + public string? UnitBarcode { get; set; } + + public decimal? PriceUnit { get; set; } + + public int? QuantityUnit { get; set; } + + public string DistinctiveCode { get; set; } = null!; + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/RestockLevel.cs b/Shared/Models/RestockLevel.cs new file mode 100644 index 0000000..988ca66 --- /dev/null +++ b/Shared/Models/RestockLevel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class RestockLevel +{ + public string ProductId { get; set; } = null!; + + public int? WarnLevel { get; set; } + + public string? Unit { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/SystemUserRole.cs b/Shared/Models/SystemUserRole.cs new file mode 100644 index 0000000..dd8b06f --- /dev/null +++ b/Shared/Models/SystemUserRole.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class SystemUserRole +{ + public string? Roles { get; set; } + + public bool? Owner { get; set; } + + public bool? Manager { get; set; } + + public bool? Assist { get; set; } + + public bool? Cashier { get; set; } + + public int Id { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TbStock.cs b/Shared/Models/TbStock.cs new file mode 100644 index 0000000..951a3a9 --- /dev/null +++ b/Shared/Models/TbStock.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TbStock +{ + public string? Refno { get; set; } + + public string? Pcode { get; set; } + + public int? Qty { get; set; } + + public DateTime? Sdate { get; set; } + + public string? Stockinby { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblBranch.cs b/Shared/Models/TblBranch.cs new file mode 100644 index 0000000..78a5058 --- /dev/null +++ b/Shared/Models/TblBranch.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblBranch +{ + public string? BranchName { get; set; } + + public string BranchId { get; set; } = null!; + + public string? Address { get; set; } + + public string? City { get; set; } + + public string? StateOrProvince { get; set; } + + public string? BranchTelephone { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblBrand.cs b/Shared/Models/TblBrand.cs new file mode 100644 index 0000000..56201f5 --- /dev/null +++ b/Shared/Models/TblBrand.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblBrand +{ + public string Id { get; set; } = null!; + + public string? Brand { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblCancelledTransaction.cs b/Shared/Models/TblCancelledTransaction.cs new file mode 100644 index 0000000..870f1c3 --- /dev/null +++ b/Shared/Models/TblCancelledTransaction.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblCancelledTransaction +{ + public string? Transno { get; set; } + + public DateTime? DateCancelled { get; set; } + + public string? CancelledBy { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblCart.cs b/Shared/Models/TblCart.cs new file mode 100644 index 0000000..6b84804 --- /dev/null +++ b/Shared/Models/TblCart.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblCart +{ + public string? Transno { get; set; } + + public string? Id { get; set; } + + public int? Quantity { get; set; } + + public DateTime? Date { get; set; } + + public decimal? Price { get; set; } + + public string? Cashier { get; set; } + + public string? Status { get; set; } + + public decimal? Total { get; set; } + + public string? BranchId { get; set; } + + public string? Unit { get; set; } + + public decimal? Costprice { get; set; } + + public decimal? Tendered { get; set; } + + public decimal? Balance { get; set; } + + public decimal? ValueAddTax { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblCategory.cs b/Shared/Models/TblCategory.cs new file mode 100644 index 0000000..1151def --- /dev/null +++ b/Shared/Models/TblCategory.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblCategory +{ + public string Id { get; set; } = null!; + + public string? Category { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblCompanyDetail.cs b/Shared/Models/TblCompanyDetail.cs new file mode 100644 index 0000000..6b6cad3 --- /dev/null +++ b/Shared/Models/TblCompanyDetail.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblCompanyDetail +{ + public string? CompanyName { get; set; } + + public string? Address { get; set; } + + public string? Website { get; set; } + + public string? Email { get; set; } + + public string Tin { get; set; } = null!; + + public string? MainTelephone { get; set; } + + public string? Vatno { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblCustomer.cs b/Shared/Models/TblCustomer.cs new file mode 100644 index 0000000..b32102b --- /dev/null +++ b/Shared/Models/TblCustomer.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblCustomer +{ + public string CustomerId { get; set; } = null!; + + public string? Firstname { get; set; } + + public string? Surname { get; set; } + + public string? Address { get; set; } + + public string? Telephone { get; set; } + + public DateTime? DateAdded { get; set; } + + public string? BranchId { get; set; } + + public string? Status { get; set; } + + public string? Tin { get; set; } + + public DateTime? DateExit { get; set; } + + public string? Email { get; set; } + + public string? FinancialStatus { get; set; } + + public string? NameKey1 { get; set; } + + public string? NameKey2 { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblCustomerPurchase.cs b/Shared/Models/TblCustomerPurchase.cs new file mode 100644 index 0000000..76c3551 --- /dev/null +++ b/Shared/Models/TblCustomerPurchase.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblCustomerPurchase +{ + public string? CustomerId { get; set; } + + public string? TransactionId { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblDeliveryDetail.cs b/Shared/Models/TblDeliveryDetail.cs new file mode 100644 index 0000000..8b970d9 --- /dev/null +++ b/Shared/Models/TblDeliveryDetail.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblDeliveryDetail +{ + public string? DeliveryId { get; set; } + + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public string? Unit { get; set; } + + public decimal? Cost { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblDeliveryHead.cs b/Shared/Models/TblDeliveryHead.cs new file mode 100644 index 0000000..c61a4ef --- /dev/null +++ b/Shared/Models/TblDeliveryHead.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblDeliveryHead +{ + public string DeliveryId { get; set; } = null!; + + public string? GeneratedBy { get; set; } + + public DateTime? DateInitiated { get; set; } + + public DateTime? DateCompleted { get; set; } + + public string? Destination { get; set; } + + public string? CustomerId { get; set; } + + public decimal? TotalCost { get; set; } + + public string? Status { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblDeliveryRecipient.cs b/Shared/Models/TblDeliveryRecipient.cs new file mode 100644 index 0000000..5423865 --- /dev/null +++ b/Shared/Models/TblDeliveryRecipient.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblDeliveryRecipient +{ + public string DeliveryId { get; set; } = null!; + + public string? Fullname { get; set; } + + public string? Address { get; set; } + + public string? Telephone { get; set; } + + public string? Email { get; set; } + + public string? CustomerId { get; set; } + + public DateTime? FromDate { get; set; } + + public DateTime? ToDate { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblDiscountLog.cs b/Shared/Models/TblDiscountLog.cs new file mode 100644 index 0000000..d3b3e31 --- /dev/null +++ b/Shared/Models/TblDiscountLog.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblDiscountLog +{ + public string? ReceiptId { get; set; } + + public string? Cashier { get; set; } + + public DateTime? Date { get; set; } + + public decimal? Discount { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblDriver.cs b/Shared/Models/TblDriver.cs new file mode 100644 index 0000000..57c1b0a --- /dev/null +++ b/Shared/Models/TblDriver.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblDriver +{ + public string DriverId { get; set; } = null!; + + public string? Firstname { get; set; } + + public string? Surname { get; set; } + + public string? Middlename { get; set; } + + public DateTime? DateOfBirth { get; set; } + + public string? Address1 { get; set; } + + public string? Address2 { get; set; } + + public string? Telephone { get; set; } + + public string? Email { get; set; } + + public string? City { get; set; } + + public string? State { get; set; } + + public string? BranchId { get; set; } + + public string? Status { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblHeldTransaction.cs b/Shared/Models/TblHeldTransaction.cs new file mode 100644 index 0000000..5991e35 --- /dev/null +++ b/Shared/Models/TblHeldTransaction.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblHeldTransaction +{ + public string? ProductId { get; set; } + + public int? Quantity { get; set; } + + public DateTime? Date { get; set; } + + public decimal? Price { get; set; } + + public string? Cashier { get; set; } + + public string? Status { get; set; } + + public decimal? Total { get; set; } + + public string? BranchId { get; set; } + + public string? Unit { get; set; } + + public decimal? Costprice { get; set; } + + public decimal? Discount { get; set; } + + public string? InvoiceId { get; set; } + + public string? CustomerId { get; set; } + + public string CountId { get; set; } = null!; + + public string TransactionId { get; set; } = null!; + + public string? Distinctive { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblInventory.cs b/Shared/Models/TblInventory.cs new file mode 100644 index 0000000..2554742 --- /dev/null +++ b/Shared/Models/TblInventory.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblInventory +{ + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblInventoryEntry.cs b/Shared/Models/TblInventoryEntry.cs new file mode 100644 index 0000000..be8fe82 --- /dev/null +++ b/Shared/Models/TblInventoryEntry.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblInventoryEntry +{ + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public DateTime? Date { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblInvoice.cs b/Shared/Models/TblInvoice.cs new file mode 100644 index 0000000..faea52e --- /dev/null +++ b/Shared/Models/TblInvoice.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblInvoice +{ + public string? InvoiceId { get; set; } + + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public decimal? Unitprice { get; set; } + + public string? Unit { get; set; } + + public decimal? Totalprice { get; set; } + + public DateTime? DateGenerated { get; set; } + + public string? Status { get; set; } + + public string? GeneratedBy { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblPriceChange.cs b/Shared/Models/TblPriceChange.cs new file mode 100644 index 0000000..0ebda54 --- /dev/null +++ b/Shared/Models/TblPriceChange.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblPriceChange +{ + public string? Pcode { get; set; } + + public decimal? PreviousPrice { get; set; } + + public decimal? CurrentPrice { get; set; } + + public DateTime? ChangeDate { get; set; } + + public string? BranchId { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblProduct.cs b/Shared/Models/TblProduct.cs new file mode 100644 index 0000000..d1a1536 --- /dev/null +++ b/Shared/Models/TblProduct.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblProduct +{ + public string? Pcode { get; set; } + + public string? Barcode { get; set; } + + public string? Pdesc { get; set; } + + public string? Bid { get; set; } + + public string? Cid { get; set; } + + public decimal? Price { get; set; } + + public decimal? Costprice { get; set; } + + public string? BaseUnit { get; set; } + + public string? ProductName { get; set; } + + public string? BranchId { get; set; } + + public string? Status { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblTruck.cs b/Shared/Models/TblTruck.cs new file mode 100644 index 0000000..853841e --- /dev/null +++ b/Shared/Models/TblTruck.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblTruck +{ + public string TruckId { get; set; } = null!; + + public string? LicensePlate { get; set; } + + public string? Brand { get; set; } + + public string? Driver { get; set; } + + public decimal? Weight { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblTruckAssignment.cs b/Shared/Models/TblTruckAssignment.cs new file mode 100644 index 0000000..68a591f --- /dev/null +++ b/Shared/Models/TblTruckAssignment.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblTruckAssignment +{ + public string? OrderId { get; set; } + + public decimal? Cost { get; set; } + + public string? TruckId { get; set; } + + public string? Status { get; set; } + + public DateTime? DateAssigned { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblTruckDriverMapping.cs b/Shared/Models/TblTruckDriverMapping.cs new file mode 100644 index 0000000..0ce7bdd --- /dev/null +++ b/Shared/Models/TblTruckDriverMapping.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblTruckDriverMapping +{ + public string? TruckId { get; set; } + + public string? DriverId { get; set; } + + public DateTime? DateEntry { get; set; } + + public string? Operation { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblTruckInventory.cs b/Shared/Models/TblTruckInventory.cs new file mode 100644 index 0000000..a451639 --- /dev/null +++ b/Shared/Models/TblTruckInventory.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblTruckInventory +{ + public string? TruckId { get; set; } + + public string? Pcode { get; set; } + + public int? Quantity { get; set; } + + public string? Unit { get; set; } + + public string CountId { get; set; } = null!; + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblUser.cs b/Shared/Models/TblUser.cs new file mode 100644 index 0000000..01968f9 --- /dev/null +++ b/Shared/Models/TblUser.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblUser +{ + public string Username { get; set; } = null!; + + public string? Password { get; set; } + + public string? Firstname { get; set; } + + public string? Surname { get; set; } + + public string? StreetAddress1 { get; set; } + + public string? StreetAddress2 { get; set; } + + public string? City { get; set; } + + public string? StateOrProvince { get; set; } + + public string? Telephone { get; set; } + + public string? Email { get; set; } + + public string? AccessLevel { get; set; } + + public DateTime? LastLogin { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/TblUserActivity.cs b/Shared/Models/TblUserActivity.cs new file mode 100644 index 0000000..cca58ff --- /dev/null +++ b/Shared/Models/TblUserActivity.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class TblUserActivity +{ + public string Username { get; set; } = null!; + + public DateTime? LastActive { get; set; } + + public string? Workstation { get; set; } + + public DateTime LastModified { get; set; } +} diff --git a/Shared/Models/UnitOfMeasure.cs b/Shared/Models/UnitOfMeasure.cs new file mode 100644 index 0000000..938afc6 --- /dev/null +++ b/Shared/Models/UnitOfMeasure.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace Biskilog_Cloud.Shared.Models; + +public partial class UnitOfMeasure +{ + public string UnitCode { get; set; } = null!; + + public string? Unitname { get; set; } + + public string? Unitshort { get; set; } + + public string? Status { get; set; } + + public string? BranchId { get; set; } + + public DateTime LastModified { get; set; } +} -- 2.25.1 From 9da36388036807d1410cedb698bccd745c0c18d2 Mon Sep 17 00:00:00 2001 From: barhen Date: Sun, 17 Dec 2023 18:45:01 -0500 Subject: [PATCH 4/4] checkpoint setup sync with regular token --- Biskilog_Cloud.sln | 8 +- ClientManager/ClientManager.csproj | 27 - ClientManager/Program.cs | 10 - ClientManager/Properties/launchSettings.json | 11 - ClientManager/Worker.cs | 21 - ClientManager/appsettings.Development.json | 8 - ClientManager/appsettings.json | 8 - ServerManager/BiskAcdbContext.cs | 1374 ----------------- .../BiskPosContext.cs | 79 +- ServerManager/BiskilogContext.cs | 278 ---- ServerManager/Hubs/SalesHub.cs | 18 - ServerManager/Interface/ISalesHub.cs | 7 - ServerManager/Program.cs | 19 + ServerManager/ServerManager.csproj | 1 + ServerManager/ServiceRepo/CompanyService.cs | 287 ++++ ServerManager/ServiceRepo/ProductsService.cs | 390 +++++ ServerManager/ServiceRepo/SalesService.cs | 282 ++++ ServerManager/SyncMethods/CompanySync.cs | 346 +++++ ServerManager/SyncMethods/ProductSync.cs | 327 ++++ ServerManager/SyncMethods/SalesSync.cs | 341 ++++ ServerManager/Worker.cs | 58 +- ServerManager/appsettings.json | 5 +- Shared/CustomModels/CancelledSales.cs | 4 +- Shared/CustomModels/CustomerAccounts.cs | 4 +- Shared/CustomModels/ProductItem.cs | 8 +- Shared/CustomModels/SyncTimestamp.cs | 14 + Shared/Interfaces/IAnalytics.cs | 4 +- Shared/Interfaces/ICompanyInfo.cs | 16 +- Shared/Interfaces/ICustomer.cs | 3 +- Shared/Interfaces/IProducts.cs | 24 +- Shared/Interfaces/ISalesInterface.cs | 15 +- Shared/Interfaces/IUser.cs | 13 +- Shared/Models/TbStock.cs | 1 + Shared/Models/TblCustomer.cs | 2 +- Shared/Models/TblDeliveryDetail.cs | 1 + Shared/Models/TblDeliveryRecipient.cs | 1 + Shared/Models/TblInventory.cs | 2 +- Shared/Models/TblInventoryEntry.cs | 2 +- Shared/Models/TblInvoice.cs | 6 +- Shared/Models/TblPriceChange.cs | 6 +- Shared/Models/TblProduct.cs | 6 +- Shared/Models/TblUser.cs | 24 +- Shared/POSModels/Creditpurchase.cs | 21 - Shared/POSModels/Customeraccount.cs | 25 - Shared/POSModels/Productaltunit.cs | 21 - Shared/POSModels/Restocklevel.cs | 15 - Shared/POSModels/Systemuserrole.cs | 19 - Shared/POSModels/Tblbranch.cs | 19 - Shared/POSModels/Tblbrand.cs | 13 - Shared/POSModels/Tblcancelledtransaction.cs | 17 - Shared/POSModels/Tblcart.cs | 35 - Shared/POSModels/Tblcategory.cs | 13 - Shared/POSModels/Tblcompanydetail.cs | 21 - Shared/POSModels/Tblcustomer.cs | 35 - Shared/POSModels/Tblcustomerpurchase.cs | 15 - Shared/POSModels/Tbldeliverydetail.cs | 21 - Shared/POSModels/Tbldeliveryhead.cs | 25 - Shared/POSModels/Tbldeliveryrecipient.cs | 25 - Shared/POSModels/Tbldiscountlog.cs | 19 - Shared/POSModels/Tbldriver.cs | 33 - Shared/POSModels/Tblinventory.cs | 15 - Shared/POSModels/Tblinventoryentry.cs | 17 - Shared/POSModels/Tblinvoice.cs | 29 - Shared/POSModels/Tblpricechange.cs | 19 - Shared/POSModels/Tblproduct.cs | 31 - Shared/POSModels/Tbltruck.cs | 19 - Shared/POSModels/TbltruckDrivermapping.cs | 19 - Shared/POSModels/Tbltruckassignment.cs | 21 - Shared/POSModels/Tbltruckinventory.cs | 19 - Shared/POSModels/Tbluser.cs | 33 - Shared/POSModels/Tbstock.cs | 21 - Shared/POSModels/Unitofmeasure.cs | 17 - Shared/SharedClass.cs | 3 + 73 files changed, 2196 insertions(+), 2520 deletions(-) delete mode 100644 ClientManager/ClientManager.csproj delete mode 100644 ClientManager/Program.cs delete mode 100644 ClientManager/Properties/launchSettings.json delete mode 100644 ClientManager/Worker.cs delete mode 100644 ClientManager/appsettings.Development.json delete mode 100644 ClientManager/appsettings.json delete mode 100644 ServerManager/BiskAcdbContext.cs rename {ClientManager => ServerManager}/BiskPosContext.cs (95%) delete mode 100644 ServerManager/BiskilogContext.cs delete mode 100644 ServerManager/Hubs/SalesHub.cs delete mode 100644 ServerManager/Interface/ISalesHub.cs create mode 100644 ServerManager/ServiceRepo/CompanyService.cs create mode 100644 ServerManager/ServiceRepo/ProductsService.cs create mode 100644 ServerManager/ServiceRepo/SalesService.cs create mode 100644 ServerManager/SyncMethods/CompanySync.cs create mode 100644 ServerManager/SyncMethods/ProductSync.cs create mode 100644 ServerManager/SyncMethods/SalesSync.cs create mode 100644 Shared/CustomModels/SyncTimestamp.cs delete mode 100644 Shared/POSModels/Creditpurchase.cs delete mode 100644 Shared/POSModels/Customeraccount.cs delete mode 100644 Shared/POSModels/Productaltunit.cs delete mode 100644 Shared/POSModels/Restocklevel.cs delete mode 100644 Shared/POSModels/Systemuserrole.cs delete mode 100644 Shared/POSModels/Tblbranch.cs delete mode 100644 Shared/POSModels/Tblbrand.cs delete mode 100644 Shared/POSModels/Tblcancelledtransaction.cs delete mode 100644 Shared/POSModels/Tblcart.cs delete mode 100644 Shared/POSModels/Tblcategory.cs delete mode 100644 Shared/POSModels/Tblcompanydetail.cs delete mode 100644 Shared/POSModels/Tblcustomer.cs delete mode 100644 Shared/POSModels/Tblcustomerpurchase.cs delete mode 100644 Shared/POSModels/Tbldeliverydetail.cs delete mode 100644 Shared/POSModels/Tbldeliveryhead.cs delete mode 100644 Shared/POSModels/Tbldeliveryrecipient.cs delete mode 100644 Shared/POSModels/Tbldiscountlog.cs delete mode 100644 Shared/POSModels/Tbldriver.cs delete mode 100644 Shared/POSModels/Tblinventory.cs delete mode 100644 Shared/POSModels/Tblinventoryentry.cs delete mode 100644 Shared/POSModels/Tblinvoice.cs delete mode 100644 Shared/POSModels/Tblpricechange.cs delete mode 100644 Shared/POSModels/Tblproduct.cs delete mode 100644 Shared/POSModels/Tbltruck.cs delete mode 100644 Shared/POSModels/TbltruckDrivermapping.cs delete mode 100644 Shared/POSModels/Tbltruckassignment.cs delete mode 100644 Shared/POSModels/Tbltruckinventory.cs delete mode 100644 Shared/POSModels/Tbluser.cs delete mode 100644 Shared/POSModels/Tbstock.cs delete mode 100644 Shared/POSModels/Unitofmeasure.cs diff --git a/Biskilog_Cloud.sln b/Biskilog_Cloud.sln index 72a78cb..860b22f 100644 --- a/Biskilog_Cloud.sln +++ b/Biskilog_Cloud.sln @@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.5.33530.505 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientManager", "ClientManager\ClientManager.csproj", "{AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerManager", "ServerManager\ServerManager.csproj", "{48786C44-14A8-4510-9DC2-167C431DDE95}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServerManager", "ServerManager\ServerManager.csproj", "{48786C44-14A8-4510-9DC2-167C431DDE95}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Biskilog_Cloud.Shared", "Shared\Biskilog_Cloud.Shared.csproj", "{1D368EE7-D1D3-4D50-83ED-57B0EB9CC6F4}" EndProject @@ -15,10 +13,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD0879FE-FBA8-4CD1-B95A-93E0277FD40F}.Release|Any CPU.Build.0 = Release|Any CPU {48786C44-14A8-4510-9DC2-167C431DDE95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48786C44-14A8-4510-9DC2-167C431DDE95}.Debug|Any CPU.Build.0 = Debug|Any CPU {48786C44-14A8-4510-9DC2-167C431DDE95}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/ClientManager/ClientManager.csproj b/ClientManager/ClientManager.csproj deleted file mode 100644 index 0b99a7c..0000000 --- a/ClientManager/ClientManager.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - net7.0 - enable - enable - dotnet-ClientManager-173f3572-8fd4-498f-addd-d620cda23800 - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - diff --git a/ClientManager/Program.cs b/ClientManager/Program.cs deleted file mode 100644 index e0525fe..0000000 --- a/ClientManager/Program.cs +++ /dev/null @@ -1,10 +0,0 @@ -using ClientManager; - -IHost host = Host.CreateDefaultBuilder(args) - .ConfigureServices(services => - { - services.AddHostedService(); - }) - .Build(); - -host.Run(); diff --git a/ClientManager/Properties/launchSettings.json b/ClientManager/Properties/launchSettings.json deleted file mode 100644 index 45d6b52..0000000 --- a/ClientManager/Properties/launchSettings.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "profiles": { - "ClientManager": { - "commandName": "Project", - "dotnetRunMessages": true, - "environmentVariables": { - "DOTNET_ENVIRONMENT": "Development" - } - } - } -} diff --git a/ClientManager/Worker.cs b/ClientManager/Worker.cs deleted file mode 100644 index c26a964..0000000 --- a/ClientManager/Worker.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace ClientManager -{ - public class Worker : BackgroundService - { - private readonly ILogger _logger; - - public Worker(ILogger logger) - { - _logger = logger; - } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - while (!stoppingToken.IsCancellationRequested) - { - _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); - await Task.Delay(1000, stoppingToken); - } - } - } -} \ No newline at end of file diff --git a/ClientManager/appsettings.Development.json b/ClientManager/appsettings.Development.json deleted file mode 100644 index b2dcdb6..0000000 --- a/ClientManager/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/ClientManager/appsettings.json b/ClientManager/appsettings.json deleted file mode 100644 index b2dcdb6..0000000 --- a/ClientManager/appsettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/ServerManager/BiskAcdbContext.cs b/ServerManager/BiskAcdbContext.cs deleted file mode 100644 index d3a0c72..0000000 --- a/ServerManager/BiskAcdbContext.cs +++ /dev/null @@ -1,1374 +0,0 @@ -using Azure.Core; -using Biskilog_Cloud.Shared.Enums; -using Biskilog_Cloud.Shared.Interfaces; -using Biskilog_Cloud.Shared.POSModels; -using Microsoft.EntityFrameworkCore; -using Microsoft.Net.Http.Headers; - -namespace ServerManager.Server.POSModels; - -public partial class BiskAcdbContext : DbContext -{ - private readonly HttpContext m_httpContext; - private readonly IConnectionService m_connection; - private readonly ITokenService m_tokenService; - public BiskAcdbContext() - { - } - public BiskAcdbContext(DbContextOptions options, ITokenService tokenService, IConnectionService connection, IHttpContextAccessor a_httpContextAccessor = null) - : base(options) - { - m_tokenService = tokenService; - m_connection = connection; - m_httpContext = a_httpContextAccessor?.HttpContext; - } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (!optionsBuilder.IsConfigured) - { - string token = m_httpContext.Request.Headers[HeaderNames.Authorization]!; - if (AuthEnums.Valid == m_tokenService.ValidateToken(token)) - { - int? databaseId = m_tokenService.GetDatabaseIdFromToken(token); - string connectionString = m_connection.GetClientConnectionString(databaseId!.Value); - optionsBuilder.UseMySql(connectionString, new MariaDbServerVersion(new Version())); - } - else - { - m_httpContext.Abort(); - } - } - } - public virtual DbSet Creditpurchases { get; set; } - - public virtual DbSet Customeraccounts { get; set; } - - public virtual DbSet Productaltunits { get; set; } - - public virtual DbSet Restocklevels { get; set; } - - public virtual DbSet Systemuserroles { get; set; } - - public virtual DbSet Tblbranches { get; set; } - - public virtual DbSet Tblbrands { get; set; } - - public virtual DbSet Tblcancelledtransactions { get; set; } - - public virtual DbSet Tblcarts { get; set; } - - public virtual DbSet Tblcategories { get; set; } - - public virtual DbSet Tblcompanydetails { get; set; } - - public virtual DbSet Tblcustomers { get; set; } - - public virtual DbSet Tblcustomerpurchases { get; set; } - - public virtual DbSet Tbldeliverydetails { get; set; } - - public virtual DbSet Tbldeliveryheads { get; set; } - - public virtual DbSet Tbldeliveryrecipients { get; set; } - - public virtual DbSet Tbldiscountlogs { get; set; } - - public virtual DbSet Tbldrivers { get; set; } - - public virtual DbSet Tblinventories { get; set; } - - public virtual DbSet Tblinventoryentries { get; set; } - - public virtual DbSet Tblinvoices { get; set; } - - public virtual DbSet Tblpricechanges { get; set; } - - public virtual DbSet Tblproducts { get; set; } - - public virtual DbSet Tbltrucks { get; set; } - - public virtual DbSet TbltruckDrivermappings { get; set; } - - public virtual DbSet Tbltruckassignments { get; set; } - - public virtual DbSet Tbltruckinventories { get; set; } - - public virtual DbSet Tblusers { get; set; } - - public virtual DbSet Tbstocks { get; set; } - - public virtual DbSet Unitofmeasures { get; set; } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.ReceiptId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("creditpurchases") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.ReceiptId) - .HasMaxLength(120) - .HasColumnName("receiptID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("'0'") - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.CustomerId) - .HasMaxLength(120) - .HasDefaultValueSql("'0'") - .HasColumnName("customerID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Date) - .ValueGeneratedOnAddOrUpdate() - .HasDefaultValueSql("current_timestamp()") - .HasColumnType("timestamp") - .HasColumnName("date"); - entity.Property(e => e.Paid) - .HasPrecision(19, 2) - .HasColumnName("paid"); - entity.Property(e => e.Status) - .HasMaxLength(10) - .HasDefaultValueSql("'0'") - .IsFixedLength() - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.TotalBill) - .HasPrecision(19, 2) - .HasColumnName("totalBill"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.BranchId, e.CountId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("customeraccounts") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.CountId) - .HasMaxLength(120) - .HasDefaultValueSql("''") - .HasColumnName("countID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Balance) - .HasPrecision(19, 2) - .HasColumnName("balance"); - entity.Property(e => e.Comments) - .HasColumnType("text") - .HasColumnName("comments") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Credit) - .HasPrecision(19, 2) - .HasColumnName("credit"); - entity.Property(e => e.CustomerId) - .HasMaxLength(120) - .HasColumnName("customerID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Date) - .ValueGeneratedOnAddOrUpdate() - .HasDefaultValueSql("current_timestamp()") - .HasColumnType("timestamp") - .HasColumnName("date"); - entity.Property(e => e.Debit) - .HasPrecision(19, 2) - .HasColumnName("debit"); - entity.Property(e => e.TransactionId) - .HasMaxLength(120) - .HasColumnName("transactionID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.DistinctiveCode, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("productaltunit") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.DistinctiveCode) - .HasMaxLength(120) - .HasColumnName("distinctiveCode") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BranchId) - .HasMaxLength(120) - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Pcode) - .HasMaxLength(120) - .HasColumnName("pcode") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.PriceUnit) - .HasPrecision(19, 2) - .HasColumnName("price/unit"); - entity.Property(e => e.QuantityUnit) - .HasColumnType("int(11)") - .HasColumnName("quantity/unit"); - entity.Property(e => e.UnitBarcode) - .HasMaxLength(20) - .HasColumnName("unitBarcode") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.UnitCode) - .HasMaxLength(120) - .HasColumnName("unitCode") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.ProductId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("restocklevels") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.ProductId) - .HasMaxLength(150) - .HasColumnName("productID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BranchId) - .HasMaxLength(20) - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Unit) - .HasMaxLength(150) - .HasColumnName("unit") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.WarnLevel) - .HasColumnType("int(11)") - .HasColumnName("warnLevel"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("PRIMARY"); - - entity - .ToTable("systemuserroles") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.Id) - .ValueGeneratedNever() - .HasColumnType("int(11)") - .HasColumnName("id"); - entity.Property(e => e.Assist) - .HasColumnType("tinyint(4)") - .HasColumnName("assist"); - entity.Property(e => e.Cashier) - .HasColumnType("tinyint(4)") - .HasColumnName("cashier"); - entity.Property(e => e.Manager) - .HasColumnType("tinyint(4)") - .HasColumnName("manager"); - entity.Property(e => e.Owner) - .HasColumnType("tinyint(4)") - .HasColumnName("owner"); - entity.Property(e => e.Roles) - .HasColumnName("roles") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.BranchId).HasName("PRIMARY"); - - entity - .ToTable("tblbranches") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BranchId) - .HasMaxLength(12) - .HasColumnName("branchID"); - entity.Property(e => e.Address) - .HasMaxLength(50) - .HasColumnName("address") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BranchName) - .HasMaxLength(50) - .HasColumnName("branchName") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BranchTelephone) - .HasMaxLength(50) - .HasColumnName("branch_telephone") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.City) - .HasMaxLength(50) - .HasColumnName("city") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.StateOrProvince) - .HasMaxLength(50) - .HasColumnName("state_or_province") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.Id, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblbrand") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.Id) - .HasMaxLength(50) - .HasColumnName("id"); - entity.Property(e => e.BranchId) - .HasMaxLength(12) - .HasColumnName("branchID"); - entity.Property(e => e.Brand) - .HasMaxLength(50) - .HasColumnName("brand") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.BranchId, e.CountId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblcancelledtransactions") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BranchId) - .HasMaxLength(50) - .HasColumnName("branchID"); - entity.Property(e => e.CountId) - .HasMaxLength(50) - .HasColumnName("countID"); - entity.Property(e => e.CancelledBy) - .HasMaxLength(50) - .HasColumnName("cancelledBy") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.DateCancelled) - .HasColumnType("timestamp") - .HasColumnName("dateCancelled"); - entity.Property(e => e.Transno) - .HasColumnName("transno") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.BranchId, e.CountId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblcart") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.CountId) - .HasMaxLength(200) - .HasColumnName("countID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Cashier) - .HasMaxLength(50) - .HasColumnName("cashier"); - entity.Property(e => e.Costprice) - .HasPrecision(19, 2) - .HasColumnName("costprice"); - entity.Property(e => e.Date) - .HasColumnType("timestamp") - .HasColumnName("date"); - entity.Property(e => e.Id) - .HasMaxLength(50) - .HasColumnName("id"); - entity.Property(e => e.Price) - .HasPrecision(19, 2) - .HasColumnName("price"); - entity.Property(e => e.Quantity) - .HasColumnType("int(11)") - .HasColumnName("quantity"); - entity.Property(e => e.Status) - .HasMaxLength(50) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Total) - .HasPrecision(19, 2) - .HasColumnName("total"); - entity.Property(e => e.Transno) - .HasColumnName("transno") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Unit) - .HasMaxLength(120) - .HasColumnName("unit") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Tendered) - .HasPrecision(19, 2) - .HasColumnName("tendered"); - entity.Property(e => e.Balance) - .HasPrecision(19, 2) - .HasColumnName("balance"); - entity.Property(e => e.ValueAddTax) - .HasPrecision(19, 2) - .HasColumnName("valueAddTax"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.Id, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblcategory") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.Id) - .HasMaxLength(50) - .HasColumnName("id"); - entity.Property(e => e.BranchId) - .HasMaxLength(12) - .HasColumnName("branchID"); - entity.Property(e => e.Category) - .HasMaxLength(50) - .HasColumnName("category") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Tin).HasName("PRIMARY"); - - entity - .ToTable("tblcompanydetails") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.Tin) - .HasMaxLength(60) - .HasColumnName("tin"); - entity.Property(e => e.Address) - .HasMaxLength(50) - .HasColumnName("address") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.CompanyName) - .HasMaxLength(50) - .HasColumnName("company_name") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Email) - .HasMaxLength(50) - .HasColumnName("email") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.MainTelephone) - .HasMaxLength(50) - .HasColumnName("main_telephone"); - entity.Property(e => e.Vatno) - .HasMaxLength(60) - .HasColumnName("vatno"); - entity.Property(e => e.Website) - .HasMaxLength(50) - .HasColumnName("website") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CustomerId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblcustomers") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CustomerId) - .HasMaxLength(30) - .HasColumnName("customerID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.Address) - .HasMaxLength(50) - .HasColumnName("address") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.DateAdded) - .HasColumnType("timestamp") - .HasColumnName("dateAdded"); - entity.Property(e => e.DateExit) - .HasColumnType("timestamp") - .HasColumnName("dateExit"); - entity.Property(e => e.Email) - .HasMaxLength(50) - .HasColumnName("email"); - entity.Property(e => e.FinancialStatus) - .HasMaxLength(20) - .HasColumnName("financialStatus") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Firstname) - .HasMaxLength(50) - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.NameKey1) - .HasMaxLength(120) - .HasColumnName("name_key1") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.NameKey2) - .HasMaxLength(120) - .HasColumnName("name_key2") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Status) - .HasMaxLength(20) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Surname) - .HasMaxLength(50) - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Telephone) - .HasMaxLength(50) - .HasColumnName("telephone") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Tin) - .HasMaxLength(50) - .HasColumnName("tin"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.BranchId, e.CountId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblcustomerpurchases") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.CountId) - .HasMaxLength(50) - .HasColumnName("countID"); - entity.Property(e => e.CustomerId) - .HasMaxLength(50) - .HasColumnName("customerID"); - entity.Property(e => e.TransactionId) - .HasMaxLength(50) - .HasColumnName("transactionID"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbldeliverydetails") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(100) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Cost) - .HasPrecision(19, 2) - .HasColumnName("cost"); - entity.Property(e => e.DeliveryId) - .HasMaxLength(60) - .HasColumnName("deliveryID"); - entity.Property(e => e.Pcode) - .HasMaxLength(60) - .HasColumnName("pcode"); - entity.Property(e => e.Quantity) - .HasColumnType("int(11)") - .HasColumnName("quantity"); - entity.Property(e => e.Unit) - .HasMaxLength(120) - .HasColumnName("unit") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.DeliveryId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbldeliveryhead") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.DeliveryId) - .HasMaxLength(60) - .HasColumnName("deliveryID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.CustomerId) - .HasMaxLength(60) - .HasColumnName("customerID"); - entity.Property(e => e.DateCompleted) - .HasMaxLength(6) - .HasColumnName("dateCompleted"); - entity.Property(e => e.DateInitiated) - .HasMaxLength(6) - .HasColumnName("dateInitiated"); - entity.Property(e => e.Destination) - .HasMaxLength(60) - .HasColumnName("destination"); - entity.Property(e => e.GeneratedBy) - .HasMaxLength(50) - .HasColumnName("generatedBy") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Status) - .HasMaxLength(20) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.TotalCost) - .HasPrecision(19, 2) - .HasColumnName("totalCost"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.DeliveryId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbldeliveryrecipients") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.DeliveryId) - .HasMaxLength(60) - .HasColumnName("deliveryID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Address) - .HasMaxLength(60) - .HasColumnName("address"); - entity.Property(e => e.CustomerId) - .HasMaxLength(60) - .HasColumnName("customerID"); - entity.Property(e => e.Email) - .HasMaxLength(60) - .HasColumnName("email"); - entity.Property(e => e.FromDate).HasColumnName("fromDate"); - entity.Property(e => e.Fullname) - .HasColumnName("fullname") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Telephone) - .HasMaxLength(15) - .HasColumnName("telephone") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.ToDate).HasColumnName("toDate"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.BranchId, e.CountId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbldiscountlogs") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.CountId) - .HasMaxLength(150) - .HasDefaultValueSql("''") - .HasColumnName("countID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Cashier) - .HasMaxLength(50) - .HasColumnName("cashier") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Date) - .HasMaxLength(6) - .HasColumnName("date"); - entity.Property(e => e.Discount) - .HasPrecision(19, 2) - .HasColumnName("discount"); - entity.Property(e => e.ReceiptId) - .HasMaxLength(50) - .HasColumnName("receiptID"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.DriverId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbldrivers") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.DriverId) - .HasMaxLength(50) - .HasColumnName("driverID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.Address1) - .HasMaxLength(50) - .HasColumnName("address1") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Address2) - .HasMaxLength(50) - .HasColumnName("address2") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.City) - .HasMaxLength(50) - .HasColumnName("city") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.DateOfBirth).HasColumnName("dateOfBirth"); - entity.Property(e => e.Email) - .HasMaxLength(120) - .HasColumnName("email") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Firstname) - .HasMaxLength(50) - .HasColumnName("firstname") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Middlename) - .HasMaxLength(50) - .HasColumnName("middlename") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.State) - .HasMaxLength(50) - .HasColumnName("state") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Status) - .HasMaxLength(50) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Surname) - .HasMaxLength(50) - .HasColumnName("surname") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Telephone) - .HasMaxLength(20) - .HasColumnName("telephone") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.BranchId, e.CountId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblinventory") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.CountId) - .HasMaxLength(50) - .HasColumnName("countID"); - entity.Property(e => e.Pcode) - .HasMaxLength(50) - .HasColumnName("pcode"); - entity.Property(e => e.Quantity) - .HasColumnType("int(11)") - .HasColumnName("quantity"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblinventoryentries") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(120) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.Date) - .HasMaxLength(6) - .HasColumnName("date"); - entity.Property(e => e.Pcode) - .HasMaxLength(50) - .HasColumnName("pcode"); - entity.Property(e => e.Quantity) - .HasColumnType("int(11)") - .HasColumnName("quantity"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblinvoice") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(50) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.DateGenerated).HasColumnName("dateGenerated"); - entity.Property(e => e.GeneratedBy) - .HasMaxLength(50) - .HasColumnName("generatedBy"); - entity.Property(e => e.InvoiceId) - .HasMaxLength(60) - .HasColumnName("invoiceID"); - entity.Property(e => e.Pcode) - .HasMaxLength(50) - .HasColumnName("pcode"); - entity.Property(e => e.Quantity) - .HasColumnType("int(11)") - .HasColumnName("quantity"); - entity.Property(e => e.Status) - .HasMaxLength(16) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Totalprice) - .HasPrecision(19, 2) - .HasColumnName("totalprice"); - entity.Property(e => e.Unit) - .HasMaxLength(120) - .HasColumnName("unit") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Unitprice) - .HasPrecision(19, 2) - .HasColumnName("unitprice"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblpricechanges") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(70) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.ChangeDate) - .HasMaxLength(6) - .HasColumnName("change_date"); - entity.Property(e => e.CurrentPrice) - .HasPrecision(19, 2) - .HasColumnName("current_price"); - entity.Property(e => e.Pcode) - .HasMaxLength(120) - .HasColumnName("pcode"); - entity.Property(e => e.PreviousPrice) - .HasPrecision(19, 2) - .HasColumnName("previous_price"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblproduct") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(50) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.Barcode) - .HasMaxLength(50) - .HasColumnName("barcode") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BaseUnit) - .HasMaxLength(120) - .HasColumnName("baseUnit") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Bid) - .HasMaxLength(50) - .HasColumnName("bid"); - entity.Property(e => e.Cid) - .HasMaxLength(50) - .HasColumnName("cid"); - entity.Property(e => e.Costprice) - .HasPrecision(19, 2) - .HasColumnName("costprice"); - entity.Property(e => e.Pcode) - .HasMaxLength(50) - .HasColumnName("pcode"); - entity.Property(e => e.Pdesc) - .HasColumnName("pdesc") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Price) - .HasPrecision(19, 2) - .HasColumnName("price"); - entity.Property(e => e.ProductName) - .HasColumnName("product_name") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Status) - .HasMaxLength(20) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.TruckId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbltrucks") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.TruckId) - .HasMaxLength(60) - .HasColumnName("truckID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.Brand) - .HasMaxLength(50) - .HasColumnName("brand") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Driver) - .HasMaxLength(50) - .HasColumnName("driver"); - entity.Property(e => e.LicensePlate) - .HasMaxLength(60) - .HasColumnName("licensePlate"); - entity.Property(e => e.Weight) - .HasPrecision(19, 2) - .HasColumnName("weight"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbltruck_drivermapping") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(60) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.DateEntry) - .HasMaxLength(6) - .HasColumnName("dateEntry"); - entity.Property(e => e.DriverId) - .HasMaxLength(50) - .HasColumnName("driverID"); - entity.Property(e => e.Operation) - .HasMaxLength(50) - .HasColumnName("operation") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.TruckId) - .HasMaxLength(50) - .HasColumnName("truckID"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbltruckassignments") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(100) - .HasColumnName("countID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Cost) - .HasPrecision(19, 2) - .HasColumnName("cost"); - entity.Property(e => e.DateAssigned) - .HasMaxLength(6) - .HasColumnName("dateAssigned"); - entity.Property(e => e.OrderId) - .HasMaxLength(50) - .HasColumnName("orderID"); - entity.Property(e => e.Status) - .HasMaxLength(50) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.TruckId) - .HasMaxLength(50) - .HasColumnName("truckID"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbltruckinventory") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(50) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Pcode) - .HasMaxLength(50) - .HasColumnName("pcode"); - entity.Property(e => e.Quantity) - .HasColumnType("int(11)") - .HasColumnName("quantity"); - entity.Property(e => e.TruckId) - .HasMaxLength(50) - .HasColumnName("truckID"); - entity.Property(e => e.Unit) - .HasMaxLength(120) - .HasColumnName("unit") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.Username, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tblusers") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.Username) - .HasMaxLength(50) - .HasColumnName("username"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.AccessLevel) - .HasMaxLength(10) - .HasColumnName("access_level") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.City) - .HasMaxLength(50) - .HasColumnName("city") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Email) - .HasMaxLength(50) - .HasColumnName("email") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Firstname) - .HasMaxLength(50) - .HasColumnName("firstname") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.LastLogin) - .HasMaxLength(6) - .HasColumnName("last_login"); - entity.Property(e => e.Password) - .HasColumnName("password") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.StateOrProvince) - .HasMaxLength(50) - .HasColumnName("state_or_province") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.StreetAddress1) - .HasMaxLength(50) - .HasColumnName("street_address1") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.StreetAddress2) - .HasMaxLength(50) - .HasColumnName("street_address2") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Surname) - .HasMaxLength(50) - .HasColumnName("surname") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Telephone) - .HasMaxLength(15) - .HasColumnName("telephone") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.CountId, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("tbstock") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.CountId) - .HasMaxLength(50) - .HasColumnName("countID"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .IsFixedLength() - .HasColumnName("branchID"); - entity.Property(e => e.Pcode) - .HasMaxLength(50) - .HasColumnName("pcode"); - entity.Property(e => e.Qty) - .HasColumnType("int(11)") - .HasColumnName("qty"); - entity.Property(e => e.Refno) - .HasMaxLength(50) - .HasColumnName("refno"); - entity.Property(e => e.Sdate).HasColumnName("sdate"); - entity.Property(e => e.Stockinby) - .HasMaxLength(50) - .HasColumnName("stockinby") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.UnitCode, e.BranchId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("unitofmeasure") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.UnitCode) - .HasMaxLength(120) - .HasColumnName("unitCode"); - entity.Property(e => e.BranchId) - .HasMaxLength(10) - .HasDefaultValueSql("''") - .IsFixedLength() - .HasColumnName("branchID") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Status) - .HasMaxLength(50) - .HasColumnName("status") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Unitname) - .HasMaxLength(120) - .HasColumnName("unitname") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Unitshort) - .HasMaxLength(120) - .HasColumnName("unitshort") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - OnModelCreatingPartial(modelBuilder); - } - - partial void OnModelCreatingPartial(ModelBuilder modelBuilder); -} diff --git a/ClientManager/BiskPosContext.cs b/ServerManager/BiskPosContext.cs similarity index 95% rename from ClientManager/BiskPosContext.cs rename to ServerManager/BiskPosContext.cs index c0dc102..8dcde20 100644 --- a/ClientManager/BiskPosContext.cs +++ b/ServerManager/BiskPosContext.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Biskilog_Cloud.Shared.Models; using Microsoft.EntityFrameworkCore; -namespace ClientManager; +namespace ServerManager; public partial class BiskPosContext : DbContext { @@ -79,11 +79,6 @@ public partial class BiskPosContext : DbContext public virtual DbSet TblUserActivities { get; set; } public virtual DbSet UnitOfMeasures { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) -#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. - => optionsBuilder.UseSqlServer("Server=BarhenVM\\SqlExpress;Database=BISK_POS;Integrated Security=True;TrustServerCertificate=true"); - protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => @@ -105,7 +100,7 @@ public partial class BiskPosContext : DbContext entity.Property(e => e.Date).HasColumnName("date"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Paid) .HasColumnType("decimal(19, 2)") .HasColumnName("paid"); @@ -149,7 +144,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("debit"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.TransactionId) .HasMaxLength(120) .HasColumnName("transactionID"); @@ -171,7 +166,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("branchID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(120) .IsUnicode(false) @@ -206,7 +201,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("branchID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Unit) .HasMaxLength(150) .IsUnicode(false) @@ -225,7 +220,7 @@ public partial class BiskPosContext : DbContext entity.Property(e => e.Cashier).HasColumnName("cashier"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Manager).HasColumnName("manager"); entity.Property(e => e.Owner).HasColumnName("owner"); entity.Property(e => e.Roles) @@ -247,7 +242,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("branchID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(50) .HasColumnName("pcode"); @@ -291,7 +286,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("city"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.StateOrProvince) .HasMaxLength(50) .IsUnicode(false) @@ -314,7 +309,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("brand"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); }); modelBuilder.Entity(entity => @@ -338,7 +333,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("dateCancelled"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Transno) .IsUnicode(false) .HasColumnName("transno"); @@ -373,7 +368,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("id"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Price) .HasColumnType("decimal(19, 2)") .HasColumnName("price"); @@ -415,7 +410,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("category"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); }); modelBuilder.Entity(entity => @@ -441,7 +436,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("email"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.MainTelephone) .HasMaxLength(50) .HasColumnName("main_telephone"); @@ -488,7 +483,7 @@ public partial class BiskPosContext : DbContext .IsUnicode(false); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.NameKey1) .HasMaxLength(120) .IsUnicode(false) @@ -531,7 +526,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("customerID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.TransactionId) .HasMaxLength(50) .HasColumnName("transactionID"); @@ -554,7 +549,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("deliveryID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(60) .HasColumnName("pcode"); @@ -563,6 +558,10 @@ public partial class BiskPosContext : DbContext .HasMaxLength(120) .IsUnicode(false) .HasColumnName("unit"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("branchID"); }); modelBuilder.Entity(entity => @@ -591,7 +590,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("generatedBy"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Status) .HasMaxLength(20) .IsUnicode(false) @@ -627,7 +626,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("fullname"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Telephone) .HasMaxLength(15) .IsUnicode(false) @@ -635,6 +634,10 @@ public partial class BiskPosContext : DbContext entity.Property(e => e.ToDate) .HasColumnType("date") .HasColumnName("toDate"); + entity.Property(e => e.BranchId) + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnName("branchID"); }); modelBuilder.Entity(entity => @@ -661,7 +664,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("discount"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.ReceiptId) .HasMaxLength(50) .HasColumnName("receiptID"); @@ -704,7 +707,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("firstname"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Middlename) .HasMaxLength(50) .IsUnicode(false) @@ -764,7 +767,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("invoiceID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Price) .HasColumnType("decimal(19, 2)") .HasColumnName("price"); @@ -803,7 +806,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("branchID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(50) .HasColumnName("pcode"); @@ -825,7 +828,7 @@ public partial class BiskPosContext : DbContext entity.Property(e => e.Date).HasColumnName("date"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(50) .HasColumnName("pcode"); @@ -855,7 +858,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("invoiceID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(50) .HasColumnName("pcode"); @@ -894,7 +897,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("current_price"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(120) .HasColumnName("pcode"); @@ -934,7 +937,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("costprice"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(50) .HasColumnName("pcode"); @@ -972,7 +975,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("driver"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.LicensePlate) .HasMaxLength(60) .HasColumnName("licensePlate"); @@ -997,7 +1000,7 @@ public partial class BiskPosContext : DbContext entity.Property(e => e.DateAssigned).HasColumnName("dateAssigned"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.OrderId) .HasMaxLength(50) .HasColumnName("orderID"); @@ -1025,7 +1028,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("driverID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Operation) .HasMaxLength(50) .IsUnicode(false) @@ -1046,7 +1049,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("countID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Pcode) .HasMaxLength(50) .HasColumnName("pcode"); @@ -1091,7 +1094,7 @@ public partial class BiskPosContext : DbContext entity.Property(e => e.LastLogin).HasColumnName("last_login"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Password) .IsUnicode(false) .HasColumnName("password"); @@ -1129,7 +1132,7 @@ public partial class BiskPosContext : DbContext entity.Property(e => e.LastActive).HasColumnName("last_active"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Workstation) .HasMaxLength(100) .HasColumnName("workstation"); @@ -1150,7 +1153,7 @@ public partial class BiskPosContext : DbContext .HasColumnName("branchID"); entity.Property(e => e.LastModified) .HasDefaultValueSql("(getdate())") - .HasColumnName("last_modified"); + .HasColumnName("lastmodified"); entity.Property(e => e.Status) .HasMaxLength(50) .IsUnicode(false) diff --git a/ServerManager/BiskilogContext.cs b/ServerManager/BiskilogContext.cs deleted file mode 100644 index 9e4a350..0000000 --- a/ServerManager/BiskilogContext.cs +++ /dev/null @@ -1,278 +0,0 @@ -using Biskilog_Cloud.Shared.ClientContractModels; -using Microsoft.EntityFrameworkCore; - -namespace ServerManager; -/// -/// This is the main EF DbContext for the Biskilog Accounting -/// -public partial class BiskilogContext : DbContext -{ - public BiskilogContext() - { - } - public BiskilogContext(DbContextOptions options) - : base(options) - { - } - - public virtual DbSet Authtypes { get; set; } - - public virtual DbSet Clientbusinesses { get; set; } - - public virtual DbSet Clientinfos { get; set; } - - public virtual DbSet Contracts { get; set; } - - public virtual DbSet Databasemaps { get; set; } - - public virtual DbSet Siteaccesspermissions { get; set; } - - public virtual DbSet Userauths { get; set; } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id).HasName("PRIMARY"); - - entity - .ToTable("authtypes") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.Id) - .HasColumnType("int(11)") - .HasColumnName("id"); - entity.Property(e => e.Type) - .HasMaxLength(50) - .HasColumnName("type") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.BusinessId, e.ClientId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); - - entity - .ToTable("clientbusiness") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.BusinessId) - .HasComment("there could be multiple branches of the same business") - .HasColumnType("int(11)") - .HasColumnName("businessId"); - entity.Property(e => e.ClientId) - .HasColumnType("int(11)") - .HasColumnName("clientID"); - entity.Property(e => e.BiskilogVersion) - .HasMaxLength(50) - .HasDefaultValueSql("''") - .HasColumnName("biskilog_version") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.BusinessName) - .HasMaxLength(50) - .HasDefaultValueSql("''") - .HasColumnName("business_name") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.DateJoined) - .HasDefaultValueSql("current_timestamp()") - .HasColumnType("datetime") - .HasColumnName("date_joined"); - entity.Property(e => e.BusinessExternalId) - .HasMaxLength(50) - .HasDefaultValueSql("''") - .HasColumnName("businessExternalId") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ClientId).HasName("PRIMARY"); - - entity - .ToTable("clientinfo") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.ClientId) - .HasColumnType("int(11)") - .HasColumnName("clientID"); - entity.Property(e => e.Email) - .HasMaxLength(200) - .HasColumnName("email") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Fullname) - .HasMaxLength(200) - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.PhoneNumber) - .HasMaxLength(200) - .HasColumnName("phoneNumber") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.ContractId).HasName("PRIMARY"); - - entity - .ToTable("contracts") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.HasIndex(e => new { e.ClientId, e.BusinessId }, "clientId_businessId").IsUnique(); - - entity.Property(e => e.ContractId) - .HasColumnType("int(11)") - .HasColumnName("contractId"); - entity.Property(e => e.Bill) - .HasPrecision(18, 2) - .HasColumnName("bill"); - entity.Property(e => e.BusinessId) - .HasColumnType("int(11)") - .HasColumnName("businessId"); - entity.Property(e => e.ClientId) - .HasColumnType("int(11)") - .HasColumnName("clientId"); - entity.Property(e => e.Comments) - .HasColumnType("text") - .HasColumnName("comments") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.EndDate) - .HasColumnType("datetime") - .HasColumnName("end_date"); - entity.Property(e => e.StartDate) - .HasColumnType("datetime") - .HasColumnName("start_date"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.DbNo).HasName("PRIMARY"); - - entity - .ToTable("databasemap") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.HasIndex(e => e.ClientId, "businessId").IsUnique(); - - entity.Property(e => e.DbNo) - .HasColumnType("int(11)") - .HasColumnName("db_no"); - entity.Property(e => e.ClientId) - .HasColumnType("int(11)") - .HasColumnName("clientID"); - entity.Property(e => e.DbName) - .HasMaxLength(50) - .HasDefaultValueSql("''") - .HasColumnName("db_name") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Domain) - .HasMaxLength(50) - .HasDefaultValueSql("''") - .HasColumnName("domain") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.LastSyncDate) - .HasColumnType("datetime") - .HasColumnName("last_sync_date"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => new { e.UserId, e.BusinessId, e.ClientId }) - .HasName("PRIMARY") - .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0, 0 }); - - entity - .ToTable("siteaccesspermission") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.Property(e => e.UserId) - .HasColumnType("int(11)") - .HasColumnName("userID"); - entity.Property(e => e.BusinessId) - .HasComment("businessIds could also been seen as branchID") - .HasColumnType("int(11)") - .HasColumnName("businessId"); - entity.Property(e => e.ClientId) - .HasColumnType("int(11)") - .HasColumnName("clientId"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.UserId).HasName("PRIMARY"); - - entity - .ToTable("userauth") - .HasCharSet("utf8") - .UseCollation("utf8_general_ci"); - - entity.HasIndex(e => e.AuthType, "authType"); - - entity.HasIndex(e => new { e.ClientId, e.Username, e.Email }, "clientId_username_email").IsUnique(); - - entity.Property(e => e.UserId) - .HasColumnType("int(11)") - .HasColumnName("userId"); - entity.Property(e => e.AuthType) - .HasColumnType("int(11)") - .HasColumnName("authType"); - entity.Property(e => e.ClientId) - .HasColumnType("int(11)") - .HasColumnName("clientId"); - entity.Property(e => e.Email) - .HasMaxLength(200) - .HasColumnName("email") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Isactive) - .HasColumnType("bit(1)") - .HasColumnName("isactive"); - entity.Property(e => e.Isowner) - .HasColumnType("bit(1)") - .HasColumnName("isowner"); - entity.Property(e => e.LastLogin) - .HasColumnType("datetime") - .HasColumnName("last_login"); - entity.Property(e => e.Passsword) - .HasMaxLength(200) - .HasColumnName("passsword") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.PhoneNumber) - .HasMaxLength(50) - .HasColumnName("phoneNumber") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - entity.Property(e => e.Username) - .HasMaxLength(30) - .HasColumnName("username") - .UseCollation("utf8mb4_general_ci") - .HasCharSet("utf8mb4"); - }); - - OnModelCreatingPartial(modelBuilder); - } - - partial void OnModelCreatingPartial(ModelBuilder modelBuilder); -} diff --git a/ServerManager/Hubs/SalesHub.cs b/ServerManager/Hubs/SalesHub.cs deleted file mode 100644 index 636bd47..0000000 --- a/ServerManager/Hubs/SalesHub.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.SignalR; -using ServerManager.Interface; - -namespace ServerManager.Hubs -{ - public class SalesHub : Hub - { - public override Task OnConnectedAsync() - { - Clients. - return base.OnConnectedAsync(); - } - public async Task Publish(string a_companyId) - { - await Clients.OthersInGroup(a_companyId).AddTransaction(); - } - } -} diff --git a/ServerManager/Interface/ISalesHub.cs b/ServerManager/Interface/ISalesHub.cs deleted file mode 100644 index 47f8910..0000000 --- a/ServerManager/Interface/ISalesHub.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ServerManager.Interface -{ - public interface ISalesHub - { - Task AddTransaction(); - } -} diff --git a/ServerManager/Program.cs b/ServerManager/Program.cs index 1e614fc..05fe14b 100644 --- a/ServerManager/Program.cs +++ b/ServerManager/Program.cs @@ -1,3 +1,9 @@ +using Biskilog_Cloud.Shared.Interfaces; +using Microsoft.EntityFrameworkCore; +using ServerManager; +using ServerManager.ServiceRepo; +using ServerManager.SyncMethods; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -6,7 +12,20 @@ builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); +builder.Services.AddEntityFrameworkMySql().AddDbContext(options => +{ + options.UseSqlServer(builder.Configuration.GetConnectionString("Connection")); +}); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddHostedService(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/ServerManager/ServerManager.csproj b/ServerManager/ServerManager.csproj index c991855..cacdde6 100644 --- a/ServerManager/ServerManager.csproj +++ b/ServerManager/ServerManager.csproj @@ -7,6 +7,7 @@ + diff --git a/ServerManager/ServiceRepo/CompanyService.cs b/ServerManager/ServiceRepo/CompanyService.cs new file mode 100644 index 0000000..11dfa26 --- /dev/null +++ b/ServerManager/ServiceRepo/CompanyService.cs @@ -0,0 +1,287 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.Interfaces; +using Biskilog_Cloud.Shared.Models; +using Dapper; +using Microsoft.Diagnostics.Tracing.Parsers.Kernel; +using Microsoft.EntityFrameworkCore; +using System; +using System.Data; +using System.Data.SqlClient; + +namespace ServerManager.ServiceRepo +{ + public class CompanyService : ICompanyInfo, ICustomer, IUser + { + private readonly BiskPosContext m_context; + public CompanyService(BiskPosContext a_context) + { + m_context = a_context; + } + + #region Unimplemented + public IEnumerable FetchUsers() + { + throw new NotImplementedException(); + } + + public Task> GetUsers() + { + throw new NotImplementedException(); + } + + public IEnumerable FetchCustomers() + { + throw new NotImplementedException(); + } + + public Task> GetCustomers() + { + throw new NotImplementedException(); + } + + public Task> GetBranches() + { + throw new NotImplementedException(); + } + + public string GetBranchName(string a_branchId) + { + throw new NotImplementedException(); + } + + public Task GetCompanyInfoAsync() + { + throw new NotImplementedException(); + } + + public string GetCompanyName() + { + throw new NotImplementedException(); + } + + public IEnumerable FetchBranches() + { + throw new NotImplementedException(); + } + #endregion + public async Task> FetchBranch(DateTime a_dateTime, string a_branch) + { + string connection = m_context.Database.GetConnectionString(); + using (IDbConnection dbConnection = new SqlConnection(connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblbranch", + a_branchId = a_branch, + lastModified = a_dateTime + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchCompanyInfoAsync(DateTime a_dateTime, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblcompanydetails", + a_branchId = a_branch, + lastModified = a_dateTime + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchDriverMappingAsync(DateTime a_syncDate, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tbltruck_drivermapping", + a_branchId = a_branch, + lastModified = a_syncDate + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchDriversAsync(DateTime a_syncDate, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tbldrivers", + a_branchId = a_branch, + lastModified = a_syncDate + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchSystemRoles(DateTime a_dateTime, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "systemuserroles", + a_branchId = a_branch, + lastModified = a_dateTime + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchTruckAsync(DateTime a_syncDate, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tbltruck", + a_branchId = a_branch, + lastModified = a_syncDate + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchTruckInventoryAsync(DateTime a_syncDate, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tbltruckinventory", + a_branchId = a_branch, + lastModified = a_syncDate + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchCustomers(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblcustomers", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchTruckAssignmentAsync(DateTime a_syncDate, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tbltruckassignments", + a_branchId = a_branch, + lastModified = a_syncDate + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + public async Task> FetchUsers(DateTime a_syncDate, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_context.Database.GetConnectionString())) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblusers", + a_branchId = a_branch, + lastModified = a_syncDate + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + } +} diff --git a/ServerManager/ServiceRepo/ProductsService.cs b/ServerManager/ServiceRepo/ProductsService.cs new file mode 100644 index 0000000..2b3d0ab --- /dev/null +++ b/ServerManager/ServiceRepo/ProductsService.cs @@ -0,0 +1,390 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.Interfaces; +using Biskilog_Cloud.Shared.Models; +using Dapper; +using Microsoft.EntityFrameworkCore; +using System.Data; +using System.Data.SqlClient; + +namespace ServerManager.ServiceRepo +{ + public class ProductsService : IProduct + { + private readonly BiskPosContext m_context; + private string m_connection; + public ProductsService(BiskPosContext a_context, IConfiguration configuration) + { + m_context = a_context; + m_connection = configuration.GetConnectionString("connection")!.ToString(); + } + + public event EventHandler ProductsChanged; + public event EventHandler UnitsChanged; + public event EventHandler BrandsChanged; + public event EventHandler CategoriesChanged; + + public async Task> FetchBrandsAsync(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "TblBrand", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchCategoriesAsync(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblcategory", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchInventory(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "TblInventory", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchInventoryEntries(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "TblInventoryentries", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchPriceChanges(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblpricechanges", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchProductAltUnit(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "productaltunit", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchProducts(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + branchID = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchProductTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchRestockAsync(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "Restocklevels", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchStockAsync(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "Tbstock", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + + public async Task> FetchUnitOfMeasureAsync(DateTime a_lastSync, string a_branch) + { + try + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "unitofmeasure", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + return new List(); + } + } + public Task FetchBrands() + { + throw new NotImplementedException(); + } + public Task FetchLowStockProducts() + { + throw new NotImplementedException(); + } + public Task FetchCategories() + { + throw new NotImplementedException(); + } + public Task FetchProducts() + { + throw new NotImplementedException(); + } + public Task FetchUnits() + { + throw new NotImplementedException(); + } + + public IEnumerable GetBrands(string a_brandKey = "") + { + throw new NotImplementedException(); + } + + public IEnumerable GetCategories(string a_categoryKey = "") + { + throw new NotImplementedException(); + } + + public IEnumerable GetLowstockItems() + { + throw new NotImplementedException(); + } + + public ProductItem GetProductById(string a_id) + { + throw new NotImplementedException(); + } + + public ProductItem GetProductByName(string name) + { + throw new NotImplementedException(); + } + + public IEnumerable GetProducts(string a_productKey = "") + { + throw new NotImplementedException(); + } + + public string GetUnitName(string a_unitCode) + { + throw new NotImplementedException(); + } + + public IEnumerable GetUnitofmeasures() + { + throw new NotImplementedException(); + } + + public void RefreshList() + { + throw new NotImplementedException(); + } + } +} diff --git a/ServerManager/ServiceRepo/SalesService.cs b/ServerManager/ServiceRepo/SalesService.cs new file mode 100644 index 0000000..f93a88d --- /dev/null +++ b/ServerManager/ServiceRepo/SalesService.cs @@ -0,0 +1,282 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.Interfaces; +using Biskilog_Cloud.Shared.Models; +using Dapper; +using Microsoft.EntityFrameworkCore; +using System.Data; +using System.Data.SqlClient; + +namespace ServerManager.ServiceRepo +{ + public class SalesService : ISalesInterface + { + private readonly BiskPosContext m_context; + private readonly string m_connection; + + public SalesService(BiskPosContext a_context, IConfiguration configuration) + { + m_context = a_context; + m_connection = configuration.GetConnectionString("connection")!.ToString(); + } + + public event EventHandler TransactionsChanged; + public event EventHandler FetchComplete; + public event EventHandler FetchStart; + + public async Task> FetchCancelledTransaction(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblcancelledtransaction", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + + } + + public async Task> FetchCartTbl(DateTime a_lastSync,string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblcart", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchCreditPurchase(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "CreditPurchases", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchCustomerAccount(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "customeraccounts", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchCustomerPurchase(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tblcustomerpurchases", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchDeliveryDetails(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "tbldeliverydetails", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchDeliveryHead(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "TblDeliveryHeads", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchDeliveryRecipients(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "TblDeliveryRecipients", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchDiscountLogs(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "TblDiscountLogs", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public async Task> FetchInvoice(DateTime a_lastSync, string a_branch) + { + using (IDbConnection dbConnection = new SqlConnection(m_connection)) + { + dbConnection.Open(); + + // Using Dapper to call a stored procedure with parameters + var parameters = new + { + a_tableName = "TblInvoices", + a_branchId = a_branch, + lastModified = a_lastSync + }; + List result = (await dbConnection.QueryAsync( + "FetchTableRows", + parameters, + commandType: CommandType.StoredProcedure)).AsList(); + + return result; + } + } + + public Task FetchReceipt(string a_receiptId) + { + throw new NotImplementedException(); + } + + public Task FetchRecentTransaction(int a_limit) + { + throw new NotImplementedException(); + } + + public Task FetchTransaction(DateTime a_start, DateTime a_end) + { + throw new NotImplementedException(); + } + + public IEnumerable GetReceipt(string a_receiptId) + { + throw new NotImplementedException(); + } + + public Task> GetReceiptDetail(string a_receiptId) + { + throw new NotImplementedException(); + } + + public IEnumerable GetRecentTransaction() + { + throw new NotImplementedException(); + } + + public IEnumerable GetTransactions(DateTime a_start, DateTime a_end) + { + throw new NotImplementedException(); + } + } +} diff --git a/ServerManager/SyncMethods/CompanySync.cs b/ServerManager/SyncMethods/CompanySync.cs new file mode 100644 index 0000000..a81c20e --- /dev/null +++ b/ServerManager/SyncMethods/CompanySync.cs @@ -0,0 +1,346 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.Interfaces; +using Biskilog_Cloud.Shared.Models; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace ServerManager.SyncMethods +{ + public class CompanySync + { + + private readonly ICompanyInfo m_companyService; + private readonly IUser m_userService; + private readonly ICustomer m_customerService; + private HttpClient m_httpClient; + public CompanySync(ICompanyInfo companyService, IUser userService, ICustomer customerService) + { + m_companyService = companyService; + m_userService = userService; + m_customerService = customerService; + m_httpClient = new HttpClient(); + } + /// + /// Returns a collection of tasks to perform a sync in the ICompanyInterface + /// + /// + public IEnumerable GetCompanySyncTask(HttpClient httpClient) + { + m_httpClient = httpClient; + return new Task[] { + SyncCompanyTable(), + SyncBranchTable(), + SyncCustomer(), + SyncDrivers(), + SyncTruckAssignments(), + SyncTruckDriverMappingSync(), + SyncTruckInventorySync(), + SyncUsersSync(), + SyncTruckSync(), + SyncSystemUserRoles() + }; + } + private async Task SyncCompanyTable() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tblcompanydetails"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchCompanyInfoAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp + { + TableName = "tblcompanydetails", + Timestamp = DateTime.Now.AddSeconds(-10), + }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tblcompanydetails", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncBranchTable() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tblbranch"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchBranch(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp + { + TableName = "tblbranch", + Timestamp = DateTime.Now.AddSeconds(-10), + }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tblbranch", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncCustomer() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tblCustomers"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_customerService.FetchCustomers(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp + { + TableName = "tblCustomers", + Timestamp = DateTime.Now.AddSeconds(-10), + }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tblCustomers", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncDrivers() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tbldrivers"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchDriversAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbldrivers", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tbldriver", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncSystemUserRoles() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/systemuserroles"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchSystemRoles(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "systemuserroles", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/SystemRoles", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncTruckAssignments() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tbltruckassignments"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchTruckAssignmentAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbltruckassignments", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tblTruckAssignment", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncTruckDriverMappingSync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tbltruck_drivermapping"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchDriverMappingAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbltruck_drivermapping", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tbldrivermappings", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncTruckInventorySync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tbltruckinventory"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchTruckInventoryAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbltruckinventory", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tbltruckinventory", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncTruckSync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tbltrucks"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_companyService.FetchTruckAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbltrucks", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tbltrucks", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + private async Task SyncUsersSync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncCompanyInfo/lastsyncdate/tblusers"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_userService.FetchUsers(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblusers", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/publish/tblusers", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncCompanyInfo/setsyncdate", syncTimestamp); + } + } +} \ No newline at end of file diff --git a/ServerManager/SyncMethods/ProductSync.cs b/ServerManager/SyncMethods/ProductSync.cs new file mode 100644 index 0000000..5275867 --- /dev/null +++ b/ServerManager/SyncMethods/ProductSync.cs @@ -0,0 +1,327 @@ +using Biskilog_Cloud.Shared.CustomModels; +using Biskilog_Cloud.Shared.Interfaces; +using Biskilog_Cloud.Shared.Models; +using System.Net.Http.Headers; + +namespace ServerManager.SyncMethods +{ + public class ProductSync + { + private readonly IProduct m_productService; + private HttpClient m_httpClient; + public ProductSync(IProduct a_produtService) + { + m_productService = a_produtService; + m_httpClient = new HttpClient(); + } + /// + /// Returns a collection of tasks to perform a sync in the SalesInterface + /// + /// + public IEnumerable GetProductSyncTask(HttpClient httpClient) + { + m_httpClient = httpClient; + return new Task[] { + SyncProductsAsync(), + SyncInventoryAsync(), + SyncInventoryEntriesAsync(), + SyncRestockAsync(), + SyncPriceChangesAsync(), + SyncProductAltUnitAsync(), + SyncStockAsync(), + SyncBrandsAsync(), + SyncCategoriesAsync(), + SyncUnitOfMeasureAsync(), + }; + } + private async Task SyncProductsAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tblproduct"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchProducts(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblproduct", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblproducts", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncInventoryAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tblInventory"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchInventory(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblInventory", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblInventory", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncInventoryEntriesAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tblInventoryentries"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchInventoryEntries(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblInventoryentries", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblInventoryentry", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncRestockAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/restocklevels"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchRestockAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "restocklevels", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblRestock", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncPriceChangesAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tblpricechanges"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchPriceChanges(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblpricechanges", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tlpricechanges", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncProductAltUnitAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/productaltunit"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchRestockAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "productaltunit", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblProductAltUnit", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncStockAsync() + {var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tbstock"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchStockAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbstock", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblStock", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncBrandsAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tblbrands"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchBrandsAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblbrands", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblbrands", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncCategoriesAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/tblcategory"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchCategoriesAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblcategory", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblCategories", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + private async Task SyncUnitOfMeasureAsync() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncProducts/lastsyncdate/unitofmeasure"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_productService.FetchUnitOfMeasureAsync(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "unitofmeasure", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncProducts/publish/tblunitofmeasure", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncProducts/setsyncdate", syncTimestamp); + } + } +} diff --git a/ServerManager/SyncMethods/SalesSync.cs b/ServerManager/SyncMethods/SalesSync.cs new file mode 100644 index 0000000..9cf8bd2 --- /dev/null +++ b/ServerManager/SyncMethods/SalesSync.cs @@ -0,0 +1,341 @@ +using System.Net.Http.Headers; +using Biskilog_Cloud.Shared.Interfaces; +using Biskilog_Cloud.Shared.Models; +using Biskilog_Cloud.Shared.CustomModels; + +namespace ServerManager.SyncMethods +{ + public class SalesSync + { + private readonly ISalesInterface m_salesService; + private HttpClient m_httpClient; + + public SalesSync(ISalesInterface a_salesService) + { + m_salesService = a_salesService; + m_httpClient = new HttpClient(); + } + /// + /// Returns a collection of tasks to perform a sync in the SalesInterface + /// + /// + public IEnumerable GetSalesSyncTask(HttpClient httpClient) + { + m_httpClient = httpClient; + return new Task[] { + SyncCartTable(), + SyncInvoice(), + SyncDiscountLogs(), + SyncCancelledTransactionTable(), + SyncDeliveryRecipient(), + SyncCreditPurchase(), + SyncCustomerAccounts(), + SyncCustomerPurchases(), + SyncDeliveryDetails(), + SynctblDeliveryhead(), + }; + } + private async Task SyncCartTable() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tblcart"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchCartTbl(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp + { + TableName = "TblCart", + Timestamp = DateTime.Now.AddSeconds(-10), + }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblCart", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncCancelledTransactionTable() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tblcancelledtransactions"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchCancelledTransaction(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp + { + TableName = "tblcancelledtransactions", + Timestamp = DateTime.Now.AddSeconds(-10), + }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblcancelledtransaction", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncCreditPurchase() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/CreditPurchases"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchCreditPurchase(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp + { + TableName = "CreditPurchases", + Timestamp = DateTime.Now.AddSeconds(-10), + }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblCreditpurchase", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncCustomerAccounts() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/customeraccounts"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchCustomerAccount(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "customeraccounts", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblCustomerAccount", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncCustomerPurchases() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tblcustomerpurchases"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchCustomerPurchase(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblcustomerpurchases", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/CustomerPurchase", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncDiscountLogs() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tbldiscountlogs"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchDiscountLogs(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbldiscountlogs", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/DiscountLogs", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncDeliveryDetails() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tblDeliverydetails"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchDeliveryDetails(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbldeliverydetails", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblDeliverydetails", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SynctblDeliveryhead() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tblDeliveryhead"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchDeliveryHead(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbldeliveryhead", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblDeliveryhead", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncDeliveryRecipient() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tblDeliveryrecipients"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchDeliveryRecipients(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tbldeliveryrecipients", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblDeliveryrecipient", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + private async Task SyncInvoice() + { + var responseMessage = await m_httpClient.GetAsync("/api/SyncSales/lastsyncdate/tblinvoice"); + if (!responseMessage.IsSuccessStatusCode) + { + return; + } + + DateTime date = await responseMessage.Content.ReadFromJsonAsync(); + IEnumerable modifiedCart = await m_salesService.FetchInvoice(date, "BRID0"); + SyncTimestamp syncTimestamp = new SyncTimestamp { TableName = "tblinvoice", Timestamp = DateTime.Now.AddSeconds(-10) }; + int batchSize = 200; + int totalItems = modifiedCart.Count(); + int batches = (totalItems + batchSize - 1) / batchSize; // Calculate total batches + + for (int batchIndex = 0; batchIndex < batches; batchIndex++) + { + List batch = modifiedCart.Skip(batchIndex * batchSize).Take(batchSize).ToList(); + + var response = await m_httpClient.PostAsJsonAsync("/api/SyncSales/publish/tblinvoice", batch); + if (response.IsSuccessStatusCode) + { + Console.WriteLine($"Sent batch {batchIndex + 1}, Count: {batch.Count}"); + } + } + + //Set last sync date + await m_httpClient.PostAsJsonAsync("/api/SyncSales/setsyncdate", syncTimestamp); + } + } +} diff --git a/ServerManager/Worker.cs b/ServerManager/Worker.cs index 5f28270..efedd9f 100644 --- a/ServerManager/Worker.cs +++ b/ServerManager/Worker.cs @@ -1 +1,57 @@ - \ No newline at end of file +using ServerManager.SyncMethods; +using System.Net.Http.Headers; + +namespace ServerManager +{ + public class Worker : BackgroundService + { + private readonly ILogger _logger; + private readonly IServiceProvider _serviceProvider; + private readonly IConfiguration m_configuration; + private HttpClient m_httpClient; + + public Worker(ILogger logger, IServiceProvider serviceProvider, IConfiguration configuration) + { + _logger = logger; + _serviceProvider = serviceProvider; + m_configuration = configuration; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + try + { + string baseurl = m_configuration.GetValue("BaseUrl", "")!; + HttpClient httpClient = new HttpClient(); + httpClient.BaseAddress = new Uri(baseurl); + string token = m_configuration.GetValue("Token", "")!; + var authHeader = new AuthenticationHeaderValue("Bearer", token); + httpClient.DefaultRequestHeaders.Authorization = authHeader; + + using var scope = _serviceProvider.CreateScope(); + var salesSync = scope.ServiceProvider.GetRequiredService(); + var productSync = scope.ServiceProvider.GetRequiredService(); + var companySync = scope.ServiceProvider.GetRequiredService(); + + while (!stoppingToken.IsCancellationRequested) + { + _logger.LogInformation("Worker running at: {time} ", DateTimeOffset.Now); + + List runTask = new List(); + runTask.AddRange(salesSync.GetSalesSyncTask(httpClient)); + runTask.AddRange(productSync.GetProductSyncTask(httpClient)); + runTask.AddRange(companySync.GetCompanySyncTask(httpClient)); + + // Wait for all tasks to complete + await Task.WhenAll(runTask); + + await Task.Delay(1000, stoppingToken); + } + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } + } + } +} diff --git a/ServerManager/appsettings.json b/ServerManager/appsettings.json index 984fb06..d491365 100644 --- a/ServerManager/appsettings.json +++ b/ServerManager/appsettings.json @@ -6,9 +6,10 @@ } }, "ConnectionStrings": { - "Connection": "server=54.37.19.162;database=dev_biskilogclients;user=biskilog;password=mefbuk-6niFsu-fytrew", - "PrivateConnection": "server={0};database={1};user=biskilog;password=mefbuk-6niFsu-fytrew;default command timeout=0;" + "Connection": "Server=BarhenVM\\SqlExpress;Database=BISK_POS;Integrated Security=True;TrustServerCertificate=true" }, + "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMWM3MWE0Ni0xZmY2LTRkMGMtYmYzMS1iMTExMzJlMGM5ODQiLCJpYXQiOiIxNC8wOC8yMDIzIDY6MjI6MzIgcG0iLCJDb250cmFjdFN0YXJ0IjoiMTgvMDUvMjAyMyA4OjQ3OjI3IHBtIiwiQ29udHJhY3RFbmQiOiIxOC8wNS8yMDI0IDg6NDc6MjkgcG0iLCJVc2VySWQiOiIxIiwiVXNlcm5hbWUiOiJ0ZXN0IiwiRGJJZCI6IjEiLCJDb21wYXJpc29uTW9kZSI6IkZhbHNlIiwiQnJhbmNoSWQiOiJCUklEMCIsIkJyYW5jaEFjY2VzcyI6IkJSSUQwIiwiQ2xpZW50SWQiOiIxIiwiZXhwIjoxNjkzMjQ2OTUyLCJpc3MiOiJBVVRIIFNFUlZFUiIsImF1ZCI6IkJJU0tJTE9HIn0.W3kxw5kEj13TDSs96doR20IW96k3aO8uR5SKGiSaSX4", + "BaseUrl": "https://localhost:7247/", "AllowedHosts": "*", "JWT": { "Key": "@@BISKILOGACCOUNTING2023DEV??//##$", diff --git a/Shared/CustomModels/CancelledSales.cs b/Shared/CustomModels/CancelledSales.cs index 77a2148..cc4f38b 100644 --- a/Shared/CustomModels/CancelledSales.cs +++ b/Shared/CustomModels/CancelledSales.cs @@ -1,4 +1,4 @@ -using Biskilog_Cloud.Shared.POSModels; +using Biskilog_Cloud.Shared.Models; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +9,7 @@ namespace Biskilog_Cloud.Shared.CustomModels { public class CancelledSales { - public Tblcancelledtransaction? CancelledTransaction { get; set; } + public TblCancelledTransaction? CancelledTransaction { get; set; } public string Customer { get; set; } = "WALK-IN Purchase"; public decimal? Value { get; set; } } diff --git a/Shared/CustomModels/CustomerAccounts.cs b/Shared/CustomModels/CustomerAccounts.cs index a55e838..d67e76c 100644 --- a/Shared/CustomModels/CustomerAccounts.cs +++ b/Shared/CustomModels/CustomerAccounts.cs @@ -1,4 +1,4 @@ -using Biskilog_Cloud.Shared.POSModels; +using Biskilog_Cloud.Shared.Models; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +9,7 @@ namespace Biskilog_Cloud.Shared.CustomModels { public class CustomerAccounts { - public Tblcustomer Customer { get; set; } + public TblCustomer Customer { get; set; } public decimal Debt { get; set; } = 0; } } diff --git a/Shared/CustomModels/ProductItem.cs b/Shared/CustomModels/ProductItem.cs index 07fad59..0ecdd35 100644 --- a/Shared/CustomModels/ProductItem.cs +++ b/Shared/CustomModels/ProductItem.cs @@ -1,4 +1,4 @@ -using Biskilog_Cloud.Shared.POSModels; +using Biskilog_Cloud.Shared.Models; using System; using System.Collections.Generic; using System.Linq; @@ -9,9 +9,9 @@ namespace Biskilog_Cloud.Shared.CustomModels { public class ProductItem { - public Tblproduct? Product { get; set; } - public Tblinventory? Stock { get; set; } - public Restocklevel? Restocklevel { get; set; } + public TblProduct? Product { get; set; } + public TblInventory? Stock { get; set; } + public RestockLevel? Restocklevel { get; set; } public List Units { get; set; } = new List(); public string BaseUnit { get; set; } = string.Empty; } diff --git a/Shared/CustomModels/SyncTimestamp.cs b/Shared/CustomModels/SyncTimestamp.cs new file mode 100644 index 0000000..d20fd21 --- /dev/null +++ b/Shared/CustomModels/SyncTimestamp.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Biskilog_Cloud.Shared.CustomModels +{ + public class SyncTimestamp + { + public string TableName { get; set; } + public DateTime Timestamp { get; set; } + } +} diff --git a/Shared/Interfaces/IAnalytics.cs b/Shared/Interfaces/IAnalytics.cs index 9b136ea..44dca09 100644 --- a/Shared/Interfaces/IAnalytics.cs +++ b/Shared/Interfaces/IAnalytics.cs @@ -1,5 +1,5 @@ using Biskilog_Cloud.Shared.CustomModels; -using Biskilog_Cloud.Shared.POSModels; +using Biskilog_Cloud.Shared.Models; namespace Biskilog_Cloud.Shared.Interfaces { @@ -11,7 +11,7 @@ namespace Biskilog_Cloud.Shared.Interfaces /// Specified Start Date /// Specified end Date /// - IEnumerable GetSalesTransaction(DateTime a_start, DateTime a_end); + IEnumerable GetSalesTransaction(DateTime a_start, DateTime a_end); /// /// Fetches a collection of sales transaction made within a one week period /// diff --git a/Shared/Interfaces/ICompanyInfo.cs b/Shared/Interfaces/ICompanyInfo.cs index 124a28f..2626e27 100644 --- a/Shared/Interfaces/ICompanyInfo.cs +++ b/Shared/Interfaces/ICompanyInfo.cs @@ -1,4 +1,4 @@ -using Biskilog_Cloud.Shared.POSModels; +using Biskilog_Cloud.Shared.Models; using System; using System.Collections.Generic; using System.Linq; @@ -9,10 +9,18 @@ namespace Biskilog_Cloud.Shared.Interfaces { public interface ICompanyInfo { - IEnumerable FetchBranches(); - Task GetCompanyInfoAsync(); - Task> GetBranches(); + IEnumerable FetchBranches(); + Task GetCompanyInfoAsync(); + Task> GetBranches(); string GetCompanyName(); string GetBranchName(string a_branchId); + Task> FetchBranch(DateTime a_dateTime, string a_branch); + Task> FetchSystemRoles(DateTime a_dateTime, string a_branch); + Task> FetchCompanyInfoAsync(DateTime a_dateTime, string a_branch); + Task> FetchDriversAsync(DateTime a_syncDate, string a_branchId); + Task> FetchDriverMappingAsync(DateTime a_syncDate, string a_branchId); + Task> FetchTruckAsync(DateTime a_syncDate, string a_branchId); + Task> FetchTruckInventoryAsync(DateTime a_syncDate, string a_branchId); + Task> FetchTruckAssignmentAsync(DateTime a_syncDate, string a_branchId); } } diff --git a/Shared/Interfaces/ICustomer.cs b/Shared/Interfaces/ICustomer.cs index e0870e3..863a9c3 100644 --- a/Shared/Interfaces/ICustomer.cs +++ b/Shared/Interfaces/ICustomer.cs @@ -1,5 +1,5 @@ using Biskilog_Cloud.Shared.CustomModels; -using Biskilog_Cloud.Shared.POSModels; +using Biskilog_Cloud.Shared.Models; namespace Biskilog_Cloud.Shared.Interfaces { @@ -7,5 +7,6 @@ namespace Biskilog_Cloud.Shared.Interfaces { IEnumerable FetchCustomers(); Task> GetCustomers(); + Task> FetchCustomers(DateTime a_lastSync, string a_branchId); } } diff --git a/Shared/Interfaces/IProducts.cs b/Shared/Interfaces/IProducts.cs index 3607168..5e73736 100644 --- a/Shared/Interfaces/IProducts.cs +++ b/Shared/Interfaces/IProducts.cs @@ -1,19 +1,14 @@ using Biskilog_Cloud.Shared.CustomModels; -using Biskilog_Cloud.Shared.POSModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Biskilog_Cloud.Shared.Models; namespace Biskilog_Cloud.Shared.Interfaces { public interface IProduct { - IEnumerable GetUnitofmeasures(); + IEnumerable GetUnitofmeasures(); IEnumerable GetProducts(string a_productKey = ""); - IEnumerable GetBrands(string a_brandKey = ""); - IEnumerable GetCategories(string a_categoryKey = ""); + IEnumerable GetBrands(string a_brandKey = ""); + IEnumerable GetCategories(string a_categoryKey = ""); IEnumerable GetLowstockItems(); Task FetchProducts(); Task FetchLowStockProducts(); @@ -28,5 +23,16 @@ namespace Biskilog_Cloud.Shared.Interfaces event EventHandler UnitsChanged; event EventHandler BrandsChanged; event EventHandler CategoriesChanged; + + Task> FetchProducts(DateTime a_lastSync, string a_branch); + Task> FetchInventory(DateTime a_lastSync, string a_branch); + Task> FetchInventoryEntries(DateTime a_lastSync, string a_branch); + Task> FetchPriceChanges(DateTime a_lastSync, string a_branch); + Task> FetchProductAltUnit(DateTime a_lastSync, string a_branch); + Task> FetchRestockAsync(DateTime a_lastSync, string a_branch); + Task> FetchUnitOfMeasureAsync(DateTime a_lastSync, string a_branch); + Task> FetchStockAsync(DateTime a_lastSync, string a_branch); + Task> FetchBrandsAsync(DateTime a_lastSync, string a_branch); + Task> FetchCategoriesAsync(DateTime a_lastSync, string a_branch); } } diff --git a/Shared/Interfaces/ISalesInterface.cs b/Shared/Interfaces/ISalesInterface.cs index 17e7d9b..e85a255 100644 --- a/Shared/Interfaces/ISalesInterface.cs +++ b/Shared/Interfaces/ISalesInterface.cs @@ -1,5 +1,5 @@ using Biskilog_Cloud.Shared.CustomModels; -using Biskilog_Cloud.Shared.POSModels; +using Biskilog_Cloud.Shared.Models; using System; using System.Collections.Generic; using System.Linq; @@ -16,9 +16,20 @@ namespace Biskilog_Cloud.Shared.Interfaces IEnumerable GetRecentTransaction(); Task FetchReceipt(string a_receiptId); IEnumerable GetReceipt(string a_receiptId); - Task> GetReceiptDetail(string a_receiptId); + Task> GetReceiptDetail(string a_receiptId); event EventHandler TransactionsChanged; event EventHandler FetchComplete; event EventHandler FetchStart; + + Task> FetchCartTbl(DateTime a_lastSync, string a_branch); + Task> FetchCancelledTransaction(DateTime a_lastSync, string a_branch); + Task> FetchCreditPurchase(DateTime a_lastSync, string a_branch); + Task> FetchCustomerAccount(DateTime a_lastSync, string a_branch); + Task> FetchCustomerPurchase(DateTime a_lastSync, string a_branch); + Task> FetchDiscountLogs(DateTime a_lastSync, string a_branch); + Task> FetchDeliveryDetails(DateTime a_lastSync, string a_branch); + Task> FetchDeliveryHead(DateTime a_lastSync, string a_branch); + Task> FetchDeliveryRecipients(DateTime a_lastSync, string a_branch); + Task> FetchInvoice(DateTime a_lastSync, string a_branch); } } diff --git a/Shared/Interfaces/IUser.cs b/Shared/Interfaces/IUser.cs index d260b21..a42e1b0 100644 --- a/Shared/Interfaces/IUser.cs +++ b/Shared/Interfaces/IUser.cs @@ -1,15 +1,12 @@ -using Biskilog_Cloud.Shared.POSModels; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + +using Biskilog_Cloud.Shared.Models; namespace Biskilog_Cloud.Shared.Interfaces { public interface IUser { - IEnumerable FetchUsers(); - Task> GetUsers(); + IEnumerable FetchUsers(); + Task> GetUsers(); + Task> FetchUsers(DateTime a_syncDate, string a_branchId); } } diff --git a/Shared/Models/TbStock.cs b/Shared/Models/TbStock.cs index 951a3a9..77afff4 100644 --- a/Shared/Models/TbStock.cs +++ b/Shared/Models/TbStock.cs @@ -21,3 +21,4 @@ public partial class TbStock public DateTime LastModified { get; set; } } +; \ No newline at end of file diff --git a/Shared/Models/TblCustomer.cs b/Shared/Models/TblCustomer.cs index b32102b..214b342 100644 --- a/Shared/Models/TblCustomer.cs +++ b/Shared/Models/TblCustomer.cs @@ -23,7 +23,7 @@ public partial class TblCustomer public string? Tin { get; set; } - public DateTime? DateExit { get; set; } + public DateTime? DateExit { get; set; } = new DateTime(2000, 01, 01); public string? Email { get; set; } diff --git a/Shared/Models/TblDeliveryDetail.cs b/Shared/Models/TblDeliveryDetail.cs index 8b970d9..07195ab 100644 --- a/Shared/Models/TblDeliveryDetail.cs +++ b/Shared/Models/TblDeliveryDetail.cs @@ -18,4 +18,5 @@ public partial class TblDeliveryDetail public string CountId { get; set; } = null!; public DateTime LastModified { get; set; } + public string? BranchId { get; set; } } diff --git a/Shared/Models/TblDeliveryRecipient.cs b/Shared/Models/TblDeliveryRecipient.cs index 5423865..df9fe37 100644 --- a/Shared/Models/TblDeliveryRecipient.cs +++ b/Shared/Models/TblDeliveryRecipient.cs @@ -22,4 +22,5 @@ public partial class TblDeliveryRecipient public DateTime? ToDate { get; set; } public DateTime LastModified { get; set; } + public string? BranchId { get; set; } } diff --git a/Shared/Models/TblInventory.cs b/Shared/Models/TblInventory.cs index 2554742..f0fabe2 100644 --- a/Shared/Models/TblInventory.cs +++ b/Shared/Models/TblInventory.cs @@ -7,7 +7,7 @@ public partial class TblInventory { public string? Pcode { get; set; } - public int? Quantity { get; set; } + public int? Quantity { get; set; } = 0; public string? BranchId { get; set; } diff --git a/Shared/Models/TblInventoryEntry.cs b/Shared/Models/TblInventoryEntry.cs index be8fe82..a5377aa 100644 --- a/Shared/Models/TblInventoryEntry.cs +++ b/Shared/Models/TblInventoryEntry.cs @@ -7,7 +7,7 @@ public partial class TblInventoryEntry { public string? Pcode { get; set; } - public int? Quantity { get; set; } + public int? Quantity { get; set; } = 0; public DateTime? Date { get; set; } diff --git a/Shared/Models/TblInvoice.cs b/Shared/Models/TblInvoice.cs index faea52e..677ff7e 100644 --- a/Shared/Models/TblInvoice.cs +++ b/Shared/Models/TblInvoice.cs @@ -9,13 +9,13 @@ public partial class TblInvoice public string? Pcode { get; set; } - public int? Quantity { get; set; } + public int? Quantity { get; set; } = 0; - public decimal? Unitprice { get; set; } + public decimal? Unitprice { get; set; } = 0; public string? Unit { get; set; } - public decimal? Totalprice { get; set; } + public decimal? Totalprice { get; set; } = 0; public DateTime? DateGenerated { get; set; } diff --git a/Shared/Models/TblPriceChange.cs b/Shared/Models/TblPriceChange.cs index 0ebda54..febb885 100644 --- a/Shared/Models/TblPriceChange.cs +++ b/Shared/Models/TblPriceChange.cs @@ -7,11 +7,11 @@ public partial class TblPriceChange { public string? Pcode { get; set; } - public decimal? PreviousPrice { get; set; } + public decimal? PreviousPrice { get; set; } = 0; - public decimal? CurrentPrice { get; set; } + public decimal? CurrentPrice { get; set; } = 0; - public DateTime? ChangeDate { get; set; } + public DateTime? ChangeDate { get; set; } = new DateTime(2000,01,01); public string? BranchId { get; set; } diff --git a/Shared/Models/TblProduct.cs b/Shared/Models/TblProduct.cs index d1a1536..691c8fa 100644 --- a/Shared/Models/TblProduct.cs +++ b/Shared/Models/TblProduct.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; namespace Biskilog_Cloud.Shared.Models; @@ -15,12 +16,11 @@ public partial class TblProduct public string? Cid { get; set; } - public decimal? Price { get; set; } + public decimal? Price { get; set; } = 0; - public decimal? Costprice { get; set; } + public decimal? Costprice { get; set; } = 0; public string? BaseUnit { get; set; } - public string? ProductName { get; set; } public string? BranchId { get; set; } diff --git a/Shared/Models/TblUser.cs b/Shared/Models/TblUser.cs index 01968f9..4249de9 100644 --- a/Shared/Models/TblUser.cs +++ b/Shared/Models/TblUser.cs @@ -7,29 +7,29 @@ public partial class TblUser { public string Username { get; set; } = null!; - public string? Password { get; set; } + public string? Password { get; set; } = string.Empty; - public string? Firstname { get; set; } + public string? Firstname { get; set; } = string.Empty; - public string? Surname { get; set; } + public string? Surname { get; set; } = string.Empty; - public string? StreetAddress1 { get; set; } + public string? StreetAddress1 { get; set; } = string.Empty; - public string? StreetAddress2 { get; set; } + public string? StreetAddress2 { get; set; } = string.Empty; - public string? City { get; set; } + public string? City { get; set; } = string.Empty; - public string? StateOrProvince { get; set; } + public string? StateOrProvince { get; set; } = string.Empty; - public string? Telephone { get; set; } + public string? Telephone { get; set; } = string.Empty; - public string? Email { get; set; } + public string? Email { get; set; } = string.Empty; - public string? AccessLevel { get; set; } + public string? AccessLevel { get; set; } = string.Empty; - public DateTime? LastLogin { get; set; } + public DateTime? LastLogin { get; set; } = new DateTime(2000, 01, 01); - public string? BranchId { get; set; } + public string? BranchId { get; set; } = string.Empty; public DateTime LastModified { get; set; } } diff --git a/Shared/POSModels/Creditpurchase.cs b/Shared/POSModels/Creditpurchase.cs deleted file mode 100644 index 5b1672c..0000000 --- a/Shared/POSModels/Creditpurchase.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Creditpurchase -{ - public string ReceiptId { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public DateTime Date { get; set; } - - public decimal TotalBill { get; set; } - - public decimal Paid { get; set; } - - public string CustomerId { get; set; } = null!; - - public string Status { get; set; } = null!; -} diff --git a/Shared/POSModels/Customeraccount.cs b/Shared/POSModels/Customeraccount.cs deleted file mode 100644 index d406e51..0000000 --- a/Shared/POSModels/Customeraccount.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Customeraccount -{ - public string CustomerId { get; set; } = null!; - - public string TransactionId { get; set; } = null!; - - public DateTime Date { get; set; } - - public decimal Debit { get; set; } - - public decimal Credit { get; set; } - - public decimal Balance { get; set; } - - public string Comments { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Productaltunit.cs b/Shared/POSModels/Productaltunit.cs deleted file mode 100644 index 0159f30..0000000 --- a/Shared/POSModels/Productaltunit.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Productaltunit -{ - public string? Pcode { get; set; } - - public string? UnitCode { get; set; } - - public string? UnitBarcode { get; set; } - - public decimal? PriceUnit { get; set; } - - public int? QuantityUnit { get; set; } - - public string DistinctiveCode { get; set; } = null!; - - public string BranchId { get; set; } = null!; -} diff --git a/Shared/POSModels/Restocklevel.cs b/Shared/POSModels/Restocklevel.cs deleted file mode 100644 index 54afc49..0000000 --- a/Shared/POSModels/Restocklevel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Restocklevel -{ - public string ProductId { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public int? WarnLevel { get; set; } - - public string? Unit { get; set; } -} diff --git a/Shared/POSModels/Systemuserrole.cs b/Shared/POSModels/Systemuserrole.cs deleted file mode 100644 index 1137a29..0000000 --- a/Shared/POSModels/Systemuserrole.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Systemuserrole -{ - public string? Roles { get; set; } - - public sbyte? Owner { get; set; } - - public sbyte? Manager { get; set; } - - public sbyte? Assist { get; set; } - - public sbyte? Cashier { get; set; } - - public int Id { get; set; } -} diff --git a/Shared/POSModels/Tblbranch.cs b/Shared/POSModels/Tblbranch.cs deleted file mode 100644 index 5094f91..0000000 --- a/Shared/POSModels/Tblbranch.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblbranch -{ - public string? BranchName { get; set; } - - public string BranchId { get; set; } = null!; - - public string? Address { get; set; } - - public string? City { get; set; } - - public string? StateOrProvince { get; set; } - - public string? BranchTelephone { get; set; } -} diff --git a/Shared/POSModels/Tblbrand.cs b/Shared/POSModels/Tblbrand.cs deleted file mode 100644 index cde00f6..0000000 --- a/Shared/POSModels/Tblbrand.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblbrand -{ - public string Id { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? Brand { get; set; } -} diff --git a/Shared/POSModels/Tblcancelledtransaction.cs b/Shared/POSModels/Tblcancelledtransaction.cs deleted file mode 100644 index a017f57..0000000 --- a/Shared/POSModels/Tblcancelledtransaction.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblcancelledtransaction -{ - public string? Transno { get; set; } - - public DateTime? DateCancelled { get; set; } - - public string? CancelledBy { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tblcart.cs b/Shared/POSModels/Tblcart.cs deleted file mode 100644 index aab15c6..0000000 --- a/Shared/POSModels/Tblcart.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblcart -{ - public string? Transno { get; set; } - - public string? Id { get; set; } - - public int? Quantity { get; set; } - - public DateTime? Date { get; set; } - - public decimal? Price { get; set; } - - public string? Cashier { get; set; } - - public string? Status { get; set; } - - public decimal? Total { get; set; } - - public string? Unit { get; set; } - public decimal? Tendered { get; set; } - public decimal? Balance { get; set; } - public decimal? ValueAddTax { get; set; } - public decimal? Discount { get; set; } = 0; - - public decimal? Costprice { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tblcategory.cs b/Shared/POSModels/Tblcategory.cs deleted file mode 100644 index bdd04b1..0000000 --- a/Shared/POSModels/Tblcategory.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblcategory -{ - public string Id { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? Category { get; set; } -} diff --git a/Shared/POSModels/Tblcompanydetail.cs b/Shared/POSModels/Tblcompanydetail.cs deleted file mode 100644 index ed8322c..0000000 --- a/Shared/POSModels/Tblcompanydetail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblcompanydetail -{ - public string? CompanyName { get; set; } - - public string? Address { get; set; } - - public string? Website { get; set; } - - public string? Email { get; set; } - - public string Tin { get; set; } = null!; - - public string? MainTelephone { get; set; } - - public string? Vatno { get; set; } -} diff --git a/Shared/POSModels/Tblcustomer.cs b/Shared/POSModels/Tblcustomer.cs deleted file mode 100644 index fa2a220..0000000 --- a/Shared/POSModels/Tblcustomer.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblcustomer -{ - public string CustomerId { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? Firstname { get; set; } - - public string? Surname { get; set; } - - public string? Address { get; set; } - - public string? Telephone { get; set; } - - public DateTime? DateAdded { get; set; } - - public string? Status { get; set; } - - public string? Tin { get; set; } - - public DateTime? DateExit { get; set; } - - public string? Email { get; set; } - - public string? FinancialStatus { get; set; } - - public string? NameKey1 { get; set; } - - public string? NameKey2 { get; set; } -} diff --git a/Shared/POSModels/Tblcustomerpurchase.cs b/Shared/POSModels/Tblcustomerpurchase.cs deleted file mode 100644 index fa8896e..0000000 --- a/Shared/POSModels/Tblcustomerpurchase.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblcustomerpurchase -{ - public string? CustomerId { get; set; } - - public string? TransactionId { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tbldeliverydetail.cs b/Shared/POSModels/Tbldeliverydetail.cs deleted file mode 100644 index cab0c0c..0000000 --- a/Shared/POSModels/Tbldeliverydetail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbldeliverydetail -{ - public string? DeliveryId { get; set; } - - public string? Pcode { get; set; } - - public int? Quantity { get; set; } - - public string? Unit { get; set; } - - public decimal? Cost { get; set; } - - public string CountId { get; set; } = null!; - - public string BranchId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tbldeliveryhead.cs b/Shared/POSModels/Tbldeliveryhead.cs deleted file mode 100644 index 32bf7a8..0000000 --- a/Shared/POSModels/Tbldeliveryhead.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbldeliveryhead -{ - public string DeliveryId { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? GeneratedBy { get; set; } - - public DateTime? DateInitiated { get; set; } - - public DateTime? DateCompleted { get; set; } - - public string? Destination { get; set; } - - public string? CustomerId { get; set; } - - public decimal? TotalCost { get; set; } - - public string? Status { get; set; } -} diff --git a/Shared/POSModels/Tbldeliveryrecipient.cs b/Shared/POSModels/Tbldeliveryrecipient.cs deleted file mode 100644 index 0316678..0000000 --- a/Shared/POSModels/Tbldeliveryrecipient.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbldeliveryrecipient -{ - public string DeliveryId { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? Fullname { get; set; } - - public string? Address { get; set; } - - public string? Telephone { get; set; } - - public string? Email { get; set; } - - public string? CustomerId { get; set; } - - public DateOnly? FromDate { get; set; } - - public DateOnly? ToDate { get; set; } -} diff --git a/Shared/POSModels/Tbldiscountlog.cs b/Shared/POSModels/Tbldiscountlog.cs deleted file mode 100644 index ef04d2a..0000000 --- a/Shared/POSModels/Tbldiscountlog.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbldiscountlog -{ - public string? ReceiptId { get; set; } - - public string? Cashier { get; set; } - - public DateTime? Date { get; set; } - - public decimal? Discount { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tbldriver.cs b/Shared/POSModels/Tbldriver.cs deleted file mode 100644 index 90f5397..0000000 --- a/Shared/POSModels/Tbldriver.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbldriver -{ - public string DriverId { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? Firstname { get; set; } - - public string? Surname { get; set; } - - public string? Middlename { get; set; } - - public DateOnly? DateOfBirth { get; set; } - - public string? Address1 { get; set; } - - public string? Address2 { get; set; } - - public string? Telephone { get; set; } - - public string? Email { get; set; } - - public string? City { get; set; } - - public string? State { get; set; } - - public string? Status { get; set; } -} diff --git a/Shared/POSModels/Tblinventory.cs b/Shared/POSModels/Tblinventory.cs deleted file mode 100644 index 7805dd7..0000000 --- a/Shared/POSModels/Tblinventory.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblinventory -{ - public string? Pcode { get; set; } - - public int? Quantity { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tblinventoryentry.cs b/Shared/POSModels/Tblinventoryentry.cs deleted file mode 100644 index d9cebf8..0000000 --- a/Shared/POSModels/Tblinventoryentry.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblinventoryentry -{ - public string? Pcode { get; set; } - - public int? Quantity { get; set; } - - public DateTime? Date { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tblinvoice.cs b/Shared/POSModels/Tblinvoice.cs deleted file mode 100644 index 15c5a37..0000000 --- a/Shared/POSModels/Tblinvoice.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblinvoice -{ - public string? InvoiceId { get; set; } - - public string? Pcode { get; set; } - - public int? Quantity { get; set; } - - public decimal? Unitprice { get; set; } - - public string? Unit { get; set; } - - public decimal? Totalprice { get; set; } - - public DateOnly? DateGenerated { get; set; } - - public string? Status { get; set; } - - public string? GeneratedBy { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tblpricechange.cs b/Shared/POSModels/Tblpricechange.cs deleted file mode 100644 index 4252692..0000000 --- a/Shared/POSModels/Tblpricechange.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblpricechange -{ - public string? Pcode { get; set; } - - public decimal? PreviousPrice { get; set; } - - public decimal? CurrentPrice { get; set; } - - public DateTime? ChangeDate { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tblproduct.cs b/Shared/POSModels/Tblproduct.cs deleted file mode 100644 index 78d1ad3..0000000 --- a/Shared/POSModels/Tblproduct.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tblproduct -{ - public string? Pcode { get; set; } - - public string? Barcode { get; set; } - - public string? Pdesc { get; set; } - - public string? Bid { get; set; } - - public string? Cid { get; set; } - - public decimal? Price { get; set; } - - public decimal? Costprice { get; set; } - - public string? BaseUnit { get; set; } - - public string? ProductName { get; set; } - - public string? Status { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tbltruck.cs b/Shared/POSModels/Tbltruck.cs deleted file mode 100644 index 330477e..0000000 --- a/Shared/POSModels/Tbltruck.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbltruck -{ - public string TruckId { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? LicensePlate { get; set; } - - public string? Brand { get; set; } - - public string? Driver { get; set; } - - public decimal? Weight { get; set; } -} diff --git a/Shared/POSModels/TbltruckDrivermapping.cs b/Shared/POSModels/TbltruckDrivermapping.cs deleted file mode 100644 index 5bb5f5c..0000000 --- a/Shared/POSModels/TbltruckDrivermapping.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class TbltruckDrivermapping -{ - public string? TruckId { get; set; } - - public string? DriverId { get; set; } - - public DateTime? DateEntry { get; set; } - - public string? Operation { get; set; } - - public string CountId { get; set; } = null!; - - public string BranchId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tbltruckassignment.cs b/Shared/POSModels/Tbltruckassignment.cs deleted file mode 100644 index e979a48..0000000 --- a/Shared/POSModels/Tbltruckassignment.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbltruckassignment -{ - public string? OrderId { get; set; } - - public decimal? Cost { get; set; } - - public string? TruckId { get; set; } - - public string? Status { get; set; } - - public DateTime? DateAssigned { get; set; } - - public string CountId { get; set; } = null!; - - public string BranchId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tbltruckinventory.cs b/Shared/POSModels/Tbltruckinventory.cs deleted file mode 100644 index 76329e0..0000000 --- a/Shared/POSModels/Tbltruckinventory.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbltruckinventory -{ - public string? TruckId { get; set; } - - public string? Pcode { get; set; } - - public int? Quantity { get; set; } - - public string? Unit { get; set; } - - public string CountId { get; set; } = null!; - - public string BranchId { get; set; } = null!; -} diff --git a/Shared/POSModels/Tbluser.cs b/Shared/POSModels/Tbluser.cs deleted file mode 100644 index 6427653..0000000 --- a/Shared/POSModels/Tbluser.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbluser -{ - public string Username { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? Password { get; set; } - - public string? Firstname { get; set; } - - public string? Surname { get; set; } - - public string? StreetAddress1 { get; set; } - - public string? StreetAddress2 { get; set; } - - public string? City { get; set; } - - public string? StateOrProvince { get; set; } - - public string? Telephone { get; set; } - - public string? Email { get; set; } - - public string? AccessLevel { get; set; } - - public DateTime? LastLogin { get; set; } -} diff --git a/Shared/POSModels/Tbstock.cs b/Shared/POSModels/Tbstock.cs deleted file mode 100644 index 4557323..0000000 --- a/Shared/POSModels/Tbstock.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Tbstock -{ - public string? Refno { get; set; } - - public string? Pcode { get; set; } - - public int? Qty { get; set; } - - public DateOnly? Sdate { get; set; } - - public string? Stockinby { get; set; } - - public string BranchId { get; set; } = null!; - - public string CountId { get; set; } = null!; -} diff --git a/Shared/POSModels/Unitofmeasure.cs b/Shared/POSModels/Unitofmeasure.cs deleted file mode 100644 index b72f983..0000000 --- a/Shared/POSModels/Unitofmeasure.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Biskilog_Cloud.Shared.POSModels; - -public partial class Unitofmeasure -{ - public string UnitCode { get; set; } = null!; - - public string BranchId { get; set; } = null!; - - public string? Unitname { get; set; } - - public string? Unitshort { get; set; } - - public string? Status { get; set; } -} diff --git a/Shared/SharedClass.cs b/Shared/SharedClass.cs index bb016a8..0d3a432 100644 --- a/Shared/SharedClass.cs +++ b/Shared/SharedClass.cs @@ -1 +1,4 @@ /* Shared classes can be referenced by both the Client and Server */ +public class Shared +{ +} \ No newline at end of file -- 2.25.1