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 { /// /// Deletes this entity from the database /// 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); } } }