Пример #1
0
 private void DownloadDocument(string path, IHaveErrorInfo item)
 {
     try
     {
         Policy.Handle <System.Xml.XmlException>()
         .Or <System.Net.WebException>()
         .Retry(3)
         .Execute(() => _document = XDocument.Load(path));
     }
     catch (Exception ex) when(
         ex is System.Xml.XmlException ||
         ex is System.Net.WebException
         )
     {
         if (_pathToFakeData != null)
         {
             item.HasError      = true;
             item.ResultMessage = ex.Message;
             _document          = XDocument.Load(_pathToFakeData);
         }
         else
         {
             throw ex;
         }
     }
 }
Пример #2
0
        private void DownloadDocument(int regionCode, IHaveErrorInfo item)
        {
            if (regionCode == 0)
            {
                DownloadDocument(item);
                return;
            }

            DownloadDocument(string.Format(regionInfoEndpointWithParametr, regionCode), item);
        }
Пример #3
0
 private void DownloadDocument(IHaveErrorInfo item)
 => DownloadDocument(regionInfoEndpointWithDefault, item);