Change shear calculator add crack export to excel

This commit is contained in:
Evgeny Redikultsev
2025-06-21 21:34:20 +05:00
parent 4fbb3f3658
commit 1ebe1bbcd1
47 changed files with 980 additions and 378 deletions

View File

@@ -13,6 +13,7 @@ namespace DataAccess.DTOs
private IUpdateStrategy<IBeamShearSection> updateStrategy;
private IConvertStrategy<IShape, IShape> shapeConvertStrategy;
private IConvertStrategy<ConcreteLibMaterial, ConcreteLibMaterialDTO> concreteConvertStrategy;
private IConvertStrategy<ReinforcementLibMaterial, ReinforcementLibMaterialDTO> reinforcementConvertStrategy;
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy;
@@ -26,12 +27,17 @@ namespace DataAccess.DTOs
NewItem = new(source.Id);
updateStrategy.Update(NewItem, source);
NewItem.Shape = shapeConvertStrategy.Convert(source.Shape);
if (source.Material is not ConcreteLibMaterialDTO concreteDTO)
if (source.ConcreteMaterial is not ConcreteLibMaterialDTO concreteDTO)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.Material));
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.ConcreteMaterial));
}
NewItem.Material = concreteConvertStrategy.Convert(concreteDTO);
safetyFactorUpdateStrategy.Update(NewItem.Material, concreteDTO);
NewItem.ConcreteMaterial = concreteConvertStrategy.Convert(concreteDTO);
safetyFactorUpdateStrategy.Update(NewItem.ConcreteMaterial, concreteDTO);
if (source.ReinforcementMaterial is not ReinforcementLibMaterialDTO reinforcement)
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source.ReinforcementMaterial));
}
NewItem.ReinforcementMaterial = reinforcementConvertStrategy.Convert(reinforcement);
return NewItem;
}
@@ -45,6 +51,11 @@ namespace DataAccess.DTOs
ReferenceDictionary = ReferenceDictionary,
TraceLogger = TraceLogger
};
reinforcementConvertStrategy = new ReinforcementLibMaterialFromDTOConvertStrategy()
{
ReferenceDictionary = ReferenceDictionary,
TraceLogger = TraceLogger
};
safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorsFromDTOLogic());
}
}

View File

@@ -12,6 +12,7 @@ namespace DataAccess.DTOs
private IUpdateStrategy<IBeamShearSection> updateStrategy;
private IConvertStrategy<IShape, IShape> shapeConvertStrategy;
private IConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy;
private ReinforcementLibMaterialToDTOConvertStrategy reinforcementConvertStrategy;
private IUpdateStrategy<IHelperMaterial> safetyFactorUpdateStrategy;
public BeamShearSectionToDTOConvertStrategy(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary, IShiftTraceLogger traceLogger)
@@ -40,8 +41,10 @@ namespace DataAccess.DTOs
NewItem = new(source.Id);
updateStrategy.Update(NewItem, source);
NewItem.Shape = shapeConvertStrategy.Convert(source.Shape);
NewItem.Material = concreteConvertStrategy.Convert(source.Material);
safetyFactorUpdateStrategy.Update(NewItem.Material, source.Material);
NewItem.ConcreteMaterial = concreteConvertStrategy.Convert(source.ConcreteMaterial);
safetyFactorUpdateStrategy.Update(NewItem.ConcreteMaterial, source.ConcreteMaterial);
NewItem.ReinforcementMaterial = reinforcementConvertStrategy.Convert(source.ReinforcementMaterial);
safetyFactorUpdateStrategy.Update(NewItem.ReinforcementMaterial, source.ReinforcementMaterial);
TraceLogger?.AddMessage($"Beam shear section converting Id = {NewItem.Id} has been finished succesfully", TraceLogStatuses.Debug);
}
@@ -53,6 +56,11 @@ namespace DataAccess.DTOs
concreteConvertStrategy = new ConcreteLibMaterialToDTOConvertStrategy()
{ ReferenceDictionary = ReferenceDictionary,
TraceLogger = TraceLogger};
reinforcementConvertStrategy = new ReinforcementLibMaterialToDTOConvertStrategy()
{
ReferenceDictionary = ReferenceDictionary,
TraceLogger = TraceLogger
};
safetyFactorUpdateStrategy = new HelperMaterialDTOSafetyFactorUpdateStrategy(new MaterialSafetyFactorToDTOLogic());
}
}

View File

@@ -16,10 +16,15 @@ namespace DataAccess.DTOs
public string? Name { get; set; }
[JsonProperty("Shape")]
public IShape Shape { get; set; } = new RectangleShapeDTO(Guid.Empty);
[JsonProperty("Material")]
public IConcreteLibMaterial Material { get; set; }
[JsonProperty("ConcreteMaterial")]
public IConcreteLibMaterial ConcreteMaterial { get; set; }
[JsonProperty("CenterCover")]
public double CenterCover { get; set; }
[JsonProperty("ReinforcementArea")]
public double ReinforcementArea { get; set; }
[JsonProperty("ReinforcementMaterial")]
public IReinforcementLibMaterial ReinforcementMaterial { get; set; }
public BeamShearSectionDTO(Guid id)
{
Id = id;