Исправление отчета + бага бд
This commit is contained in:
parent
3244f9d2ea
commit
07ebb8d635
@ -54,9 +54,8 @@ namespace HardwareShopBusinessLogic.BusinessLogics.Storekeeper
|
||||
.Select(x => Tuple.Create(x.Value.Item1.BuildName, x.Value.Item2))
|
||||
.ToList();
|
||||
|
||||
var goods = component.ComponentBuilds
|
||||
.SelectMany(x =>
|
||||
_componentStorage.GetComponentGoods(new() { Id = x.Key }))
|
||||
var goods = _componentStorage
|
||||
.GetComponentGoods(new() { Id = component.Id })
|
||||
.ToList();
|
||||
|
||||
ReportComponentsViewModel record = new()
|
||||
|
@ -1,4 +1,4 @@
|
||||
using HardwareShopClientApp;
|
||||
/*using HardwareShopClientApp;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@ -27,3 +27,27 @@ app.MapControllerRoute(
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
||||
*/
|
||||
using HardwareShopBusinessLogic.BusinessLogics.Storekeeper;
|
||||
using HardwareShopDatabaseImplement.Implements.Storekeeper;
|
||||
|
||||
ComponentStorage _componentStorage = new();
|
||||
|
||||
ReportStorekeeperLogic reportLogic = new(_componentStorage);
|
||||
|
||||
var reportRecords = reportLogic.GetComponents(new() { Id = 1 },
|
||||
new() { DateFrom = DateTime.MinValue, DateTo = DateTime.Now });
|
||||
|
||||
Console.WriteLine("start");
|
||||
Console.WriteLine(reportRecords.Count);
|
||||
foreach (var reportRecord in reportRecords)
|
||||
{
|
||||
Console.WriteLine("components: " + reportRecord.ComponentName);
|
||||
Console.WriteLine("> good/build: ");
|
||||
for (int i = 0; i < reportRecord.GoodOrBuilds.Count; i++)
|
||||
{
|
||||
Console.WriteLine(i + 1 + ". " + reportRecord.GoodOrBuilds[i].Item1
|
||||
+ ". Count - " + reportRecord.GoodOrBuilds[i].Item2);
|
||||
}
|
||||
Console.WriteLine("Èòîãî - " + reportRecord.TotalCount);
|
||||
}
|
@ -11,6 +11,7 @@ namespace HardwareShopDatabaseImplement
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Port=5433;Database=Computer_Hardware_Store;Username=user;Password=12345");
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
|
@ -138,7 +138,7 @@ namespace HardwareShopDatabaseImplement.Implements.Storekeeper
|
||||
using var context = new HardwareShopDatabase();
|
||||
var builds = context.ComponentsBuilds
|
||||
.Where(x => x.ComponentId == model.Id)
|
||||
.Select(x => new Tuple<string, int>(x.Build.BuildName, x.Count))
|
||||
.Select(x => Tuple.Create(x.Build.BuildName, x.Count))
|
||||
.ToList();
|
||||
return builds;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user