Materials were refactored
This commit is contained in:
16
StructureHelperCommon/Infrastructures/Enums/NatSystems.cs
Normal file
16
StructureHelperCommon/Infrastructures/Enums/NatSystems.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Enums
|
||||
{
|
||||
public enum NatSystems
|
||||
{
|
||||
RU,
|
||||
EU,
|
||||
US,
|
||||
IS
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IDataRepository<T>
|
||||
{
|
||||
void Save(T entity);
|
||||
T Load(Guid Id);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface ISaveable
|
||||
{
|
||||
int Id { get; set; }
|
||||
/// <summary>
|
||||
/// Unique identifier
|
||||
/// </summary>
|
||||
Guid Id { get;}
|
||||
void Save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,55 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Codes.Factories;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Settings
|
||||
{
|
||||
public static class ProgramSetting
|
||||
{
|
||||
private static List<ICodeEntity> codesList;
|
||||
private static IMaterialRepository materialRepository;
|
||||
private static NatSystems natSystem;
|
||||
|
||||
public static CodeTypes CodeType => CodeTypes.SP63_2018;
|
||||
public static CodeTypes FRCodeType => CodeTypes.SP164_2014;
|
||||
public static NatSystems NatSystem
|
||||
{
|
||||
get => natSystem;
|
||||
set
|
||||
{
|
||||
natSystem = value;
|
||||
codesList = CodeFactory.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == natSystem)
|
||||
.ToList();
|
||||
materialRepository = new MaterialRepository(codesList);
|
||||
}
|
||||
}
|
||||
public static CrossSectionAxisNames CrossSectionAxisNames => new CrossSectionAxisNames();
|
||||
public static LimitStatesList LimitStatesList => new LimitStatesList();
|
||||
public static CalcTermList CalcTermList => new CalcTermList();
|
||||
public static List<ICodeEntity> CodesList
|
||||
{ get
|
||||
{
|
||||
codesList ??= CodeFactory.GetCodeEntities()
|
||||
.Where(x => x.NatSystem == NatSystem)
|
||||
.ToList();
|
||||
return codesList;
|
||||
}
|
||||
}
|
||||
|
||||
public static IMaterialRepository MaterialRepository
|
||||
{
|
||||
get
|
||||
{
|
||||
materialRepository ??= new MaterialRepository(codesList);
|
||||
return materialRepository;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user