Esempio n. 1
0
        /// <summary>
        /// Gets teh Url from the Builder
        /// </summary>
        /// <returns>string - the url calculated in the Builder</returns>
        private string getDownloadURI()
        {
            string ticker   = textBoxTicker.Text;
            string exchange = textBoxExchange.Text;

            if (String.IsNullOrEmpty(ticker))
            {
                return(string.Empty);
            }

            DownloadURIBuilder uriBuilder = new DownloadURIBuilder(exchange, ticker);

            if (radioButtonAllData.Checked)
            {
                return(uriBuilder.GetGetPricesUrlToDownloadAllData(DateTime.Now));
            }
            else if (radioButtonLastQuoute.Checked)
            {
                return(uriBuilder.GetGetPricesUrlForLastQuote());
            }
            else if (radioButtonSince.Checked)
            {
                DateTime startDate = dateTimePickerSinceDate.Value.Date,
                         endDate   = DateTime.Now.Date;
                if (endDate < startDate)
                { //It's impossible to download data from the future. That's why no URL is returned in this case.
                    return(string.Empty);
                }
                else
                {
                    return(uriBuilder.GetGetPricesUrlForRecentData(startDate, endDate));
                }
            }
            else if (radioButtonMinutes.Checked)
            {
                return(uriBuilder.GetGetPricesUrlForLastNumberOfDays(15));
            }
            else
            {
                return(string.Empty);
            }
        }