diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-18 18:48:16 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-18 18:48:16 +0200 |
| commit | 95b4e14bc4e06ffb94199f5ec4e0d2d9bebceeff (patch) | |
| tree | de29ed87bd7c7b966d35b6f6bc8b13d65313c88c /Software/Visual_Studio/Tango.Integration/Printing/Job.cs | |
| parent | 99136fc92c8b75c3783f543051c065c28961d393 (diff) | |
| download | Tango-95b4e14bc4e06ffb94199f5ec4e0d2d9bebceeff.tar.gz Tango-95b4e14bc4e06ffb94199f5ec4e0d2d9bebceeff.zip | |
Working on new developer module.
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 } } |
