Пример #1
0
        public void getAllSingleResults(GtAccount account)
        {
            List <GtQueryDetails> detailsList = new List <GtQueryDetails>();

            detailsList = account.Queries;
            GtResultXmlSerializer serialize = new GtResultXmlSerializer();
            String serializado = "";
            string path        = @ConfigurationManager.AppSettings["ResultPath"];
            string filePath;

            if (!Directory.Exists(@ConfigurationManager.AppSettings["ResultPath"]))
            {
                Directory.CreateDirectory(@ConfigurationManager.AppSettings["ResultPath"]);
            }

            for (int i = 0; i < detailsList.Count(); i++)
            {
                String id = detailsList[i].TableId.ToString();
                log.Info("Requesting:" + detailsList[i].Tittle);
                RetrievedData = GetStatistics(id, detailsList[i]);
                Result        = getResult(RetrievedData, detailsList[i]);
                serializado   = serialize.SerializeUtf8(Result);
                filePath      = "result_" + detailsList[i].Name + ".xml";
                StreamWriter file = new StreamWriter(path + filePath);
                file.Write(serializado);
                file.Close();
            }
        }
Пример #2
0
        public void getAllResults(GtAccount account)
        {
            List <GtQueryDetails> detailsList = new List <GtQueryDetails>();

            detailsList = account.Queries;
            GtResultXmlSerializer serialize = new GtResultXmlSerializer();
            String          serializado     = "";
            List <GtResult> listResults     = new List <GtResult>();

            foreach (GtQueryDetails details in detailsList)
            {
                String id = details.TableId.ToString();
                log.Info("Requesting:" + details.Tittle);
                RetrievedData = GetStatistics(id, details);
                Result        = getResult(RetrievedData, details);
                listResults.Add(Result);
            }

            if (!Directory.Exists(@ConfigurationManager.AppSettings["ResultPath"]))
            {
                Directory.CreateDirectory(@ConfigurationManager.AppSettings["ResultPath"]);
            }

            serializado = serialize.SerializeUtf8(listResults);
            StreamWriter file = new StreamWriter(@ConfigurationManager.AppSettings["ResultPath"] + "result.xml");

            file.Write(serializado);
            file.Close();
        }