62 lines
1.6 KiB
C#
62 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using mapper.attributes;
|
|
using appsrv.attributes;
|
|
|
|
namespace sharpwawi.models
|
|
{
|
|
[MappingConstraint(FieldMappingConstraint = MappingConstraints.ANNOTATEDONLY,PropertyMappingConstraint = MappingConstraints.ANNOTATEDONLY)]
|
|
public class Part : Entity
|
|
{
|
|
[MapManyToOne(ForeignField = "Part", SaveRecursive = true)]
|
|
public ISet<PartAssembly> Assemblies { get; private set; } = new HashSet<PartAssembly>();
|
|
|
|
[Mapped]
|
|
public PartAssembly CurrentAssembly;
|
|
|
|
[Mapped]
|
|
public Part ReplacedBy;
|
|
|
|
public String Standards; // Teil entspricht diesen Normen
|
|
public String Dimensions; // Dimensionierung / Abmasse (ggf. gem. Norm)
|
|
|
|
|
|
public Part()
|
|
{
|
|
}
|
|
|
|
public Part(String key,String name)
|
|
:base(key,name)
|
|
{
|
|
}
|
|
|
|
public int HighestAssemblyRevision {
|
|
get {
|
|
int highest = 0;
|
|
foreach (PartAssembly assembly in Assemblies)
|
|
if (assembly.Revision > highest)
|
|
highest = assembly.Revision;
|
|
return highest;
|
|
}
|
|
}
|
|
|
|
[PublishedMember]
|
|
public int Priority;
|
|
|
|
[PublishedMember]
|
|
public double Rank;
|
|
|
|
|
|
public PartAssembly CreateAssembly(){
|
|
PartAssembly assembly = new PartAssembly(this);
|
|
Assemblies.Add(assembly);
|
|
return assembly;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("[{0}] {1}",Key,Name);
|
|
}
|
|
}
|
|
}
|