/// <summary> /// Method used to move status values through their logical progression, and /// override less severe failures with more severe ones. This value is /// compared with the parameter and the one that has higher priority is /// returned. If both are STARTED or less than the value returned is the /// largest in the sequence STARTING, STARTED, COMPLETED. Otherwise the value /// returned is the maximum of the two. /// </summary> /// <param name="other"> other another status to compare to </param> /// <returns> either this or the other status depending on their priority </returns> public BatchStatus UpgradeTo(BatchStatus other) { if (IsGreaterThan(Started) || other.IsGreaterThan(Started)) { return(Max(this, other)); } // Both less than or equal to STARTED if (this == Completed || other == Completed) { return(Completed); } return(Max(this, other)); }
/// <summary> /// Method used to move status values through their logical progression, and /// override less severe failures with more severe ones. This value is /// compared with the parameter and the one that has higher priority is /// returned. If both are STARTED or less than the value returned is the /// largest in the sequence STARTING, STARTED, COMPLETED. Otherwise the value /// returned is the maximum of the two. /// </summary> /// <param name="other"> other another status to compare to </param> /// <returns> either this or the other status depending on their priority </returns> public BatchStatus UpgradeTo(BatchStatus other) { if (IsGreaterThan(Started) || other.IsGreaterThan(Started)) { return Max(this, other); } // Both less than or equal to STARTED if (this == Completed || other == Completed) { return Completed; } return Max(this, other); }
/// <summary> /// return max BatchStatus from 2 /// </summary> /// <param name="status1"></param> /// <param name="status2"></param> /// <returns></returns> public static BatchStatus Max(BatchStatus status1, BatchStatus status2) { return(status1.IsGreaterThan(status2) ? status1 : status2); }
/// <summary> /// return max BatchStatus from 2 /// </summary> /// <param name="status1"></param> /// <param name="status2"></param> /// <returns></returns> public static BatchStatus Max(BatchStatus status1, BatchStatus status2) { return status1.IsGreaterThan(status2) ? status1 : status2; }