0% found this document useful (0 votes)
562 views

Currency Converter Using C#

The document describes a C# method for currency conversion using a Yahoo Finance API. The method takes in an amount, from currency, and to currency as parameters. It calls the Yahoo API to get the exchange rate and returns the converted amount. The code provides a simple way to perform currency conversions in applications without using paid third party tools or APIs.

Uploaded by

Mohammad Salman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
562 views

Currency Converter Using C#

The document describes a C# method for currency conversion using a Yahoo Finance API. The method takes in an amount, from currency, and to currency as parameters. It calls the Yahoo API to get the exchange rate and returns the converted amount. The code provides a simple way to perform currency conversions in applications without using paid third party tools or APIs.

Uploaded by

Mohammad Salman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

0

More NextBlog

CreateBlog SignIn

SalmanKavish
Saturday,27February2016

AboutMe

SalmanKavish

CurrencyConverterusingC#

Follow

Viewmycompleteprofile

Inmanyprojectthereisneedtoconvertonecurrencytoothercurrencyspeciallyintransaction
application.TherearereadymadethirdpartytoolsorWebAPIbywhichwecanconvertcurrency,
buttheyarepaid.InthisparticularpostiwillprovideaC#codethroughwhichoneperform
currencyconversion.ForthisihaveusedyahoofinancecurrencyconversionAPIwhichgivesyou
realtimecurrencyexchangevalue.

BlogArchive

2016(2)
February(1)

Herewego.
youjustneedtopassthreeparameterstofollowingmethodandyouwillgetoutputasconverted
ratefromfromCurrencyTotoCurrency.
publicstringCurrencyConversion(decimalamount,stringfromCurrency,stringtoCurrency)
{
stringOutput=""
conststringfromCurrency1="USD"
conststringtoCurrency1="INR"
constdoubleamount1=2000
//Forothercurrencysymbolsseehttp://finance.yahoo.com/currencyconverter/
//ConstructURLtoquerytheYahoo!FinanceAPI
conststringurlPattern="http://finance.yahoo.com/d/quotes.csv?s={0}{1}=X&f=l1"
stringurl=string.Format(urlPattern,fromCurrency1,toCurrency1)
//Getresponseasstring
stringresponse=newWebClient().DownloadString(url)
//Convertstringtonumber
doubleexchangeRate=
double.Parse(response,System.Globalization.CultureInfo.InvariantCulture)
//Outputtheresult
Output=(amount1*exchangeRate).ToString()
returnOutput
}
Thankyou.

PostedbySalmanKavishat10:25

Nocomments:

+2 Recommend this on Google

Saturday,23January2016

SendEmailUsingSQLServer.
InthisarticleIwillexplainhowtosendemailusingSQLserver.ForthisyouneedtohaveSQL
serverenterpriseedition.ItusesSMTPservertocommunicatewithuser.
FollowingaresteptosendEmailusingSQLServer.
Step1:
YouneedtoconfigureProfileandAccountin'DatabaseMail'under'Management'node.

Currency
Converter
usingC#
January(1)

Clickon'ConfigureDatabaseMail'willopenbelowwizard.

IfProfileisconfiguredforfirsttime,clickon'Yes'

SetProfileNameandDescription.ClickonaddbuttontocreateDatabaseMailaccount.

ClickNext.

Clickonfinishwillsetupaccountandprofile.

Closewizard.Nowyoucansendatestmail.

YouwillgetemailinyourInbox.

Step2:
Aftercreatingmailprofileandtestingofmail,youcanwritequeryforexecutingmailbysimply
passingparameterstostoredprocedurecalled'sp_send_dbmail'.Thisstoredprocedureisinthe
msdbdatabase.Followingisexample.

declare@body1varchar(4000)
set@body1='ThisistestmailsentfromSQQL2008'
EXECmsdb.dbo.sp_send_dbmail
@profile_name='MailTutorial',
@recipients='[email protected]',
@subject='MailTutorial',
@body=@body1,
@body_format='HTML',
Hereyouhavedifferentoptionsuchasattachingfileinanemail.alsoyoucanscheduleabove
querytosendmailatparticularintervaloftime.
forfurtherstudyabout'sp_send_dbmail'youcanvisittoMSDNwebsite.
https://msdn.microsoft.com/enIN/library/ms190307.aspx

PostedbySalmanKavishat23:13

4comments:

+2 Recommend this on Google

Home
Subscribeto:Posts(Atom)

Simpletemplate.PoweredbyBlogger.

You might also like