fix
This commit is contained in:
parent
712140a156
commit
9a42abc8fc
@ -24,7 +24,6 @@ namespace SoftwareInstallationFileImplement.Implements
|
||||
return new();
|
||||
}
|
||||
return source.Components.Where(x => x.ComponentName.Contains(model.ComponentName)).Select(x => x.GetViewModel).ToList();
|
||||
|
||||
}
|
||||
public ComponentViewModel? GetElement(ComponentSearchModel model)
|
||||
{
|
||||
@ -71,7 +70,6 @@ namespace SoftwareInstallationFileImplement.Implements
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
using SoftwareInstallationFileImplement.Models;
|
||||
using System.Xml.Linq;
|
||||
|
||||
|
||||
|
||||
namespace SoftwareInstallationFileImplement
|
||||
{
|
||||
public class DataFileSingleton
|
||||
@ -14,6 +12,7 @@ namespace SoftwareInstallationFileImplement
|
||||
public List<Component> Components { get; private set; }
|
||||
public List<Order> Orders { get; private set; }
|
||||
public List<Package> Packages { get; private set; }
|
||||
|
||||
public static DataFileSingleton GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
@ -25,6 +24,7 @@ namespace SoftwareInstallationFileImplement
|
||||
public void SaveComponents() => SaveData(Components, ComponentFileName,"Components", x => x.GetXElement);
|
||||
public void SavePackages() => SaveData(Packages, PackageFileName, "Packages", x => x.GetXElement);
|
||||
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
|
||||
|
||||
private DataFileSingleton()
|
||||
{
|
||||
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
|
||||
|
@ -37,7 +37,6 @@ namespace SoftwareInstallationFileImplement.Models
|
||||
DateCreate = model.DateCreate,
|
||||
DateImplement = model.DateImplement,
|
||||
Id = model.Id,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -72,6 +71,7 @@ namespace SoftwareInstallationFileImplement.Models
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
PackageName = DataFileSingleton.GetInstance().Packages.FirstOrDefault(x => x.Id == PackageId)?.PackageName ?? string.Empty,
|
||||
PackageId = PackageId,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
|
@ -39,16 +39,7 @@ namespace SoftwareInstallationFileImplement.Implements
|
||||
}
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
var a = new List<OrderViewModel>();
|
||||
//var result = _source.Orders
|
||||
// .Select(x => x.GetViewModel)
|
||||
// .ToList();
|
||||
//TODO
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
a.Add(GetViewModel(order));
|
||||
}
|
||||
return a;
|
||||
return _source.Orders.Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
{
|
||||
@ -73,18 +64,5 @@ namespace SoftwareInstallationFileImplement.Implements
|
||||
_source.SaveOrders();
|
||||
return order.GetViewModel;
|
||||
}
|
||||
private OrderViewModel GetViewModel(Order model)
|
||||
{
|
||||
var res = model.GetViewModel;
|
||||
foreach (var package in _source.Packages)
|
||||
{
|
||||
if (package.Id == model.PackageId)
|
||||
{
|
||||
res.PackageName = package.PackageName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
@ -102,6 +102,7 @@
|
||||
this.Controls.Add(this.buttonAdd);
|
||||
this.Name = "FormComponents";
|
||||
this.Text = "Компоненты";
|
||||
this.Load += new System.EventHandler(this.FormComponents_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
@ -157,6 +157,7 @@
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Name = "FormMain";
|
||||
this.Text = "Установка ПО";
|
||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
|
@ -105,6 +105,7 @@
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormPackages";
|
||||
this.Text = "Изделия";
|
||||
this.Load += new System.EventHandler(this.FormViewPackage_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user