void ReleaseDesignerOutlets()
        {
            if (DescriptionLabel != null)
            {
                DescriptionLabel.Dispose();
                DescriptionLabel = null;
            }

            if (DetailsView != null)
            {
                DetailsView.Dispose();
                DetailsView = null;
            }

            if (JobTable != null)
            {
                JobTable.Dispose();
                JobTable = null;
            }

            if (NewNoteField != null)
            {
                NewNoteField.Dispose();
                NewNoteField = null;
            }

            if (NoteTable != null)
            {
                NoteTable.Dispose();
                NoteTable = null;
            }

            if (OrderNoLabel != null)
            {
                OrderNoLabel.Dispose();
                OrderNoLabel = null;
            }

            if (StatusLabel != null)
            {
                StatusLabel.Dispose();
                StatusLabel = null;
            }

            if (DetailsSection != null)
            {
                DetailsSection.Dispose();
                DetailsSection = null;
            }
        }
Example #2
0
        //"pageId=1464&productId=5792&languageCultureCode=en-GB&countryId=1&investorId=2&languageId=6&refererUrl=";
        public static string GetDetailsPage(string singleFundUrl, DetailsSection detailsSection, string pageId,
            string productId, string languageCulture, string countryId, string investorId, string languageId, string refererUrl)
        {
            var getDetailsUrl = "https://www.etfsecurities.com/base/Product/GetSection/"+(int)detailsSection;
            try
            {

                var postData =
                    string.Format(
                        "pageId={0}&productId={1}&languageCultureCode={2}&countryId={3}&investorId={4}&languageId={5}&refererUrl={6}",
                        pageId, productId, languageCulture, countryId, investorId, languageId, refererUrl);

                const string contentType = "application/x-www-form-urlencoded";

                var request = (HttpWebRequest) WebRequest.Create(new Uri(getDetailsUrl));
                request.Method = "POST";
                request.ContentType = contentType;
                request.ContentLength = postData.Length;
                request.Accept = "*/*";
                request.Referer = singleFundUrl;
                //"https://www.etfsecurities.com/institutional/uk/en-gb/products/product/etfs-agriculture-agap-lse";
                request.Headers.Add("Origin", "https://www.etfsecurities.com");
                request.Host = "www.etfsecurities.com";

                var cookieContainer = new CookieContainer();
                cookieContainer.Add(new Cookie("InvestorId", investorId, "/",
                    ".etfsecurities.com"));
                cookieContainer.Add(new Cookie("CountryId", countryId, "/",
                    ".etfsecurities.com"));
                //cookieContainer.Add(new Cookie("", "1","/","www.etfsecurities.com"));
                request.CookieContainer = cookieContainer;

                using (StreamWriter requestWriter = new StreamWriter(request.GetRequestStream()))
                {
                    requestWriter.Write(postData);
                    requestWriter.Close();

                    request.AllowAutoRedirect = true;
                    request.KeepAlive = true;

                    var response = request.GetResponse();

                    var encoding = Encoding.ASCII;
                    using (var reader = new StreamReader(response.GetResponseStream(), encoding))
                    {
                        var responseText = reader.ReadToEnd();
                        return responseText;
                    }
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }