示例#1
0
        public static TimeOfDayResolutionResult ParseTimeOfDay(string tod)
        {
            var result = new TimeOfDayResolutionResult();

            switch (tod)
            {
            case Constants.EarlyMorning:
                result.Timex     = Constants.EarlyMorning;
                result.BeginHour = 4;
                result.EndHour   = 8;
                break;

            case Constants.Morning:
                result.Timex     = Constants.Morning;
                result.BeginHour = 8;
                result.EndHour   = 12;
                break;

            case Constants.MidDay:
                result.Timex     = Constants.MidDay;
                result.BeginHour = 11;
                result.EndHour   = 13;
                break;

            case Constants.Afternoon:
                result.Timex     = Constants.Afternoon;
                result.BeginHour = 12;
                result.EndHour   = 16;
                break;

            case Constants.Evening:
                result.Timex     = Constants.Evening;
                result.BeginHour = 16;
                result.EndHour   = 20;
                break;

            case Constants.Daytime:
                result.Timex     = Constants.Daytime;
                result.BeginHour = 8;
                result.EndHour   = 18;
                break;

            case Constants.BusinessHour:
                result.Timex     = Constants.BusinessHour;
                result.BeginHour = 8;
                result.EndHour   = 18;
                break;

            case Constants.Night:
                result.Timex     = Constants.Night;
                result.BeginHour = 20;
                result.EndHour   = 23;
                result.EndMin    = 59;
                break;

            case Constants.MealtimeBreakfast:
                result.Timex     = Constants.MealtimeBreakfast;
                result.BeginHour = 8;
                result.EndHour   = 12;
                break;

            case Constants.MealtimeBrunch:
                result.Timex     = Constants.MealtimeBrunch;
                result.BeginHour = 8;
                result.EndHour   = 12;
                break;

            case Constants.MealtimeLunch:
                result.Timex     = Constants.MealtimeLunch;
                result.BeginHour = 11;
                result.EndHour   = 13;
                break;

            case Constants.MealtimeDinner:
                result.Timex     = Constants.MealtimeDinner;
                result.BeginHour = 16;
                result.EndHour   = 20;
                break;

            default:
                break;
            }

            return(result);
        }