sharp-wawi/models/Part.cs

38 lines
1010 B
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-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-07-30 17:55:15 +02:00
public ISet<Assembly> Assemblies { get; private set; } = new HashSet<Assembly>();
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;
foreach (Assembly assembly in Assemblies)
if (assembly.Revision > highest)
highest = assembly.Revision;
return highest;
}
}
public Assembly CreateAssembly(){
Assembly assembly = new Assembly(this);
Assemblies.Add(assembly);
return assembly;
2018-07-30 09:23:18 +02:00
}
2018-07-30 17:55:15 +02:00
2018-07-26 16:55:41 +02:00
}
}