sharp-wawi/models/Part.cs

61 lines
1.5 KiB
C#
Raw Normal View History

2018-07-26 16:55:41 +02:00
using System;
2018-07-30 17:55:15 +02:00
using System.Collections.Generic;
2018-08-01 23:33:10 +02:00
using mapper.attributes;
2018-09-07 16:59:17 +02:00
using appsrv.attributes;
2018-08-02 16:50:46 +02:00
2018-07-26 16:55:41 +02:00
namespace sharpwawi.models
{
2018-08-01 23:33:10 +02:00
[MappingConstraint(FieldMappingConstraint = MappingConstraints.ANNOTATEDONLY,PropertyMappingConstraint = MappingConstraints.ANNOTATEDONLY)]
2018-07-26 16:55:41 +02:00
public class Part : Entity
{
2018-09-12 21:29:58 +02:00
public ISet<PartAssembly> Assemblies { get; private set; } = new HashSet<PartAssembly>();
2018-07-26 16:55:41 +02:00
2018-08-02 16:50:46 +02:00
[Mapped]
2018-09-12 21:29:58 +02:00
public PartAssembly CurrentAssembly;
2018-08-02 16:50:46 +02:00
[Mapped]
public Part ReplacedBy;
2018-09-12 21:29:58 +02:00
public String Standards; // Teil entspricht diesen Normen
public String Dimensions; // Dimensionierung / Abmasse (ggf. gem. Norm)
2018-07-26 16:55:41 +02:00
public Part()
{
}
2018-07-30 09:23:18 +02:00
2018-07-30 17:55:15 +02:00
public Part(String key,String name)
:base(key,name)
2018-07-30 09:23:18 +02:00
{
}
2018-07-30 17:55:15 +02:00
public int HighestAssemblyRevision {
get {
int highest = 0;
2018-09-12 21:29:58 +02:00
foreach (PartAssembly assembly in Assemblies)
2018-07-30 17:55:15 +02:00
if (assembly.Revision > highest)
highest = assembly.Revision;
return highest;
}
}
2018-09-07 16:59:17 +02:00
[PublishedMember]
2018-09-12 21:29:58 +02:00
public int Priority;
2018-09-07 16:59:17 +02:00
[PublishedMember]
2018-09-12 21:29:58 +02:00
public double Rank;
2018-09-07 16:59:17 +02:00
2018-09-12 21:29:58 +02:00
public PartAssembly CreateAssembly(){
PartAssembly assembly = new PartAssembly(this);
2018-07-30 17:55:15 +02:00
Assemblies.Add(assembly);
return assembly;
2018-07-30 09:23:18 +02:00
}
2018-07-30 17:55:15 +02:00
2018-09-07 16:59:17 +02:00
public override string ToString()
{
return String.Format("[{0}] {1}",Key,Name);
}
2018-07-26 16:55:41 +02:00
}
}