Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public enum TimeframeType {
- None = 0,
- [Description("1 month")]
- Now = 30,
- [Description("1-3 months")]
- Short = 90,
- [Description("3-6 months")]
- Medium = 180,
- [Description("6+ months")]
- Long = 360
- }
- public static T EnumNext<T>(T value) where T : struct {
- T[] values = (T[])Enum.GetValues(typeof(T));
- int i;
- for (i = 0; i < values.Length; i++) {
- if (object.Equals(value, values[i])) {
- break;
- }
- }
- if (i >= values.Length - 1) {
- return values[values.Length - 1];
- } else {
- return values[i + 1];
- }
- }
- public class TimeFrame: IComparable
- {
- private int days;
- public int Days
- {
- set
- {
- days = value;
- }
- }
- public int CompareTo(object other)
- {
- //see this for implementation -- http://msdn.microsoft.com/en-us/library/system.icomparable.aspx#Mtps_DropDownFilterText
- }
- public string Description
- {
- get code to return the description string , ie "1-3 months"
- }
- }
- public enum TimeframeType {
- None = 0,
- [Description("1 month")]
- TimeFrameStep = 30,
- [Description("Step from previous to next")]
- Now = None + TimeFrameStep,
- [Description("1-3 months")]
- Short = Now + TimeFrameStep,
- [Description("3-6 months")]
- Medium = Now + TimeFrameStep,
- [Description("6+ months")]
- Long = Medium + TimeFrameStep,
- [Description("12 months")]
- }
Add Comment
Please, Sign In to add comment