blob: ff32ba02fb1c8997e155f77df840fb4149b2220e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Tango.BL.Entities
{
public partial class Machine
{
/// <summary>
/// Deletes this entity from the database
/// </summary>
public override void Delete(ObservablesContext context)
{
foreach (var machine_config in MachinesConfigurations)
{
machine_config.Delete(context);
machine_config.Configuration.Delete(context);
}
base.Delete(context);
}
public override void Save(ObservablesContext context)
{
foreach (var job in Jobs)
{
job.JobIndex = Jobs.IndexOf(job);
foreach (var segment in job.Segments)
{
//segment.SegmentIndex = job.Segments.IndexOf(segment);
foreach (var stop in segment.BrushStops)
{
foreach (var prop in typeof(BrushStop).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType == typeof(double)))
{
double value = (double)prop.GetValue(stop);
if (double.IsInfinity(value))
{
prop.SetValue(stop, 0d);
}
}
}
}
}
base.Save(context);
}
}
}
|