Sie sind auf Seite 1von 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='isalmankavish@gmail.com',
@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.

Das könnte Ihnen auch gefallen