本文整理汇总了C#中CurrencyType类的典型用法代码示例。如果您正苦于以下问题:C# CurrencyType类的具体用法?C# CurrencyType怎么用?C# CurrencyType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CurrencyType类属于命名空间,在下文中一共展示了CurrencyType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RaiseRateChanging
public static void RaiseRateChanging(CurrencyType currencyRiseChanger)
{
((System.Collections.Generic.IEnumerable<CurrencyWapper>)CurrencyTable).ForEach<CurrencyWapper>(delegate(CurrencyWapper p)
{
p.RaiseRateChanged();
});
}
示例2: ConvertCurrency
public ActionResult ConvertCurrency(double amount, CurrencyType convertFrom, CurrencyType convertTo)
{
double multiplier = GetMultiplier(convertFrom, convertTo);
double convertedAmount = amount * multiplier;
return Json(convertedAmount, JsonRequestBehavior.AllowGet);
}
示例3: ConvertTo
public static decimal ConvertTo(decimal fromAmount, CurrencyType fromCurrencyType, CurrencyType toCurrencyType, Currency[] currencies)
{
if (fromCurrencyType == toCurrencyType)
return fromAmount;
if ((fromCurrencyType != CurrencyType.CZK && currencies.All(c => c.CurrencyType != fromCurrencyType)) ||
toCurrencyType != CurrencyType.CZK && currencies.All(c => c.CurrencyType != toCurrencyType))
{
throw new Exception(String.Format(ValidationResource.Currency_CannotProccessCurrencyChange_ErrorMessage, fromCurrencyType, toCurrencyType));
}
decimal amountTo = fromAmount;
Currency currency;
// Převod konta na CZK
if (fromCurrencyType != CurrencyType.CZK)
{
currency = currencies.Single(c => c.CurrencyType == fromCurrencyType);
amountTo = amountTo * currency.ExchangeRateToCZK;
}
// Převod konta na aktuální měnu
if (toCurrencyType != CurrencyType.CZK)
{
currency = currencies.Single(c => c.CurrencyType == toCurrencyType);
amountTo = amountTo / currency.ExchangeRateToCZK;
}
return amountTo;
}
示例4: QuerySettings
public QuerySettings(string origin, string destination = "-", DateTime? departDate = null, DateTime? returnDate = null, CurrencyType currency = CurrencyType.RUB)
: this(origin, destination)
{
Currency = currency;
DepartDate = departDate;
ReturnDate = returnDate;
}
示例5: requestLimitedPurchase
public LimitedPurchaseResponse requestLimitedPurchase(String XRSFToken, int productID, CurrencyType currency, int expectedPrice, int expectedSellerID, int userAssetID, String cookies)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.roblox.com/api/item.ashx?rqtype=purchase&productID=" + productID + "&expectedCurrency=" + ((currency == CurrencyType.ROBUX) ? "1" : "2") + "&expectedPrice=" + expectedPrice + "&expectedSellerID=" + expectedSellerID + "&userAssetID=" + userAssetID);
request.KeepAlive = true;
request.Accept = "*/*";
request.Headers.Add("Origin", @"http://www.roblox.com");
request.Headers.Add("X-CSRF-TOKEN", XRSFToken);
request.UserAgent = RobloxUtils.UserAgent;
request.ContentType = "application/json; charset=utf-8";
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "en-US,en;q=0.8");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
string body = @"";
byte[] postBytes = Encoding.UTF8.GetBytes(body);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (Stream receiveStream = RobloxUtils.decodeStream(response))
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
String s = readStream.ReadToEnd();
return JsonConvert.DeserializeObject<LimitedPurchaseResponse>(s);
}
}
}
示例6: AccountDTO
public AccountDTO(Int32 accountID, Decimal balance, CurrencyType currency, Int32 client_ClientID)
{
this.AccountID = accountID;
this.Balance = balance;
this.Currency = currency;
this.Client_ClientID = client_ClientID;
}
示例7: requestAssetPurchase
internal bool requestAssetPurchase(String token, long assetID, int expectedPrice, CurrencyType currency, String cookies)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://m.roblox.com/Catalog/ProcessPurchase");
request.KeepAlive = true;
request.Accept = "text/html, */*; q=0.01";
request.Headers.Add("Origin", @"https://m.roblox.com");
request.Headers.Add("X-Requested-With", @"XMLHttpRequest");
request.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36";
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.Referer = "https://m.roblox.com/items/295133189";
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "en-US,en;q=0.8");
request.Headers.Set(HttpRequestHeader.Cookie, cookies);
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
string body = @"__RequestVerificationToken=" + token + "&CurrencyType=" + ((currency == CurrencyType.ROBUX) ? "1" : "2") + "&AssetID="+assetID+"&UserAssetOptionID=0&ExpectedPrice="+expectedPrice;
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (BufferedStream receiveStream = new BufferedStream(response.GetResponseStream()))
{
using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
{
String s = readStream.ReadToEnd();
return s.Contains("successfully");
}
}
}
示例8: FixedFeeCurrencyWallet
public FixedFeeCurrencyWallet(decimal entryFixedFee, decimal exitFixedFee, CurrencyType currencyType, IExchange exchange)
{
_entryFixedFee = entryFixedFee;
_exitFixedFee = exitFixedFee;
Currency = currencyType;
_exchange = exchange;
}
示例9: GeneratePaymentAddress
public GeneratePaymentAddress(int userID, CurrencyType currency)
{
Check.Argument.IsNotNegativeOrZero(userID, "userID");
Check.Argument.IsNotNegativeOrZero((int)currency, "currency");
this.UserID = userID;
this.Currency = currency;
}
示例10: GetRate
public override decimal GetRate(CurrencyType @from, CurrencyType to) {
if(ExchangeRates.ContainsKey(@from) && ExchangeRates[@from].ContainsKey(to))
return ExchangeRates[@from][to];
if(ExchangeRates.ContainsKey(to) && ExchangeRates[to].ContainsKey(@from))
return 1m / ExchangeRates[to][@from];
throw new UnknownExchangeRateException(String.Format("Exchange rate between '{0}' and '{1}' not known", @from.Code, to.Code));
}
示例11: PercentageFeeCurrencyWallet
public PercentageFeeCurrencyWallet(decimal entryPercentFee, decimal exitPercentFee, CurrencyType currencyWallet, IExchange exchange)
{
_exchange = exchange;
_entryPercentFee = entryPercentFee;
_exitPercentFee = exitPercentFee;
Currency = currencyWallet;
}
示例12: PaymentTransactionConfirmed
public PaymentTransactionConfirmed(int paymentTransactionID,string txID, int confirmations, CurrencyType currencyType, int byUserID = 0)
{
this.PaymentTransactionID = paymentTransactionID;
this.TxID = txID;
this.Confirmations = confirmations;
this.Currency = currencyType;
this.ByUserID = byUserID;
}
示例13: CreateAccount
public CreateAccount(CurrencyType currency, int userID)
{
Check.Argument.IsNotNegativeOrZero(userID, "userID");
Check.Argument.IsNotNull(currency, "currency");
this.Currency = currency;
this.UserID = userID;
}
示例14: SwitchCurrency
public TinyMoneyManager.CurrencyConverterByWebService.Currency SwitchCurrency(CurrencyType localVer)
{
TinyMoneyManager.CurrencyConverterByWebService.Currency cNY = TinyMoneyManager.CurrencyConverterByWebService.Currency.CNY;
switch (localVer)
{
case CurrencyType.CNY:
return cNY;
case CurrencyType.USD:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.USD;
case CurrencyType.NTD:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.TWD;
case CurrencyType.HKD:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.HKD;
case CurrencyType.AUD:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.AUD;
case CurrencyType.EUR:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.EUR;
case CurrencyType.JPY:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.JPY;
case CurrencyType.GBP:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.GBP;
case CurrencyType.MYR:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.MYR;
case CurrencyType.SGD:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.SGD;
case CurrencyType.THP:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.THB;
case CurrencyType.PKR:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.PKR;
case CurrencyType.INR:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.INR;
case CurrencyType.KRW:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.KRW;
case CurrencyType.IDR:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.IDR;
case CurrencyType.BYR:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.RUB;
case CurrencyType.PHP:
return TinyMoneyManager.CurrencyConverterByWebService.Currency.PHP;
}
return cNY;
}
示例15: GetInsideTransferBySequenceNo
public InsideTransferModel GetInsideTransferBySequenceNo(string seqNo, TransactionState txstate, CurrencyType currency)
{
Check.Argument.IsNotEmpty(seqNo, "seqNo");
return this.Context.Sql(getInsideTransferBySequenceNo_Sql.FormatWith(currency.ToString()))
.Parameter("@seqNo", seqNo)
.Parameter("@state", txstate)
.QuerySingle<InsideTransferModel>();
}