New source control repo for Biskilog POS - secure hub to store & manage source code. Streamlines dev process, tracks changes, & improves collaboration. Ensures reliable software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1366 lines
51 KiB

using Azure.Core;
using Biskilog_Accounting.Shared.Enums;
using Biskilog_Accounting.Shared.Interfaces;
using Biskilog_Accounting.Shared.POSModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Net.Http.Headers;
using System.Security.Claims;
namespace Biskilog_Accounting.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<BiskAcdbContext> 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<Creditpurchase> Creditpurchases { get; set; }
public virtual DbSet<Customeraccount> Customeraccounts { get; set; }
public virtual DbSet<Productaltunit> Productaltunits { get; set; }
public virtual DbSet<Restocklevel> Restocklevels { get; set; }
public virtual DbSet<Systemuserrole> Systemuserroles { get; set; }
public virtual DbSet<Tblbranch> Tblbranches { get; set; }
public virtual DbSet<Tblbrand> Tblbrands { get; set; }
public virtual DbSet<Tblcancelledtransaction> Tblcancelledtransactions { get; set; }
public virtual DbSet<Tblcart> Tblcarts { get; set; }
public virtual DbSet<Tblcategory> Tblcategories { get; set; }
public virtual DbSet<Tblcompanydetail> Tblcompanydetails { get; set; }
public virtual DbSet<Tblcustomer> Tblcustomers { get; set; }
public virtual DbSet<Tblcustomerpurchase> Tblcustomerpurchases { get; set; }
public virtual DbSet<Tbldeliverydetail> Tbldeliverydetails { get; set; }
public virtual DbSet<Tbldeliveryhead> Tbldeliveryheads { get; set; }
public virtual DbSet<Tbldeliveryrecipient> Tbldeliveryrecipients { get; set; }
public virtual DbSet<Tbldiscountlog> Tbldiscountlogs { get; set; }
public virtual DbSet<Tbldriver> Tbldrivers { get; set; }
public virtual DbSet<Tblinventory> Tblinventories { get; set; }
public virtual DbSet<Tblinventoryentry> Tblinventoryentries { get; set; }
public virtual DbSet<Tblinvoice> Tblinvoices { get; set; }
public virtual DbSet<Tblpricechange> Tblpricechanges { get; set; }
public virtual DbSet<Tblproduct> Tblproducts { get; set; }
public virtual DbSet<Tbltruck> Tbltrucks { get; set; }
public virtual DbSet<TbltruckDrivermapping> TbltruckDrivermappings { get; set; }
public virtual DbSet<Tbltruckassignment> Tbltruckassignments { get; set; }
public virtual DbSet<Tbltruckinventory> Tbltruckinventories { get; set; }
public virtual DbSet<Tbluser> Tblusers { get; set; }
public virtual DbSet<Tbstock> Tbstocks { get; set; }
public virtual DbSet<Unitofmeasure> Unitofmeasures { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder
.UseCollation("utf8mb4_general_ci")
.HasCharSet("utf8mb4");
modelBuilder.Entity<Creditpurchase>(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<Customeraccount>(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<Productaltunit>(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<Restocklevel>(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<Systemuserrole>(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<Tblbranch>(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<Tblbrand>(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<Tblcancelledtransaction>(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<Tblcart>(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");
});
modelBuilder.Entity<Tblcategory>(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<Tblcompanydetail>(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<Tblcustomer>(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<Tblcustomerpurchase>(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<Tbldeliverydetail>(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<Tbldeliveryhead>(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<Tbldeliveryrecipient>(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<Tbldiscountlog>(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<Tbldriver>(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<Tblinventory>(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<Tblinventoryentry>(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<Tblinvoice>(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<Tblpricechange>(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<Tblproduct>(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<Tbltruck>(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<TbltruckDrivermapping>(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<Tbltruckassignment>(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<Tbltruckinventory>(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<Tbluser>(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<Tbstock>(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<Unitofmeasure>(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);
}