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