public void Dispose() { if (_isDisposed) { return; } _client.Close(); _isDisposed = true; }
public static void Execute(Action <ExRatesSoapClient> action) { ExRatesSoapClient serviceClient = new ExRatesSoapClient(); try { action(serviceClient); serviceClient.Close(); } catch (CommunicationException) { serviceClient.Abort(); } catch (TimeoutException) { serviceClient.Abort(); } catch (Exception) { serviceClient.Abort(); throw; } }
public static void Execute(Action<ExRatesSoapClient> action) { ExRatesSoapClient serviceClient = new ExRatesSoapClient(); try { action(serviceClient); serviceClient.Close(); } catch (CommunicationException) { serviceClient.Abort(); } catch (TimeoutException) { serviceClient.Abort(); } catch (Exception) { serviceClient.Abort(); throw; } }
public static void GetRates(string absentDays) { ExRatesSoapClient client = null; DataSet cursies = null; List<string> dates = new List<string>(); try { dates = (List<string>)SerializationHelper.FromXmlString(typeof(List<string>), absentDays); if (dates != null && dates.Count > 0) { logger.Info(string.Format("absent days count {0}", dates.Count)); client = new ExRatesSoapClient(); List<CurrRate> result = new List<CurrRate>(); foreach (string date in dates) { cursies = client.ExRatesDaily(DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture)); if (cursies != null) { foreach (DataRow row in cursies.Tables[0].Rows) { string cuurCode = row[3] as string; if (neededCurrenciesCodes.Contains(cuurCode)) { result.Add(new CurrRate(date, cuurCode, (decimal)row[2], COUNTRY_ID)); } } } } client.Close(); SendResult(result); } else logger.Info(string.Format("absent days count {0}", dates.Count)); } catch (Exception ex) { logger.Error("get rates error", ex); } }