Пример #1
0
        /// <summary>
        /// This function is used to get the Values in XML Format based on the selected sites in the layer
        /// </summary>
        /// <param name="info">DownloadInfo</param>
        /// <param name="getValueProgressHandler">Progress handler</param>
        /// <returns>Collection of of the xml files with values</returns>
        /// <exception cref="DownloadXmlException">Some exception during get values from web service</exception>
        public IEnumerable <string> DownloadXmlDataValues(OneSeriesDownloadInfo info, IGetValuesProgressHandler getValueProgressHandler)
        {
            try
            {
                return(GetWsClientInstance(info.Wsdl).GetValuesXML(info.FullSiteCode, info.FullVariableCode,
                                                                   info.StartDate, info.EndDate,
                                                                   info.EstimatedValuesCount,
                                                                   getValueProgressHandler));
            }
            catch (Exception ex)
            {
                Exception exToWrap;
                if (ex is TargetInvocationException &&
                    ex.InnerException != null)
                {
                    exToWrap = ex.InnerException;
                }
                else
                {
                    exToWrap = ex;
                }

                throw new DownloadXmlException(exToWrap.Message, exToWrap);
            }
        }
Пример #2
0
        /// <summary>
        /// Converts the xml file to a data series object.
        /// </summary>
        /// <param name="dInfo">Download info</param>
        /// <returns>Collection of the data series objects</returns>
        /// <exception cref="DataSeriesFromXmlException">Exception during parsing</exception>
        /// <exception cref="NoSeriesFromXmlException">Throws when no series in xml file</exception>
        public IEnumerable <Series> DataSeriesFromXml(OneSeriesDownloadInfo dInfo)
        {
            var client = GetWsClientInstance(dInfo.Wsdl);
            var parser = client.ServiceInfo.Version == 1.0
                                             ? (IWaterOneFlowParser) new WaterOneFlow10Parser()
                                             : new WaterOneFlow11Parser();

            var result = new List <Series>();

            foreach (var xmlFile in dInfo.FilesWithData)
            {
                IList <Series> seriesList;
                try
                {
                    seriesList = parser.ParseGetValues(xmlFile);
                }
                catch (Exception ex)
                {
                    throw new DataSeriesFromXmlException(ex.Message, ex);
                }
                if (seriesList == null || seriesList.Count == 0)
                {
                    throw new NoSeriesFromXmlException();
                }

                result.AddRange(seriesList);
            }
            return(result);
        }
Пример #3
0
        private void DoLogError(string message, Exception exception, OneSeriesDownloadInfo di)
        {
            if (di != null)
            {
                message = string.Format("Error in {0}:" + Environment.NewLine + message, di.SeriesDescription);
            }
            else
            {
                message = "Error: " + message;
            }

            DoLog(LogKind.Error, message, exception);
        }
Пример #4
0
 public GetValueProgressHandler(DownloadManager manager, OneSeriesDownloadInfo di)
 {
     _manager = manager;
     _di      = di;
 }
Пример #5
0
 public DoDownloadArg(OneSeriesDownloadInfo di, CommnonDoDownloadInfo commonInfo, Thread downloadThread)
 {
     DownloadInfo   = di;
     CommnonInfo    = commonInfo;
     DownloadThread = downloadThread;
 }