private string GetExchRateTypeNodeStr(ExchRateType exchRateType) { string ret = ""; switch (exchRateType) { case ExchRateType.ForexBuying: ret = "ForexBuying"; break; case ExchRateType.ForexSelling: ret = "ForexSelling"; break; case ExchRateType.BanknoteBuying: ret = "BanknoteBuying"; break; case ExchRateType.BanknoteSelling: ret = "BanknoteSelling"; break; } return(ret); }
/// <summary> /// Get Call /// </summary> /// <param name="currency">Exchange Currency</param> /// <param name="exchRateType">Exchange Type</param> /// <returns></returns> public Decimal GetExchRate(string currency, ExchRateType exchRateType) { bool loadResult = false; loadResult = LoadExchRate(); // Culture Convert System.Globalization.CultureInfo culInfo = new System.Globalization.CultureInfo("en-US", true); // XML Node string nodeStr = String.Format("Tarih_Date/Currency[@CurrencyCode='{0}']/{1}", currency.ToUpper(), GetExchRateTypeNodeStr(exchRateType)); // String to Decimal if (loadResult) { return(Decimal.Parse(XmlDoc.SelectSingleNode(nodeStr).InnerXml, culInfo)); } else { return(0); } }