public void Commit(ExecutorStatus Status, DateTime EndTime, String Description = "") //Need to check the Executor Status to make sure it is executing { if (Status != ExecutorStatus.Completed && Status != ExecutorStatus.Invalid) { System.Windows.MessageBox.Show("Only Completed and Invalid are available status to be commited"); return; } if (this.Status == ExecutorStatus.Executing) { this.Description = Description; this.EndTime = EndTime; if (Chamber != null) { Chamber.Status = AssetStatusEnum.IDLE; Chamber.UpdateRecords(StartTime, Chamber.Status); } TesterChannel.Status = AssetStatusEnum.IDLE; TesterChannel.UpdateRecords(StartTime, TesterChannel.Status); Battery.Status = AssetStatusEnum.IDLE; Battery.UpdateRecords(StartTime, Battery.Status); this.Status = Status; //this has to be the last assignment because it will raise StatusChanged event so that duration will be updated using StartTime and EndTime } else { System.Windows.MessageBox.Show("Only executing tasks can be commited!"); } }
public void Execute(DateTime StartTime) { if (this.Status == ExecutorStatus.Ready) { this.StartTime = StartTime; Battery.Status = AssetStatusEnum.USING; Battery.UpdateRecords(StartTime, Battery.Status); if (Chamber != null) { Chamber.Status = AssetStatusEnum.USING; Chamber.UpdateRecords(StartTime, Chamber.Status); } TesterChannel.Status = AssetStatusEnum.USING; TesterChannel.UpdateRecords(StartTime, TesterChannel.Status); this.Status = ExecutorStatus.Executing; } else { System.Windows.MessageBox.Show("Only ready tasks can be executed!"); } }