diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Printing/Job.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Printing/Job.cs | 22 |
1 files changed, 20 insertions, 2 deletions
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. /// </summary> [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 } } |
