From 95b4e14bc4e06ffb94199f5ec4e0d2d9bebceeff Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 18 Feb 2018 18:48:16 +0200 Subject: Working on new developer module. --- .../Tango.Integration/Printing/Job.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/Tango.Integration/Printing/Job.cs') diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs index 1b479b5b9..1cc4865f2 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs @@ -1,4 +1,5 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; @@ -36,6 +37,7 @@ namespace Tango.Integration.Observables /// Gets the total job segments length. /// [NotMapped] + [JsonIgnore] public double Length { get { return Segments.Sum(x => x.Length) + (EnableInterSegment ? (InterSegmentLength * (Segments.Count > 0 ? Segments.Count - 1 : Segments.Count)) : 0); } @@ -133,8 +135,24 @@ namespace Tango.Integration.Observables base.Save(); } - #endregion + public override Job Clone() + { + Job cloned = base.Clone(); + + cloned.CreationDate = DateTime.UtcNow; + cloned.LastRun = null; + cloned.Segments = Segments.Select(x => x.Clone(cloned)).ToObservableCollection(); + + return cloned; + } + public override void DefferedDelete() + { + Segments.ToList().ForEach(x => x.DefferedDelete()); + Segments.Clear(); + base.DefferedDelete(); + } + #endregion } } -- cgit v1.3.1