Material Update Strategy was added
This commit is contained in:
@@ -1,15 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.Converters.Units
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,24 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Infrastructure.UI.Converters.Units;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using System.Windows.Controls;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
|
||||
@@ -1,14 +1,5 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.UnitSystem.Systems;
|
||||
using StructureHelper.Windows.MainWindow;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
|
||||
namespace StructureHelper.Infrastructure.UI.DataContexts
|
||||
{
|
||||
|
||||
@@ -49,5 +49,10 @@
|
||||
<Setter Property="Margin" Value="5"/>
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="OkCancelButtons">
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource CancelButton}" Command="{Binding CancelCommand}"/>
|
||||
<Button Style="{StaticResource OkButton}" Command="{Binding OkCommand}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
@@ -1,6 +1,6 @@
|
||||
using StructureHelper.Windows.Errors;
|
||||
using StructureHelper.Windows.ViewModels.Errors;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
|
||||
25
StructureHelper/Services/Settings/GlobalRepository.cs
Normal file
25
StructureHelper/Services/Settings/GlobalRepository.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Repositories;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelper.Services.Settings
|
||||
{
|
||||
internal static class GlobalRepository
|
||||
{
|
||||
private static IDataRepository<IHeadMaterial> materials;
|
||||
public static IDataRepository<IHeadMaterial> Materials
|
||||
{
|
||||
get
|
||||
{
|
||||
materials ??= new ListRepository<IHeadMaterial>(new MaterialUpdateStrategy());
|
||||
return materials;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Settings;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.Beams;
|
||||
using StructureHelper.Windows.PrimitiveTemplates.RCs.RectangleBeam;
|
||||
using StructureHelper.Windows.ViewModels;
|
||||
@@ -10,7 +11,6 @@ using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Templates.CrossSections.RCs;
|
||||
using StructureHelperLogics.Models.Templates.RCs;
|
||||
@@ -403,6 +403,10 @@ namespace StructureHelper.Windows.MainWindow
|
||||
item.RegisterDeltas(CanvasWidth / 2, CanvasHeight / 2);
|
||||
}
|
||||
PrimitiveLogic.Refresh();
|
||||
foreach (var item in newRepository.HeadMaterials)
|
||||
{
|
||||
GlobalRepository.Materials.Create(item);
|
||||
}
|
||||
return primitives;
|
||||
}
|
||||
return new List<PrimitiveBase>();
|
||||
|
||||
@@ -14,7 +14,12 @@
|
||||
<Window.Resources>
|
||||
<ResourceDictionary Source="/Infrastructure/UI/Resources/Materials.xaml"/>
|
||||
</Window.Resources>
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="46"/>
|
||||
@@ -46,4 +51,6 @@
|
||||
<StackPanel Grid.Row="1" x:Name="StpMaterialProperties"/>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.ViewModels.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -31,7 +30,10 @@ namespace StructureHelper.Windows.MainWindow.Materials
|
||||
{
|
||||
InitializeComponent();
|
||||
this.headMaterial = headMaterial;
|
||||
vm = new HeadMaterialViewModel(this.headMaterial);
|
||||
vm = new HeadMaterialViewModel(this.headMaterial)
|
||||
{
|
||||
ParentWindow = this
|
||||
};
|
||||
DataContext = vm;
|
||||
AddDataTemplates();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<ContentControl ContentTemplate="{StaticResource CircleShapeEdit}" Content="{Binding}"/>
|
||||
@@ -33,9 +33,6 @@
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="1" Style="{StaticResource ValidatedError}" Text="{Binding BarCount, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Width="60" Height="20" Margin="5" Content="Cancel" Command="{Binding CancelCommand}"/>
|
||||
<Button Width="60" Height="20" Margin="5" Content="OK" Command="{Binding OkCommand}"/>
|
||||
</StackPanel>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="40"/>
|
||||
<RowDefinition Height="35"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<ContentControl ContentTemplate="{StaticResource RectangleShapeEdit}" Content="{Binding}"/>
|
||||
@@ -42,9 +42,6 @@
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Margin="1" Style="{StaticResource ValidatedError}" Text="{Binding HeightCount, ValidatesOnExceptions=True}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Width="60" Height="20" Margin="5" Content="Cancel" Command="{Binding CancelCommand}"/>
|
||||
<Button Width="60" Height="20" Margin="5" Content="OK" Command="{Binding OkCommand}"/>
|
||||
</StackPanel>
|
||||
<ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.UI.DataContexts;
|
||||
using StructureHelper.Services.Primitives;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Calculations.Calculators
|
||||
|
||||
@@ -18,7 +18,6 @@ using StructureHelper.Windows.ViewModels.Graphs;
|
||||
using StructureHelper.Windows.ViewModels.PrimitiveProperties;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Parameters;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
@@ -32,8 +31,6 @@ using StructureHelperLogics.Services.NdmCalculations;
|
||||
using StructureHelperLogics.Services.NdmPrimitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Windows.Forces;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -3,7 +3,6 @@ using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.AddMaterialWindow;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
@@ -16,7 +15,7 @@ using System.Windows.Media;
|
||||
|
||||
namespace StructureHelper.Windows.ViewModels.Materials
|
||||
{
|
||||
internal class HeadMaterialViewModel : ViewModelBase
|
||||
internal class HeadMaterialViewModel : OkCancelViewModelBase
|
||||
{
|
||||
IHeadMaterial headMaterial;
|
||||
HelperMaterialViewModel helperMaterialViewModel;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Services.Settings;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System.Linq;
|
||||
@@ -42,6 +42,7 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
else if (paramType == MaterialType.CarbonFiber) { AddCarbonFiber(); }
|
||||
else if (paramType == MaterialType.GlassFiber) { AddGlassFiber(); }
|
||||
else throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $". Expected: {typeof(MaterialType)}, Actual type: {nameof(paramType)}");
|
||||
GlobalRepository.Materials.Create(NewItem);
|
||||
base.AddMethod(parameter);
|
||||
}
|
||||
public override void DeleteMethod(object parameter)
|
||||
@@ -57,15 +58,35 @@ namespace StructureHelper.Windows.ViewModels.Materials
|
||||
var dialogResult = MessageBox.Show("Delete material?", "Please, confirm deleting", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
GlobalRepository.Materials.Delete(SelectedItem.Id);
|
||||
base.DeleteMethod(parameter);
|
||||
}
|
||||
}
|
||||
public override void EditMethod(object parameter)
|
||||
{
|
||||
var copyObject = GlobalRepository.Materials.GetById(SelectedItem.Id).Clone() as IHeadMaterial;
|
||||
var wnd = new HeadMaterialView(SelectedItem);
|
||||
wnd.ShowDialog();
|
||||
if (wnd.DialogResult == true)
|
||||
{
|
||||
GlobalRepository.Materials.Update(SelectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
var updateStrategy = new MaterialUpdateStrategy();
|
||||
updateStrategy.Update(SelectedItem, copyObject);
|
||||
}
|
||||
base.EditMethod(parameter);
|
||||
}
|
||||
public override void CopyMethod(object parameter)
|
||||
{
|
||||
NewItem = SelectedItem.Clone() as IHeadMaterial;
|
||||
NewItem.Name = $"{NewItem.Name} copy";
|
||||
GlobalRepository.Materials.Create(NewItem);
|
||||
Collection.Add(NewItem);
|
||||
Items.Add(NewItem);
|
||||
SelectedItem = NewItem;
|
||||
}
|
||||
private void AddElastic()
|
||||
{
|
||||
var material = HeadMaterialFactory.GetHeadMaterial(HeadmaterialType.Elastic200);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
|
||||
@@ -13,7 +13,6 @@ using StructureHelper.Infrastructure;
|
||||
using StructureHelper.Infrastructure.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using ViewModelBase = StructureHelper.Infrastructure.ViewModelBase;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Documents;
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
using StructureHelper.Infrastructure;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using StructureHelper.Models.Materials;
|
||||
using StructureHelper.Windows.MainWindow.Materials;
|
||||
using StructureHelper.Windows.ViewModels.NdmCrossSections;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace StructureHelperCommon.Infrastructures.Strings
|
||||
namespace StructureHelperCommon.Infrastructures.Exceptions
|
||||
{
|
||||
public static class ErrorStrings
|
||||
{
|
||||
@@ -8,8 +8,10 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IDataRepository<T>
|
||||
{
|
||||
void Save(T entity);
|
||||
T Load(Guid Id);
|
||||
|
||||
void Create(T entity);
|
||||
void Update(T entity);
|
||||
void Delete(Guid Id);
|
||||
T GetById(Guid Id);
|
||||
List<T> GetAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
/// Unique identifier
|
||||
/// </summary>
|
||||
Guid Id { get;}
|
||||
void Save();
|
||||
//void Save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Infrastructures.Interfaces
|
||||
{
|
||||
public interface IUpdateStrategy<T>
|
||||
{
|
||||
void Update(T targetObject, T sourceObject);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
|
||||
namespace StructureHelperCommon.Models.Forces
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
@@ -177,7 +176,6 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
new ConcreteMaterialEntity(new Guid("2f5b70b9-f4c1-470d-ac27-a39a7093b6ea"))
|
||||
{
|
||||
CodeType = codeType,
|
||||
Code = code,
|
||||
Name = "B30",
|
||||
MainStrength = 30e6
|
||||
},
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public interface IMaterialSafetyFactor : ICloneable
|
||||
public interface IMaterialSafetyFactor : ISaveable, ICloneable
|
||||
{
|
||||
string Name { get; set; }
|
||||
bool Take { get; set; }
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public interface IPartialFactor : ICloneable
|
||||
public interface IPartialFactor : ISaveable, ICloneable
|
||||
{
|
||||
double FactorValue {get;set;}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
internal class MaterialPartialFactorUpdateStrategy : IUpdateStrategy<IMaterialPartialFactor>
|
||||
{
|
||||
public void Update(IMaterialPartialFactor targetObject, IMaterialPartialFactor sourceObject)
|
||||
{
|
||||
targetObject.LimitState = sourceObject.LimitState;
|
||||
targetObject.StressState = sourceObject.StressState;
|
||||
targetObject.CalcTerm = sourceObject.CalcTerm;
|
||||
targetObject.FactorValue = sourceObject.FactorValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
internal class MaterialSafetyFactorUpdateStrategy : IUpdateStrategy<IMaterialSafetyFactor>
|
||||
{
|
||||
public void Update(IMaterialSafetyFactor targetObject, IMaterialSafetyFactor sourceObject)
|
||||
{
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.Take = sourceObject.Take;
|
||||
targetObject.Description = sourceObject.Description;
|
||||
targetObject.PartialFactors.Clear();
|
||||
foreach (var item in sourceObject.PartialFactors)
|
||||
{
|
||||
targetObject.PartialFactors.Add(item.Clone() as IMaterialPartialFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using System;
|
||||
|
||||
namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public class MaterialPartialFactor : IMaterialPartialFactor
|
||||
{
|
||||
private double factorValue;
|
||||
|
||||
public Guid Id { get; }
|
||||
public StressStates StressState { get; set; }
|
||||
public CalcTerms CalcTerm { get; set; }
|
||||
public LimitStates LimitState { get; set; }
|
||||
@@ -24,23 +24,24 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
}
|
||||
}
|
||||
|
||||
public MaterialPartialFactor()
|
||||
|
||||
public MaterialPartialFactor(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
StressState = StressStates.Compression;
|
||||
LimitState = LimitStates.ULS;
|
||||
CalcTerm = CalcTerms.LongTerm;
|
||||
FactorValue = 1d;
|
||||
}
|
||||
|
||||
public MaterialPartialFactor() : this (Guid.NewGuid())
|
||||
{ }
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new MaterialPartialFactor()
|
||||
{
|
||||
StressState = StressState,
|
||||
CalcTerm = CalcTerm,
|
||||
LimitState = LimitState,
|
||||
FactorValue = FactorValue,
|
||||
};
|
||||
var newItem = new MaterialPartialFactor();
|
||||
var updateStrategy = new MaterialPartialFactorUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
|
||||
@@ -6,23 +7,32 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
{
|
||||
public class MaterialSafetyFactor : IMaterialSafetyFactor
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public string Name {get; set; }
|
||||
public bool Take { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<IMaterialPartialFactor> PartialFactors { get; }
|
||||
|
||||
public MaterialSafetyFactor()
|
||||
|
||||
public MaterialSafetyFactor(Guid id)
|
||||
{
|
||||
Id = id;
|
||||
Take = true;
|
||||
Name = "New factor";
|
||||
Description = "Material safety factor for ...";
|
||||
PartialFactors = new List<IMaterialPartialFactor>();
|
||||
}
|
||||
|
||||
public MaterialSafetyFactor() : this (Guid.NewGuid())
|
||||
{ }
|
||||
|
||||
public double GetFactor(StressStates stressState, CalcTerms calcTerm, LimitStates limitStates)
|
||||
{
|
||||
double result = 1d;
|
||||
var coefficients = PartialFactors.Where(x => (x.StressState == stressState & x.CalcTerm == calcTerm & x.LimitState == limitStates));
|
||||
var coefficients = PartialFactors
|
||||
.Where(x => x.StressState == stressState
|
||||
& x.CalcTerm == calcTerm
|
||||
& x.LimitState == limitStates);
|
||||
foreach (var item in coefficients) { result *= item.FactorValue;}
|
||||
return result;
|
||||
}
|
||||
@@ -30,13 +40,8 @@ namespace StructureHelperCommon.Models.Materials.Libraries
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new MaterialSafetyFactor();
|
||||
newItem.Take = Take;
|
||||
newItem.Name = Name;
|
||||
newItem.Description = Description;
|
||||
foreach (var item in PartialFactors)
|
||||
{
|
||||
newItem.PartialFactors.Add(item.Clone() as IMaterialPartialFactor);
|
||||
}
|
||||
var updateSrategy = new MaterialSafetyFactorUpdateStrategy();
|
||||
updateSrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
58
StructureHelperCommon/Models/Repositories/ListRepository.cs
Normal file
58
StructureHelperCommon/Models/Repositories/ListRepository.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Repositories
|
||||
{
|
||||
public class ListRepository<T> : IDataRepository<T>
|
||||
where T : ISaveable
|
||||
{
|
||||
List<T> internalData;
|
||||
private IUpdateStrategy<T> updateStrategy;
|
||||
public void Create(T entity)
|
||||
{
|
||||
var isExists = internalData.Exists(x => x.Id == entity.Id);
|
||||
if (isExists == true)
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $":\nobject with Id={entity.Id} already exists");
|
||||
}
|
||||
internalData.Add(entity);
|
||||
}
|
||||
|
||||
public void Delete(Guid Id)
|
||||
{
|
||||
T existingObject = GetById(Id);
|
||||
internalData.Remove(existingObject);
|
||||
}
|
||||
|
||||
public List<T> GetAll()
|
||||
{
|
||||
return new List<T>(internalData);
|
||||
}
|
||||
|
||||
public T GetById(Guid id)
|
||||
{
|
||||
T existingObject = internalData.Single(x => x.Id == id);
|
||||
return existingObject;
|
||||
}
|
||||
|
||||
public void Update(T updateObject)
|
||||
{
|
||||
T existingObject = GetById(updateObject.Id);
|
||||
updateStrategy.Update(existingObject, updateObject);
|
||||
}
|
||||
public ListRepository(List<T> initialData, IUpdateStrategy<T> updateStrategy)
|
||||
{
|
||||
internalData = initialData;
|
||||
this.updateStrategy = updateStrategy;
|
||||
}
|
||||
public ListRepository(IUpdateStrategy<T> updateStrategy) : this(new List<T>(), updateStrategy)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using System;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.Units;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -32,7 +32,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new ConcreteLibMaterial() { MaterialEntity = MaterialEntity, TensionForULS = TensionForULS, TensionForSLS = TensionForSLS };
|
||||
var newItem = new ConcreteLibMaterial();
|
||||
var updateStrategy = new ConcreteLibUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public LM.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
|
||||
@@ -31,7 +31,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new ElasticMaterial() { Modulus = Modulus, CompressiveStrength = CompressiveStrength, TensileStrength = TensileStrength };
|
||||
var newItem = new ElasticMaterial();
|
||||
var updateStrategy = new ElasticUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,14 +48,9 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
var newItem = new FRMaterial(materialType)
|
||||
{
|
||||
Modulus = Modulus,
|
||||
CompressiveStrength = CompressiveStrength,
|
||||
TensileStrength = TensileStrength,
|
||||
ULSConcreteStrength = ULSConcreteStrength,
|
||||
SumThickness = SumThickness,
|
||||
};
|
||||
var newItem = new FRMaterial(this.materialType);
|
||||
var updateStrategy = new FRUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Codes;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -50,13 +50,11 @@ namespace StructureHelper.Models.Materials
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
IHeadMaterial material = new HeadMaterial
|
||||
{
|
||||
Name = Name,
|
||||
Color = Color,
|
||||
HelperMaterial = HelperMaterial.Clone() as IHelperMaterial
|
||||
};
|
||||
return material;
|
||||
var newItem = new HeadMaterial();
|
||||
newItem.HelperMaterial = this.HelperMaterial.Clone() as IHelperMaterial;
|
||||
var updateStrategy = new MaterialUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace StructureHelper.Models.Materials
|
||||
string Name { get; set; }
|
||||
Color Color { get; set; }
|
||||
IHelperMaterial HelperMaterial { get; set; }
|
||||
//MaterialDefinitionBase Material { get; set; }
|
||||
IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System.Collections.Generic;
|
||||
using LCM = LoaderCalculator.Data.Materials;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ConcreteLibUpdateStrategy : IUpdateStrategy<IConcreteLibMaterial>
|
||||
{
|
||||
LibMaterialUpdateStrategy libUpdateStrategy = new LibMaterialUpdateStrategy();
|
||||
public void Update(IConcreteLibMaterial targetObject, IConcreteLibMaterial sourceObject)
|
||||
{
|
||||
libUpdateStrategy.Update(targetObject, sourceObject);
|
||||
targetObject.TensionForULS = sourceObject.TensionForULS;
|
||||
targetObject.TensionForSLS = sourceObject.TensionForSLS;
|
||||
targetObject.Humidity = sourceObject.Humidity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using LCMB = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ElasticUpdateStrategy : IUpdateStrategy<IElasticMaterial>
|
||||
{
|
||||
public void Update(IElasticMaterial targetObject, IElasticMaterial sourceObject)
|
||||
{
|
||||
targetObject.Modulus = sourceObject.Modulus;
|
||||
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
||||
targetObject.TensileStrength = sourceObject.TensileStrength;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class FRUpdateStrategy : IUpdateStrategy<IFRMaterial>
|
||||
{
|
||||
public void Update(IFRMaterial targetObject, IFRMaterial sourceObject)
|
||||
{
|
||||
targetObject.Modulus = sourceObject.Modulus;
|
||||
targetObject.CompressiveStrength = sourceObject.CompressiveStrength;
|
||||
targetObject.TensileStrength = targetObject.TensileStrength;
|
||||
targetObject.ULSConcreteStrength = targetObject.ULSConcreteStrength;
|
||||
targetObject.SumThickness = targetObject.SumThickness;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class LibMaterialUpdateStrategy : IUpdateStrategy<ILibMaterial>
|
||||
{
|
||||
public void Update(ILibMaterial targetObject, ILibMaterial sourceObject)
|
||||
{
|
||||
targetObject.MaterialEntity = sourceObject.MaterialEntity;
|
||||
targetObject.SafetyFactors.Clear();
|
||||
foreach (var item in sourceObject.SafetyFactors)
|
||||
{
|
||||
targetObject.SafetyFactors.Add(item.Clone() as IMaterialSafetyFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class MaterialUpdateStrategy : IUpdateStrategy<IHeadMaterial>
|
||||
{
|
||||
public void Update(IHeadMaterial targetObject, IHeadMaterial sourceObject)
|
||||
{
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.Color = sourceObject.Color;
|
||||
targetObject.HelperMaterial = sourceObject.HelperMaterial.Clone() as IHelperMaterial;
|
||||
UpdateHelperMaterial(targetObject.HelperMaterial, sourceObject.HelperMaterial);
|
||||
}
|
||||
|
||||
private static void UpdateHelperMaterial(IHelperMaterial target, IHelperMaterial source)
|
||||
{
|
||||
Check(target, source);
|
||||
UpdateMaterial(target, source);
|
||||
}
|
||||
private static void Check(IHelperMaterial target, IHelperMaterial source)
|
||||
{
|
||||
if (target.GetType() != source.GetType())
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.DataIsInCorrect + $"target type is {target.GetType()}, \n is no coinside with source type {source.GetType()}");
|
||||
}
|
||||
}
|
||||
private static void UpdateMaterial(IHelperMaterial target, IHelperMaterial source)
|
||||
{
|
||||
if (source is ILibMaterial)
|
||||
{
|
||||
UpdateLibMaterial(target, source);
|
||||
}
|
||||
else if (source is IElasticMaterial)
|
||||
{
|
||||
UpdateElastic(target, source);
|
||||
}
|
||||
else if (source is IFRMaterial)
|
||||
{
|
||||
UpdateFR(target, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"\n Expected: {typeof(IHelperMaterial)},\n But was: {source.GetType()}");
|
||||
}
|
||||
}
|
||||
private static void UpdateFR(IHelperMaterial target, IHelperMaterial source)
|
||||
{
|
||||
var targetMaterial = target as IFRMaterial;
|
||||
var sourceMaterial = source as IFRMaterial;
|
||||
var logic = new FRUpdateStrategy();
|
||||
logic.Update(targetMaterial, sourceMaterial);
|
||||
}
|
||||
private static void UpdateElastic(IHelperMaterial target, IHelperMaterial source)
|
||||
{
|
||||
var targetMaterial = target as IElasticMaterial;
|
||||
var sourceMaterial = source as IElasticMaterial;
|
||||
var logic = new ElasticUpdateStrategy();
|
||||
logic.Update(targetMaterial, sourceMaterial);
|
||||
}
|
||||
private static void UpdateLibMaterial(IHelperMaterial target, IHelperMaterial source)
|
||||
{
|
||||
if (source is IConcreteLibMaterial)
|
||||
{
|
||||
var targetMaterial = target as IConcreteLibMaterial;
|
||||
var sourceMaterial = source as IConcreteLibMaterial;
|
||||
var logic = new ConcreteLibUpdateStrategy();
|
||||
logic.Update(targetMaterial, sourceMaterial);
|
||||
}
|
||||
else if (source is IReinforcementLibMaterial)
|
||||
{
|
||||
var targetMaterial = target as IReinforcementLibMaterial;
|
||||
var sourceMaterial = source as IReinforcementLibMaterial;
|
||||
var logic = new ReinforcementLibUpdateStrategy();
|
||||
logic.Update(targetMaterial, sourceMaterial);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknown + $"\n Expected: {typeof(ILibMaterial)},\n But was: {source.GetType()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
internal class ReinforcementLibUpdateStrategy : IUpdateStrategy<IReinforcementLibMaterial>
|
||||
{
|
||||
LibMaterialUpdateStrategy libUpdateStrategy = new LibMaterialUpdateStrategy();
|
||||
public void Update(IReinforcementLibMaterial targetObject, IReinforcementLibMaterial sourceObject)
|
||||
{
|
||||
libUpdateStrategy.Update(targetObject, sourceObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Materials.Libraries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -9,6 +9,7 @@ using Loadermaterials = LoaderCalculator.Data.Materials;
|
||||
using LMBuilders = LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LoaderMaterialLogics = LoaderCalculator.Data.Materials.MaterialBuilders.MaterialLogics;
|
||||
|
||||
|
||||
namespace StructureHelperLogics.Models.Materials
|
||||
{
|
||||
public class ReinforcementLibMaterial : IReinforcementLibMaterial
|
||||
@@ -29,7 +30,10 @@ namespace StructureHelperLogics.Models.Materials
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new ReinforcementLibMaterial() { MaterialEntity = MaterialEntity};
|
||||
var newItem = new ReinforcementLibMaterial();
|
||||
var updateStrategy = new ReinforcementLibUpdateStrategy();
|
||||
updateStrategy.Update(newItem, this);
|
||||
return newItem;
|
||||
}
|
||||
|
||||
public Loadermaterials.IMaterial GetLoaderMaterial(LimitStates limitState, CalcTerms calcTerm)
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Analyses
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using LoaderCalculator.Logics;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace StructureHelperLogics.NdmCalculations.Primitives
|
||||
|
||||
public void Save()
|
||||
{
|
||||
repository.Save(this);
|
||||
repository.Create(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Services.ColorServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Collections.Generic;
|
||||
using LoaderCalculator.Data.Ndms.Transformations;
|
||||
using LoaderCalculator.Data.Matrix;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using System;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Forces;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Materials.MaterialBuilders;
|
||||
using LoaderCalculator.Data.Materials;
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.Primitives;
|
||||
using StructureHelper.Models.Materials;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperLogics.NdmCalculations.Primitives;
|
||||
|
||||
namespace StructureHelperLogics.NdmCalculations.Triangulations
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using LoaderCalculator.Data.Ndms;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Strings;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperCommon.Services.Forces;
|
||||
using StructureHelperLogics.Models.Calculations.CalculationProperties;
|
||||
|
||||
Reference in New Issue
Block a user