Created
November 4, 2014 14:48
-
-
Save buchmoyerm/4c16708cc7ec2e58c5f7 to your computer and use it in GitHub Desktop.
enum example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace QuoteFeed.OMS.Data | |
{ | |
public abstract class OrderResult | |
{ | |
public abstract string ResultString(); | |
public static readonly OrderResult Success = new SuccessResult(); | |
public static readonly OrderResult DuplicateId = new DupliceIdResult(); | |
public static readonly OrderResult InvalidRoute = new InvalidRouteResult(); | |
public static readonly OrderResult InvalidOrderType = new InvalidOrderTypeResult(); | |
public static readonly OrderResult RouteNotConnected = new RouteNotConnectedResult(); | |
public static readonly OrderResult InvalidDataInOrder = new InvalidDataInOrderResult(); | |
public static readonly OrderResult InvalidSecurity = new InvalidSecurityResult(); | |
private class SuccessResult : OrderResult | |
{ | |
public override string ResultString() { return "Success"; } | |
} | |
private class DupliceIdResult : OrderResult | |
{ | |
public override string ResultString() { return "Order with same LocalId already exists"; } | |
} | |
private class InvalidRouteResult : OrderResult | |
{ | |
public override string ResultString() { return "Invalid Route"; } | |
} | |
private class RouteNotConnectedResult : OrderResult | |
{ | |
public override string ResultString() { return "Route not connected"; } | |
} | |
private class InvalidOrderTypeResult : OrderResult | |
{ | |
public override string ResultString() { return "Invalid order type for route"; } | |
} | |
private class InvalidDataInOrderResult : OrderResult | |
{ | |
public override string ResultString() { return "Invalid data in order"; } | |
} | |
private class InvalidSecurityResult : OrderResult | |
{ | |
public override string ResultString() { return "Invalid security"; } | |
} | |
} | |
} | |
//using example | |
//OrderResult result = SendNewOrder(new TestOrder()); | |
//if (result != OrderResult.Success) return; //failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment