C# .NET - update currency price

Asked By gnanam gnanam
06-Apr-09 07:34 AM
I want to update the currency rate frequently.how to update currecy value.how to update pls help me?
  Santhosh N replied to gnanam gnanam
06-Apr-09 07:38 AM

For this you need to incorporate any web service providding these details...

Check here for more info...

http://www.portalsolutions.hu/docs/PortalSolutions_CurrencyUpdateWebService_SAP_6.20_ENG.pdf

and

http://www.xignite.com/xcurrencies.asmx?op=xServiceFAQ

re  re

06-Apr-09 07:40 AM

U can use RSS feeds for update currency rate frequently in your site.

 

re  re

06-Apr-09 07:47 AM

u can get RSS feed from valid site like

http://www.currencysource.com/rss_currencyexchangerates.html

and update frequently in your site

TRY THIS  TRY THIS
06-Apr-09 08:10 AM

Jeff Prosise has written an article "http://webdeveloper.earthweb.com/webjs/print.php/10959_982451_5", he pretty much explained how to load XML data with ASP.NET from the "Rates.xml" file. In this article I have created Currency Converter Server which can be scheduled to extract the data from third party site and build the "Rates.xml" dynamically.

CurrencyConverter.dll Component:

"CurrencyConverter.dll" This component will extract the data from PACIFIC Exchange site using regular expression patterns.

      // html for which we are writing this regular expression pattern 
      /*
        <TD align=middle>ADP</TD>
        <TD align=left>Andorran Peseta</TD>
        <TD align=right>100.92</TD>
        <TD align=right>152.844</TD>
        <TD align=right>166.386</TD>
        <TD align=right>251.917</TD>
      */
      Regex regex = new Regex(@"<td.*?>(.+)</td>+", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);

      MatchCollection matches = regex.Matches(rawHtml);

      if (matches.Count > 0) 
      {
        // Get the first match
        foreach(Match match in matches)
        {
          if (match.Success)
          {      
            // Get the second group in the match
            Group grp = match.Groups[1];
            
            // return data 
            Console.WriteLine(grp.Value);
          }
          
        }
      }
Once we extract the data from the site then we can build "Rates.xml" XML file using XmlTextWriter class.
    XmlTextWriter writer = new XmlTextWriter(XMLFilePath, System.Text.Encoding.UTF8);
    
    writer.WriteStartDocument();

    //Use automatic indentation for readability.
    writer.Formatting = Formatting.Indented;
        
    //Write the root element
    writer.WriteStartElement("Rates");

    //Start an element
    writer.WriteStartElement("Rate");

    //add sub-elements
    writer.WriteElementString("Currency", "British Pound");
    writer.WriteElementString("Exchange", "0.635243");

    //End the item element
    writer.WriteEndElement();  // end Rate

    // end the root element
    writer.WriteFullEndElement();
             
    //Write the XML to file and close the writer
    writer.Flush();
    writer.Close(); 
Test file which will connect to the PACIFIC Exchange site and extract the data and build "Rates.xml" file.
  class BuildXML
  {
    static void Main()
    {

      string SupplementaryExchangeRatesActualSiteUrl = "http://pacific.commerce.ubc.ca/xr/rates.html";
      Currency cc = new Currency();
      cc.ExchangeRatesURL = SupplementaryExchangeRatesActualSiteUrl;
      cc.XMLFilePath = "Rates.xml";    
      cc.Build();
      Console.WriteLine(cc.ModuleError.ToString());
    }
  }

Here is the some site, from which exchange rate data can be extracted.

Here is the some site, from which exchange rate data can be extracted.

PACIFIC Exchange Rate Service for 242 countries
http://pacific.commerce.ubc.ca/xr/rates.html

PACIFIC Exchange daily Rates but limited countries
http://pacific.commerce.ubc.ca/xr/today.html

US Treasury Exchange Rates
http://www.fms.treas.gov/intn.html

Federal Reserve Bank Exchange Rates
http://www.federalreserve.gov/releases/H10/Update/

International Monetary Fund (IMF) Exchange Rates
http://www.imf.org/external/np/tre/sdr/db/rms_five.cfm

Rates.xml file:

"Rates.xml" contains 242 countries exchange rate. But if you look at the countries names they are not alphabetically sorted, I will explain this later how to sort data within ASP.NET page.

 <?xml version="1.0" encoding="utf-8"?>
<Rates>
  <Rate>
    <Currency>Andorran Peseta</Currency>
    <Exchange> 154.763</Exchange>
  </Rate>
  <Rate>
    <Currency>U.A.E. Dirham</Currency>
    <Exchange>   3.673</Exchange>
  </Rate>
  <Rate>
    <Currency>Afghanistan Afghani</Currency>
    <Exchange>  42.785</Exchange>
  </Rate>
  <Rate>
    <Currency>Albanian Lek</Currency>
    <Exchange> 129.181</Exchange>
  </Rate>
  <Rate>
    <Currency>Armenia Dram</Currency>
    <Exchange> 554.882</Exchange>
  </Rate>
  <Rate>
    <Currency>Neth. Ant. Guilder</Currency>
    <Exchange>    1.78</Exchange>
  </Rate>
  <Rate>
    <Currency>Angolan Kwanza</Currency>
    <Exchange> 65.0163</Exchange>
  </Rate>
  <Rate>
    <Currency>Argentine Peso</Currency>
    <Exchange>   3.155</Exchange>
  </Rate>
  <Rate>
    <Currency>Austrian Schilling</Currency>
    <Exchange> 12.7991</Exchange>
  </Rate>
  <Rate>
    <Currency>Christmas Is. Dollar</Currency>
    <Exchange> 1.65399</Exchange>
  </Rate>
  <Rate>
    <Currency>Cocos(Keeling) Is.</Currency>
    <Exchange> 1.65399</Exchange>
  </Rate>
.
.
.
.
.
SOURCE FROM : http://www.csharphelp.com/archives2/archive441.html
WebServiceX has a reliable currency converter webservice  WebServiceX has a reliable currency converter webservice
06-Apr-09 11:57 AM
All you have to do is add a web reference to http://www.webservicex.net/CurrencyConvertor.asmx and use the appropriate methods.
Re :: Update Currency Price  Re :: Update Currency Price
06-Apr-09 07:57 PM

See these articles for Current Converter and updates

http://www.csharphelp.com/archives2/archive441.html

http://www.codeproject.com/KB/aspnet/currency_convertor_ws.aspx

Hope this helps.

Create New Account
help
Rates.xml" dynamically. CurrencyConverter.dll Component: "CurrencyConverter.dll" This component will extract the data from PACIFIC Exchange site using regular expression patterns. / / html for which we are writing this regular expression pattern Formatting = Formatting.Indented; / / Write the root element writer.WriteStartElement("Rates"); / / Start an element writer.WriteStartElement("Rate"); / / add sub-elements writer.WriteElementString("Currency", "British Pound"); writer.WriteElementString("Exchange", "0.635243"); / / End the item element writer.WriteEndElement(); / / end Rate / / end the root element writer.WriteFullEndElement(); / / Write the XML to file and close the writer writer.Flush(); writer.Close(); Test file which will connect to the PACIFIC Exchange site and extract the data and build "Rates.xml" file. class BuildXML { static void Main() { string SupplementaryExchangeRatesActualSiteUrl = "http: / / pacific.commerce.ubc.ca / xr / rates.html"; Currency cc = new Currency(); cc.ExchangeRatesURL = SupplementaryExchangeRatesActualSiteUrl; cc.XMLFilePath
double post. For currency conversion you can use a web service for upadation of the exchange rates for the conversion process . Here is the some site, from which exchange rate data can be extracted. PACIFIC Exchange rate Service http: / / pacific.commerce.ubc.ca / xr / rates.html PACIFIC Exchange Rate http: / / pacific.commerce.ubc.ca / xr / today.html (IMF) Exchange Rates http: / / www
Is it possible to display a field with more than 5 decimal places? We have exchange rates which are 6 decimal places, but it limits me to 5 in the SmartList GP, MCT East Coast Dynamics www.eastcoast-dynamics.com Hi Frank, Thanks for your reply. Exchange rates can be stored to 6 decimal places. I am not on my work machine 5 digit limiation prevents me from displaying them. I can do it with the canned exchange rate report but that does not provide the required reporting flexibiity. Doug - - Doug Wilson Great Plains which allows more decimal places. You will probably find that the field used for the rate is a vcurrency field not a currency field. David Musgrave [MSFT] Escalation Engineer - Microsoft Dynamics GP Microsoft Dynamics Support - Asia Pacific Microsoft Dynamics (formerly Microsoft Business Solutions) http: / / www.microsoft.com / Dynamics mailto:David.Musgrave@online Is it possible to display a field with more than 5 decimal places We have exchange rates which are 6 decimal places, but it limits me to 5 in the SmartLis
make the adjustments manually for the time zone that the server resides in - specifically the Pacific Time Zone. Our e-mail and web sites are hosted externally, and we are not appreciated. Windows Server Active Directory Discussions MicroSoft (1) UNIX (1) Server (1) Active Directory (1) Exchange Server (1) Windows Server (1) Microsoft Exchange (1) WinXP (1) Only performing this on the server does not cut it. You have id = 555375 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Thanks! :) You should coordinate the changes made to your clients to when the Exchange server is updates, other wise your Outlook clients could have issues. Or. . . you update all your clients From http: / / support.microsoft.com / gp / dst_topissues#A5 For IT administrators running Microsoft Exchange Server 1. Apply updates to Windows operating systems on Windows Servers. Windows Server KB article Windows operating systems on individual workstations. Windows operating systems KB article 928388 3. Apply the Exchange Server DST update. Exchange Server 2003 KB article 926666 Other Exchange Server see below 4. The IT administrator has one of four alternatives (pros and cons