add estimation date
This commit is contained in:
@@ -338,6 +338,7 @@ namespace Manut_Test_Blazor.Data
|
||||
{
|
||||
EstimationCode = item.Prodid.TrimEnd().ReplaceLineEndings(),
|
||||
Description = item.Desc.TrimEnd(),
|
||||
Date = DateOnly.FromDateTime(item.Regdate),
|
||||
};
|
||||
_partsdbContext.Estimations.Add(estimation);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Manut_Test_Blazor.Data
|
||||
CustomerCode = item.Customercode?.TrimEnd(),
|
||||
Name = item.Name?.TrimEnd(),
|
||||
Street = CleanUpRecord(item.Street)?.Replace(" ", ""),
|
||||
Zipcode = CleanUpRecord(item.Zipcode),
|
||||
Zipcode = CleanUpRecord(item.Zipcode)?.Replace(" ", ""),
|
||||
City = CleanUpRecord(item.City),
|
||||
Country = CleanUpRecord(item.Country),
|
||||
};
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace PartsDB.models.DB
|
||||
[MaxLength(100)]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
|
||||
public ICollection<Part>? PartsList { get; set; }
|
||||
}
|
||||
|
||||
@@ -12,13 +12,35 @@ namespace PartsDB.models.DB
|
||||
|
||||
|
||||
[ForeignKey("MainProductId")]
|
||||
public virtual Product? MainProduct { get; set; }
|
||||
public Product? MainProduct { get; set; }
|
||||
|
||||
[ForeignKey("PartProductId")]
|
||||
public virtual Product? PartProduct { get; set; }
|
||||
public Product? PartProduct { get; set; }
|
||||
|
||||
[ForeignKey("EstimationId")]
|
||||
public virtual Estimation? Estimation { get; set; }
|
||||
public Estimation? Estimation { get; set; }
|
||||
|
||||
|
||||
public decimal? TotalPriceEx()
|
||||
{
|
||||
return PartProduct?.MainVendor?.Price * Quantity;
|
||||
}
|
||||
|
||||
public decimal? PriceInc()
|
||||
{
|
||||
if (PartProduct?.ProfitMargin != 0)
|
||||
{
|
||||
return ((PartProduct?.MainVendor?.Price * PartProduct?.ProfitMargin) / 100) + PartProduct?.MainVendor?.Price;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PartProduct?.MainVendor?.Price;
|
||||
}
|
||||
}
|
||||
|
||||
public decimal? TotalPriceInc()
|
||||
{
|
||||
return PriceInc() * Quantity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,13 @@ namespace PartsDB.models.DB
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
entity.Navigation(b => b.PartsList);
|
||||
|
||||
entity.HasMany(d => d.PartOfList).WithOne();
|
||||
entity.HasMany(d => d.PartOfList)
|
||||
.WithOne();
|
||||
entity.Navigation(b => b.PartOfList);
|
||||
|
||||
//entity.HasMany(e => e.Estimations)
|
||||
// .WithOne(e => e.Estimation.);
|
||||
|
||||
entity.HasOne(d => d.Brand)
|
||||
.WithMany(b => b.Products)
|
||||
.HasForeignKey("BrandId");
|
||||
@@ -113,6 +117,8 @@ namespace PartsDB.models.DB
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("Description");
|
||||
|
||||
entity.Property(e => e.Date).HasColumnName("Date");
|
||||
|
||||
entity.HasMany(p => p.PartsList)
|
||||
.WithOne(p => p.Estimation)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
@@ -138,6 +144,7 @@ namespace PartsDB.models.DB
|
||||
entity.HasOne(d => d.Estimation)
|
||||
.WithMany(b => b.PartsList)
|
||||
.HasForeignKey("EstimationId");
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,13 @@ namespace PartsDB.models.DB
|
||||
public bool Obsolete { get; set; }
|
||||
|
||||
|
||||
public int? ProductGroupLevel0Id { get; set; }
|
||||
|
||||
public int? ProductGroupLevel1Id { get; set; }
|
||||
|
||||
public int? ProductGroupLevel2Id { get; set; }
|
||||
|
||||
|
||||
[ForeignKey("PackUnitId")]
|
||||
public PackUnit? PackUnit { get; set; }
|
||||
|
||||
@@ -49,10 +56,13 @@ namespace PartsDB.models.DB
|
||||
|
||||
public ICollection<Part>? PartOfList { get; set; }
|
||||
|
||||
//public ICollection<Part>? Estimations { get; set; }
|
||||
|
||||
public ICollection<Serial>? Serials { get; set; }
|
||||
|
||||
|
||||
[NotMapped]
|
||||
public ProductVendor? MainVendor => ProductVendors?.Where(m => m.IsMainVendor == true).SingleOrDefault();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,10 +19,13 @@ namespace PartsDB.models.DB
|
||||
|
||||
public ICollection<ProductGroup>? Childeren { get; }
|
||||
|
||||
public ProductGroup? SelectedChild => Childeren?.Where(c => c.Id == c.Parent?.Id).SingleOrDefault();
|
||||
|
||||
public ICollection<Product>? Products { get; }
|
||||
|
||||
|
||||
public ICollection<Product>? ProductsLevel0 { get; }
|
||||
|
||||
|
||||
public ICollection<Product>? ProductsLevel1 { get; }
|
||||
|
||||
public ICollection<Product>? ProductsLevel2 { get; }
|
||||
|
||||
Reference in New Issue
Block a user