private bool Cancel() { if (m_item == null) { return(true); } // Validate the item is still at this station before saving the results. Scout.Core.Data.GetUnitOfWork().DropIdentityMap(); InventoryItem compareItem = Scout.Core.Service <IInventoryService>().GetItemBySN(Scout.Core.Data.GetUnitOfWork(), m_item.SerialNumber); if (compareItem == null || compareItem.CurrentProcess == null || compareItem.CurrentProcess.Id != m_process.Id) { Scout.Core.UserInteraction.Dialog.ShowMessage( "This unit is no longer at this station. Please close and re-open the form.", UserMessageType.Error); return(true); } /////----> if (m_process.ValidRequiredFields() && m_process.StationOutcome == null) { return (MessageBox.Show( "All required fields have been populated, but a station outcome is missing. " + Environment.NewLine + "Are you sure you want to save?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes); } if (m_process.Station.AllowRepairs && m_process.HasOpenFailures()) { return (MessageBox.Show( "There are failures that do not have repairs." + Environment.NewLine + "Are you sure you want to continue?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes); } return(false); }
public override void GetError() { if (m_transition.ForceFailure && m_process.Failures.Count == 0) { m_error = "This station requires at least one failure to be recorded"; return; } if (m_transition.ForceFailClosure && m_process.HasOpenFailures()) { m_error = "This outcome requires all failures to be closed."; return; } if (m_transition.ForceFailure && m_process.Failures.Count == 0) { m_error = "This outcome requires at least one failure to be recorded."; return; } }