コード例 #1
0
        /// <summary>
        /// Returns the URI for Convert TZ API request
        /// </summary>
        /// <returns></returns>
        public override string GetRequestUrl()
        {
            string headStr = "TimeZone/Convert/?";

            List <string> param_list = new List <string>()
            {
                string.Format("key={0}", BingMapsKey.ToString()),
                string.Format("includeDstRules={0}", IncludeDstRules.ToString().ToLower()),
                string.Format("dt={0}", DateTimeHelper.GetUTCString(LocationDateTime)),
                string.Format("desttz={0}", DestinationTZID)
            };

            return(this.Domain + headStr + string.Join("&", param_list));
        }
コード例 #2
0
        public override string GetRequestUrl()
        {
            List <string> param_list = new List <string>()
            {
                string.Format("key={0}", BingMapsKey.ToString()),
                string.Format("includeDstRules={0}", IncludeDstRules.ToString().ToLower())
            };

            string headStr;

            if (list_operation)
            {
                headStr = "TimeZone/List/?";
                if (TimeZoneStandard != null)
                {
                    param_list.Add(string.Format("tzstd={0}", TimeZoneStandard));
                }
                else
                {
                    throw new Exception("Standard TZ Name ('Windows' or 'IANA') required.");
                }
            }
            else
            {
                headStr = "TimeZone/?";
                if (DestinationTZID != null)
                {
                    param_list.Add(string.Format("desttz={0}", DestinationTZID));
                }
                else
                {
                    throw new Exception("Destination TZ ID required.");
                }
            }

            return(this.Domain + headStr + string.Join("&", param_list));
        }