public void GetMercadoResponseWithMercadoTestPage(SpiderTask spiderTask)
        {
            List <string> taskStrings = new List <string>();
            string        pyramid, webType;
            string        mercadoTestUrl = GetMercadoTestUrl(spiderTask.Url, out pyramid, out taskStrings, out webType);

            string postResponse = string.Empty;

            if (webType == "qs")
            {
                foreach (string taskString in taskStrings)
                {
                    string postData = BuildMVCPostData(taskString);
                    mercadoTestUrl = AddMercadoResultMethod(mercadoTestUrl);
                    postResponse   = NetRequest.PostRequest(mercadoTestUrl, postData);
                    string         mercadoXml     = GetMercadoXmlFromPageSource(postResponse);
                    SpiderTaskItem spiderTaskItem = new SpiderTaskItem();
                    spiderTaskItem.TaskString  = taskString;
                    spiderTaskItem.ResponseXml = mercadoXml;
                    spiderTask.SpiderTaskItems.Add(spiderTaskItem);
                }
            }
            else
            {
                foreach (string taskString in taskStrings)
                {
                    string testPageSource = NetRequest.GetRequest(mercadoTestUrl);
                    string eventId        = GetEventIdFromPageSource(testPageSource);
                    string postData       = BuildAspxPostData(eventId, taskString);
                    postResponse = NetRequest.PostRequest(mercadoTestUrl, postData);
                    string         mercadoXml     = GetMercadoXmlFromPageSource(postResponse);
                    SpiderTaskItem spiderTaskItem = new SpiderTaskItem();
                    spiderTaskItem.TaskString  = taskString;
                    spiderTaskItem.ResponseXml = mercadoXml;
                    spiderTask.SpiderTaskItems.Add(spiderTaskItem);
                }
            }
        }
Exemplo n.º 2
0
        public void GetMercadoResponseWithMercadoTestPage(SpiderTask spiderTask)
        {
            List<string> taskStrings = new List<string>();
            string pyramid, webType;
            string mercadoTestUrl = GetMercadoTestUrl(spiderTask.Url, out pyramid, out taskStrings, out webType);

            string postResponse = string.Empty;
            if (webType == "qs")
            {
                foreach (string taskString in taskStrings)
                {
                    string postData = BuildMVCPostData(taskString);
                    mercadoTestUrl = AddMercadoResultMethod(mercadoTestUrl);
                    postResponse = NetRequest.PostRequest(mercadoTestUrl, postData);
                    string mercadoXml = GetMercadoXmlFromPageSource(postResponse);
                    SpiderTaskItem spiderTaskItem = new SpiderTaskItem();
                    spiderTaskItem.TaskString = taskString;
                    spiderTaskItem.ResponseXml = mercadoXml;
                    spiderTask.SpiderTaskItems.Add(spiderTaskItem);
                }
            }
            else
            {
                foreach (string taskString in taskStrings)
                {
                    string testPageSource = NetRequest.GetRequest(mercadoTestUrl);
                    string eventId = GetEventIdFromPageSource(testPageSource);
                    string postData = BuildAspxPostData(eventId, taskString);
                    postResponse = NetRequest.PostRequest(mercadoTestUrl, postData);
                    string mercadoXml = GetMercadoXmlFromPageSource(postResponse);
                    SpiderTaskItem spiderTaskItem = new SpiderTaskItem();
                    spiderTaskItem.TaskString = taskString;
                    spiderTaskItem.ResponseXml = mercadoXml;
                    spiderTask.SpiderTaskItems.Add(spiderTaskItem);
                }
            }
        }