ManufacturingPacket.cs 23 KB

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