private void FixupMaterial(Material previousValue) { if (previousValue != null && previousValue.MaterialStocks.Contains(this)) { previousValue.MaterialStocks.Remove(this); } if (Material != null) { if (!Material.MaterialStocks.Contains(this)) { Material.MaterialStocks.Add(this); } if (Material_Id != Material.Id) { Material_Id = Material.Id; } } else if (!_settingFK) { Material_Id = null; } }
public static Material GetEntity(this MaterialPrimitive primitive) { Material result = new Material(); result.Id = primitive.Id; result.Name = primitive.Name; result.Producer_Id = primitive.Producer_Id; result.Deliverer_Id = primitive.Deliverer_Id; result.InternalName = primitive.InternalName; result.Deleted = primitive.Deleted; result.Deactivated = primitive.Deactivated; result.MaterialType = primitive.MaterialType; return result; }