ManufacturingPacket.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Linq.Expressions;
  5. using InABox.Core;
  6. namespace Comal.Classes
  7. {
  8. public class ManufacturingPacketArea : IFormula<ManufacturingPacket, object>
  9. {
  10. public Expression<Func<ManufacturingPacket, object>> Value => x => x.Height;
  11. public Expression<Func<ManufacturingPacket, object>>[] Modifiers =>
  12. new Expression<Func<ManufacturingPacket, object>>[] { x => x.Width, x => 0.000001m };
  13. public FormulaOperator Operator => FormulaOperator.Multiply;
  14. public FormulaType Type => FormulaType.Virtual;
  15. }
  16. public class ManufacturingPacketVolume : IFormula<ManufacturingPacket, object>
  17. {
  18. public Expression<Func<ManufacturingPacket, object>> Value => x => x.Height;
  19. public Expression<Func<ManufacturingPacket, object>>[] Modifiers => new Expression<Func<ManufacturingPacket, object>>[]
  20. { x => x.Width, x => x.Length, x => 0.000000001m };
  21. public FormulaOperator Operator => FormulaOperator.Multiply;
  22. public FormulaType Type => FormulaType.Virtual;
  23. }
  24. public class ManufacturingPacketTime : CoreAggregate<ManufacturingPacket, ManufacturingPacketStage, TimeSpan>
  25. {
  26. public override Expression<Func<ManufacturingPacketStage, TimeSpan>> Aggregate => x => x.Time;
  27. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  28. public override Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>> Links =>
  29. new Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>>()
  30. {
  31. { ManufacturingPacketStage => ManufacturingPacketStage.Parent.ID, ManufacturingPacket => ManufacturingPacket.ID }
  32. };
  33. }
  34. public class ManufacturingPacketTimeRemaining : CoreAggregate<ManufacturingPacket, ManufacturingPacketStage, TimeSpan>
  35. {
  36. public override Expression<Func<ManufacturingPacketStage, TimeSpan>> Aggregate => x => x.TimeRemaining;
  37. public Expression<Func<ManufacturingPacketStage, Guid>> Link => x => x.Parent.ID;
  38. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  39. public override Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>> Links =>
  40. new Dictionary<Expression<Func<ManufacturingPacketStage, object>>, Expression<Func<ManufacturingPacket, object>>>()
  41. {
  42. { ManufacturingPacketStage => ManufacturingPacketStage.Parent.ID, ManufacturingPacket => ManufacturingPacket.ID }
  43. };
  44. }
  45. public class ManufacturingPacketActualTime : CoreAggregate<ManufacturingPacket, ManufacturingHistory, TimeSpan>
  46. {
  47. public override Expression<Func<ManufacturingHistory, TimeSpan>> Aggregate => x => x.WorkDuration;
  48. public override AggregateCalculation Calculation => AggregateCalculation.Sum;
  49. public override Dictionary<Expression<Func<ManufacturingHistory, object>>, Expression<Func<ManufacturingPacket, object>>> Links =>
  50. new Dictionary<Expression<Func<ManufacturingHistory, object>>, Expression<Func<ManufacturingPacket, object>>>()
  51. {
  52. { ManufacturingHistory => ManufacturingHistory.Packet.ID, ManufacturingPacket => ManufacturingPacket.ID }
  53. };
  54. }
  55. [UserTracking("Manufacturing")]
  56. [Caption("Manufacturing")]
  57. public class ManufacturingPacket : Entity, IPersistent, IRemotable, IOneToMany<Setout>, ILicense<ManufacturingLicense>, IIssues, IProblems<ManagedProblem>
  58. {
  59. [TextBoxEditor]
  60. [EditorSequence(1)]
  61. public string Title { get; set; }
  62. [CodeEditor(Visible = Visible.Default, Editable = Editable.Enabled)]
  63. [EditorSequence(2)]
  64. public string Serial { get; set; }
  65. private class SetoutLookup : LookupDefinitionGenerator<Setout, ManufacturingPacket>
  66. {
  67. public override Filter<Setout> DefineFilter(ManufacturingPacket[] items)
  68. {
  69. return new Filter<Setout>(x => x.JobLink.ID).IsEqualTo(items.First().SetoutLink.JobLink.ID);
  70. }
  71. public override Columns<ManufacturingPacket> DefineFilterColumns()
  72. => Columns.None<ManufacturingPacket>().Add(x => x.SetoutLink.JobLink.ID);
  73. }
  74. [LookupDefinition(typeof(SetoutLookup))]
  75. [EditorSequence(3)]
  76. [EntityRelationship(DeleteAction.Cascade)]
  77. public SetoutLink SetoutLink { get; set; }
  78. private class JobITPLookup : LookupDefinitionGenerator<JobITP, ManufacturingPacket>
  79. {
  80. public override Filter<JobITP> DefineFilter(ManufacturingPacket[] items)
  81. {
  82. if (items.Length == 1)
  83. return new Filter<JobITP>(x => x.Job.ID).IsEqualTo(items.First().SetoutLink.JobLink.ID);
  84. return LookupFactory.DefineFilter<JobITP>();
  85. }
  86. public override Columns<ManufacturingPacket> DefineFilterColumns()
  87. => Columns.None<ManufacturingPacket>().Add(x => x.SetoutLink.JobLink.ID);
  88. }
  89. [EditorSequence(4)]
  90. [LookupDefinition(typeof(JobITPLookup))]
  91. public JobITPLink ITP { get; set; }
  92. [TextBoxEditor]
  93. [EditorSequence(5)]
  94. public string Location { get; set; }
  95. // Used to calculate time & materials
  96. [EditorSequence(7)]
  97. [IntegerEditor]
  98. public int Quantity { get; set; }
  99. [EditorSequence(8)]
  100. [IntegerEditor]
  101. // Determines # of barcodes to print
  102. public int BarcodeQty { get; set; }
  103. [EditorSequence(9)]
  104. [TimestampEditor(Editable = Editable.Hidden)]
  105. public override DateTime Created
  106. {
  107. get => base.Created;
  108. set => base.Created = value;
  109. }
  110. [EditorSequence(10)]
  111. [DateTimeEditor]
  112. public DateTime DueDate { get; set; }
  113. [EditorSequence("Design", 101)]
  114. [EntityRelationship(DeleteAction.Cascade)]
  115. public PDFDocumentLink Drawing { get; set; }
  116. // To be overlaid over the PDF document
  117. [EditorSequence("Design", 102)]
  118. [TextBoxEditor]
  119. public string WaterMark { get; set; }
  120. [EditorSequence("Design", 103)]
  121. public double Height { get; set; }
  122. [EditorSequence("Design", 104)]
  123. public double Width { get; set; }
  124. [EditorSequence("Design", 105)]
  125. public double Length { get; set; }
  126. [EditorSequence("Manufacturing", 200)]
  127. public ManufacturingTemplateLink ManufacturingTemplateLink { get; set; }
  128. [EditorSequence("Manufacturing", 201)]
  129. [TimestampEditor(Editable = Editable.Disabled)]
  130. public DateTime Issued { get; set; }
  131. [EditorSequence("Manufacturing", 202)]
  132. [LoggableProperty]
  133. public bool Priority { get; set; }
  134. [EditorSequence("Manufacturing", 203)]
  135. [LoggableProperty]
  136. public bool Distributed { get; set; }
  137. [EditorSequence("Manufacturing", 204)]
  138. [TextBoxEditor(Editable = Editable.Disabled)]
  139. public string Trolleys { get; set; }
  140. [EditorSequence("Manufacturing", 205)]
  141. [TimestampEditor(Editable = Editable.Hidden)]
  142. public DateTime BarcodePrinted { get; set; }
  143. [EditorSequence("Manufacturing", 206)]
  144. [DateTimeEditor(Editable = Editable.Disabled)]
  145. [SecondaryIndex]
  146. public DateTime Completed { get; set; }
  147. [SecondaryIndex]
  148. [TimestampEditor]
  149. [EditorSequence("Manufacturing", 207)]
  150. public DateTime Archived { get; set; } = DateTime.MinValue;
  151. [NullEditor]
  152. [Obsolete("Replaced with Problem", true)]
  153. public string Issues { get; set; }
  154. [EditorSequence("Issues", 1)]
  155. public ManagedProblem Problem { get; set; }
  156. [CheckBoxEditor]
  157. [EditorSequence("Issues", 2)]
  158. [LoggableProperty]
  159. public bool OnHold { get; set; }
  160. public override string ToString()
  161. {
  162. return string.Format("{0} {1}", SetoutLink.Number, Serial);
  163. }
  164. public static void Progress(IEnumerable<ManufacturingPacket> packets, ManufacturingPacketStage[] Stages)
  165. {
  166. //List<ManufacturingPacketStage> updates = new List<ManufacturingPacketStage>();
  167. foreach (var packet in packets.Where(x => !x.StageLink.Equals(CoreUtils.FullGuid)))
  168. {
  169. var stages = Stages.Where(x => x.Parent.ID.Equals(packet.ID));
  170. long sequence = 0;
  171. var stage = stages.FirstOrDefault(x => x.ID.Equals(packet.StageLink.ID));
  172. if (stage != null)
  173. {
  174. stage.Completed = DateTime.Now;
  175. stage.PercentageComplete = 100.0F;
  176. sequence = stage.Sequence;
  177. }
  178. // Update the pointer to the next stage
  179. stage = stages.Where(x => x.Sequence > sequence).FirstOrDefault();
  180. if (stage != null)
  181. {
  182. stage.QualityStatus = QualityStatus.NotChecked;
  183. stage.QualityNotes = "";
  184. stage.Station = 0;
  185. stage.Started = DateTime.MinValue;
  186. stage.Completed = DateTime.MinValue;
  187. stage.PercentageComplete = 0.0F;
  188. packet.StageLink.ID = stage.ID;
  189. packet.StageLink.Synchronise(stage);
  190. }
  191. else
  192. {
  193. packet.StageLink.ID = CoreUtils.FullGuid;
  194. }
  195. packet.Issued = !packet.StageLink.IsValid() ? DateTime.MinValue : packet.Issued.IsEmpty() ? DateTime.Now : packet.Issued;
  196. packet.Completed = packet.StageLink.ID.Equals(CoreUtils.FullGuid)
  197. ? packet.Completed.IsEmpty() ? DateTime.Now : packet.Completed
  198. : DateTime.MinValue;
  199. }
  200. }
  201. public static void Regress(IEnumerable<ManufacturingPacket> pkts, ManufacturingPacketStage[] stgs)
  202. {
  203. foreach(var packet in pkts)
  204. {
  205. var stages = stgs.Where(x => x.Parent.ID.Equals(packet.ID));
  206. var sequence = long.MaxValue;
  207. var stage = stages.FirstOrDefault(x => x.ID.Equals(packet.StageLink.ID));
  208. if (stage != null)
  209. {
  210. stage.Completed = DateTime.MinValue;
  211. stage.PercentageComplete = 0.0F;
  212. stage.QualityStatus = QualityStatus.NotChecked;
  213. stage.QualityNotes = "";
  214. sequence = stage.Sequence;
  215. }
  216. // Update the pointer to the previous stage
  217. stage = stages.Where(x => x.Sequence < sequence).LastOrDefault();
  218. if (stage != null)
  219. {
  220. stage.QualityStatus = QualityStatus.NotChecked;
  221. stage.QualityNotes = "";
  222. stage.Station = 0;
  223. stage.Started = DateTime.MinValue;
  224. stage.Completed = DateTime.MinValue;
  225. stage.PercentageComplete = 0.0F;
  226. }
  227. packet.StageLink.ID = stage == null ? Guid.Empty : stage.ID;
  228. packet.Issued = !packet.StageLink.IsValid() ? DateTime.MinValue : packet.Issued.IsEmpty() ? DateTime.Now : packet.Issued;
  229. packet.DueDate = packet.Issued.IsEmpty() ? DateTime.MinValue : packet.DueDate;
  230. packet.Completed = packet.StageLink.ID.Equals(CoreUtils.FullGuid)
  231. ? packet.Completed.IsEmpty() ? DateTime.Now : packet.Completed
  232. : DateTime.MinValue;
  233. }
  234. }
  235. #region Aggregates
  236. [EditorSequence(300)]
  237. [DoubleEditor(Editable = Editable.Hidden)]
  238. [Formula(typeof(ManufacturingPacketArea))]
  239. public double Area { get; set; }
  240. [EditorSequence(301)]
  241. [DoubleEditor(Editable = Editable.Hidden)]
  242. [Formula(typeof(ManufacturingPacketVolume))]
  243. public double Volume { get; set; }
  244. [EditorSequence(302)]
  245. [Aggregate(typeof(ManufacturingPacketTime))]
  246. public TimeSpan Time { get; set; }
  247. [EditorSequence(303)]
  248. [Aggregate(typeof(ManufacturingPacketTimeRemaining))]
  249. public TimeSpan TimeRemaining { get; set; }
  250. [EditorSequence(304)]
  251. [Aggregate(typeof(ManufacturingPacketActualTime))]
  252. public TimeSpan ActualTime { get; set; }
  253. #endregion
  254. #region Internal / NullEditor Properties
  255. private class ManufacturingPacketStageLookup : LookupDefinitionGenerator<ManufacturingPacketStage, ManufacturingPacket>
  256. {
  257. public override Filter<ManufacturingPacketStage>? DefineFilter(ManufacturingPacket[] items)
  258. {
  259. if (items.Any())
  260. return new Filter<ManufacturingPacketStage>(x => x.Parent.ID).IsEqualTo(items.First().ID);
  261. return null;
  262. }
  263. public override Columns<ManufacturingPacket> DefineFilterColumns()
  264. => Columns.None<ManufacturingPacket>().Add(x => x.ID);
  265. }
  266. [LookupDefinition(typeof(ManufacturingPacketStageLookup))]
  267. [NullEditor]
  268. public ManufacturingPacketStageLink StageLink { get; set; }
  269. [NullEditor]
  270. public QAFormLink QAForm { get; set; }
  271. // I think ITPs will end up being linked to a stage,
  272. // So this might get obsoleted at some point
  273. private class JobStageLookup : LookupDefinitionGenerator<JobStage, ManufacturingPacket>
  274. {
  275. public override Filter<JobStage> DefineFilter(ManufacturingPacket[] items)
  276. {
  277. if (items.Length == 1)
  278. return new Filter<JobStage>(x => x.Job.ID).IsEqualTo(items.First().SetoutLink.JobLink.ID).And(x => x.IsHeader).IsEqualTo(false);
  279. return new Filter<JobStage>(x => x.ID).IsEqualTo(Guid.Empty);
  280. }
  281. public override Columns<ManufacturingPacket> DefineFilterColumns()
  282. => Columns.None<ManufacturingPacket>().Add(x => x.SetoutLink.JobLink.ID);
  283. }
  284. [LookupDefinition(typeof(JobStageLookup))]
  285. [NullEditor]
  286. public JobStageLink JobStage { get; set; }
  287. [NullEditor]
  288. [EntityRelationship(DeleteAction.SetNull)]
  289. public PurchaseOrderItemLink OrderItem { get; set; }
  290. [NullEditor]
  291. public DateTime EstimatedDate { get; set; }
  292. #endregion
  293. #region Obsolete Properties
  294. // The code of the Linked Manufacturing Template
  295. // Suggested - set to obsolete?
  296. [NullEditor]
  297. [Obsolete("Replaced with ManufacturingTemplateLink.Code", true)]
  298. public string Code { get; set; }
  299. // The Factory to which this packet template belongs
  300. // Suggestion - Set to obsolete?
  301. [NullEditor]
  302. [Obsolete("Replaced with ManufacturingTemplateLink.FactoryLink.ID")]
  303. public string Group { get; set; }
  304. [NullEditor]
  305. [Obsolete("Replaced with BarcodeQty")]
  306. public bool GroupedBarcode { get; set; }
  307. private BarcodeType _barcodetype = BarcodeType.Unspecified;
  308. [NullEditor]
  309. [Obsolete("Replaced with BarcodeQty")]
  310. public BarcodeType BarcodeType
  311. {
  312. get => _barcodetype == BarcodeType.Unspecified ? GroupedBarcode ? BarcodeType.Grouped : BarcodeType.Individual : _barcodetype;
  313. set => _barcodetype = value;
  314. }
  315. // Comes from Setout.Title (Should be Reference)
  316. [NullEditor]
  317. [Obsolete("Replaced with SetoutLink.Reference")]
  318. public string Reference { get; set; }
  319. // Comes from Setout.Location
  320. [NullEditor]
  321. [Obsolete("Replaced with SetoutLink.Description")]
  322. public string Description { get; set; }
  323. [Obsolete("Replaced With ManufacturingTemplateLink")]
  324. [NullEditor]
  325. public Guid ManufacturingItemID { get; set; }
  326. [NullEditor]
  327. [Obsolete("Replaced with ManufacturingPacketLink.Code")]
  328. public string Template { get; set; }
  329. [Obsolete("Replaced With SetoutLink.JobLink")]
  330. [EntityRelationship(DeleteAction.Cascade)]
  331. [NullEditor]
  332. public JobLink JobLink { get; set; }
  333. #endregion
  334. #region Functions
  335. //public void MovePrevious()
  336. //{
  337. // bool bFound = false;
  338. // SetoutStage prev = null;
  339. // foreach (SetoutStage stage in Stages)
  340. // {
  341. // if (bFound)
  342. // {
  343. // stage.Started = DateTime.MinValue;
  344. // stage.Completed = DateTime.MinValue;
  345. // stage.PercentageComplete = 0.0F;
  346. // }
  347. // else if (stage.Completed.IsEmpty())
  348. // {
  349. // stage.Started = DateTime.MinValue;
  350. // stage.Completed = DateTime.MinValue;
  351. // stage.PercentageComplete = 0.0F;
  352. // bFound = true;
  353. // if (prev != null)
  354. // prev.Completed = DateTime.MinValue;
  355. // }
  356. // else
  357. // prev = stage;
  358. // }
  359. // if (prev == null)
  360. // Issued = DateTime.MinValue;
  361. // Completed = DateTime.MinValue;
  362. // Stage = CurrentStage();
  363. //}
  364. //public void MoveNext()
  365. //{
  366. // bool bFound = false;
  367. // bool bComplete = true;
  368. // if (Issued.IsEmpty())
  369. // Issued = DateTime.Now;
  370. // foreach (SetoutStage stage in Stages)
  371. // {
  372. // if (bFound)
  373. // {
  374. // stage.Started = DateTime.MinValue;
  375. // stage.Completed = DateTime.MinValue;
  376. // stage.PercentageComplete = 0.0F;
  377. // bComplete = false;
  378. // }
  379. // else if (stage.Started.IsEmpty())
  380. // {
  381. // //stage.Started = DateTime.Now;
  382. // stage.Completed = DateTime.MinValue;
  383. // stage.PercentageComplete = 0.0F;
  384. // bComplete = false;
  385. // bFound = true;
  386. // }
  387. // else if (stage.Completed.IsEmpty())
  388. // {
  389. // stage.Completed = DateTime.Now;
  390. // stage.PercentageComplete = 100.0F;
  391. // bFound = true;
  392. // }
  393. // }
  394. // //Completed = bComplete ? DateTime.Now : DateTime.MinValue;
  395. // bool bIsComplete = !Stages.Any(x => x.Completed.Equals(DateTime.MinValue));
  396. // if (bIsComplete && Completed.Equals(DateTime.MinValue))
  397. // Completed = DateTime.Now;
  398. // Stage = CurrentStage();
  399. //}
  400. //public Boolean IsComplete()
  401. //{
  402. // if ((!Issued.IsEmpty()) && (Stages != null))
  403. // {
  404. // foreach (SetoutStage stage in Stages)
  405. // {
  406. // if (stage.Completed.IsEmpty())
  407. // return false;
  408. // }
  409. // return true;
  410. // }
  411. // return false;
  412. //}
  413. //public String Status()
  414. //{
  415. // if ((Stages == null) || (!Stages.Any()))
  416. // return "No Template!";
  417. // if (Issued.IsEmpty())
  418. // return "To Be Issued";
  419. // var stage = GetCurrentStage();
  420. // if (stage != null)
  421. // {
  422. // if (!Archived.IsEmpty())
  423. // return "Cancelled";
  424. // else
  425. // return String.Format("{0} ({1:F2}%)", stage.Name, stage.PercentageComplete);
  426. // }
  427. // return "Complete";
  428. //}
  429. //public Guid CurrentStage()
  430. //{
  431. // if (Issued.IsEmpty())
  432. // return Guid.Empty;
  433. // SetoutStage stage = GetCurrentStage();
  434. // if (stage != null)
  435. // return stage.SectionID;
  436. // return CoreUtils.FullGuid;
  437. //}
  438. //public SetoutStage GetCurrentStage()
  439. //{
  440. // if ((!Issued.IsEmpty()) && (Stages != null))
  441. // {
  442. // foreach (SetoutStage stage in Stages)
  443. // {
  444. // if (stage.Completed.IsEmpty())
  445. // return stage;
  446. // }
  447. // }
  448. // return null;
  449. //}
  450. //public void SetStage(Guid id, bool complete = false)
  451. //{
  452. // bool bFound = id == Guid.Empty;
  453. // Issued = (id == Guid.Empty) ? DateTime.MinValue : Issued.IsEmpty() ? DateTime.Now : Issued;
  454. // if (id == CoreUtils.FullGuid)
  455. // {
  456. // foreach (SetoutStage stage in Stages)
  457. // {
  458. // stage.Started = stage.Started.IsEmpty() ? DateTime.Now : stage.Started;
  459. // stage.Completed = stage.Completed.IsEmpty() ? DateTime.Now : stage.Completed;
  460. // stage.PercentageComplete = 100.0F;
  461. // Completed = stage.Completed;
  462. // }
  463. // }
  464. // else
  465. // {
  466. // //Completed = DateTime.MinValue;
  467. // foreach (SetoutStage stage in Stages)
  468. // {
  469. // if (stage.SectionID.Equals(id))
  470. // {
  471. // bFound = true;
  472. // //stage.Started = stage.Started.IsEmpty() ? DateTime.Now : stage.Started;
  473. // stage.Completed = complete ? DateTime.Now : DateTime.MinValue;
  474. // stage.PercentageComplete = stage.Completed.IsEmpty() ? 0.0F : 100.0F;
  475. // }
  476. // else
  477. // {
  478. // if (!bFound)
  479. // {
  480. // // Stages Before this stage - Update Started and Completed if Empty
  481. // if (stage.Started.IsEmpty())
  482. // stage.Started = DateTime.Now;
  483. // if (stage.Completed.IsEmpty())
  484. // stage.Completed = DateTime.Now;
  485. // stage.PercentageComplete = 100.0F;
  486. // }
  487. // else
  488. // {
  489. // // Stages After This Stage - Blank out Started and Completed
  490. // stage.Started = DateTime.MinValue;
  491. // stage.Completed = DateTime.MinValue;
  492. // stage.PercentageComplete = 0.0F;
  493. // }
  494. // }
  495. // }
  496. // }
  497. // bool bIsComplete = !Stages.Any(x => x.Completed.Equals(DateTime.MinValue));
  498. // if (bIsComplete && Completed.Equals(DateTime.MinValue))
  499. // Completed = DateTime.Now;
  500. // Stage = CurrentStage();
  501. //}
  502. #endregion
  503. }
  504. }