/// <summary>
        /// Gets the timezones.
        /// </summary>
        public SelectList GetAndSetSelectedTimezone(Timezone selectedTimezone = null)
        {
            var id = -1;

            if (selectedTimezone != null)
            {
                id = selectedTimezone.Id;
            }

            var zones = GetTimezones();
            return new SelectList(zones, "Id", "Name", id);
        }
示例#2
0
        /// <summary>
        /// Converts Messages to BoardMessage.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="timezone">The timezone.</param>
        /// <returns>BoardMessage.</returns>
        private BoardMessage ConvertToBoardMessage(Message message, Timezone timezone)
        {
            string number = string.Format("{0:(###) ###-####}", Convert.ToInt64(message.From.Replace("+1", string.Empty)));
            string @from = _aliasLookup.ContainsKey(message.From) ? string.Format("{0} {1}", _aliasLookup[message.From].Name, number) : number;

            return new BoardMessage
                       {
                           From = @from,
                           Message = message.Body,
                           Time = message.Received.AddHours(timezone.OffsetHour).AddMinutes(timezone.OffsetMinutes).ToShortTimeString()
                       };
        }