本文整理汇总了C#中Currency类的典型用法代码示例。如果您正苦于以下问题:C# Currency类的具体用法?C# Currency怎么用?C# Currency使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Currency类属于命名空间,在下文中一共展示了Currency类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReEntry
public void ReEntry(Currency currencyForPosition, Currency baseCurrency, DateTime dateTime)
{
Status = PositionRuntimeStatus.Active;
// create a new trade record
_currentPositionRecord = new PositionRecord(dateTime, currencyForPosition, baseCurrency, PositionType, this);
PositionRecords.Add(_currentPositionRecord);
}
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:7,代码来源:PositionRuntime.cs
示例2: PositiveAmountSchedule
public PositiveAmountSchedule(XmlNode xmlNode)
: base(xmlNode)
{
XmlNode currencyNode = xmlNode.SelectSingleNode("currency");
if (currencyNode != null)
{
if (currencyNode.Attributes["href"] != null || currencyNode.Attributes["id"] != null)
{
if (currencyNode.Attributes["id"] != null)
{
currencyIDRef_ = currencyNode.Attributes["id"].Value;
Currency ob = new Currency(currencyNode);
IDManager.SetID(currencyIDRef_, ob);
}
else if (currencyNode.Attributes["href"] != null)
{
currencyIDRef_ = currencyNode.Attributes["href"].Value;
}
else
{
currency_ = new Currency(currencyNode);
}
}
else
{
currency_ = new Currency(currencyNode);
}
}
}
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:32,代码来源:PositiveAmountSchedule.cs
示例3: ExchangeRate
/// <summary>
/// the rate r is given with the convention that a
/// unit of the source is worth r units of the target.
/// </summary>
/// <param name="source"></param>
/// <param name="target"></param>
/// <param name="rate"></param>
public ExchangeRate(Currency source, Currency target, double rate)
{
source_ = source;
target_ = target;
rate_ = rate;
type_ = Type.Direct;
}
开发者ID:Yenyenx,项目名称:qlnet,代码行数:14,代码来源:ExchangeRate.cs
示例4: AmountSchedule
public AmountSchedule(XmlNode xmlNode)
: base(xmlNode)
{
XmlNodeList currencyNodeList = xmlNode.SelectNodes("currency");
if (currencyNodeList.Count > 1 )
{
throw new Exception();
}
foreach (XmlNode item in currencyNodeList)
{
if (item.Attributes["href"] != null || item.Attributes["id"] == null)
{
if (item.Attributes["id"] != null)
{
currencyIDRef = item.Attributes["id"].Name;
Currency ob = Currency();
IDManager.SetID(currencyIDRef, ob);
}
else if (item.Attributes.ToString() == "href")
{
currencyIDRef = item.Attributes["href"].Name;
}
else
{
currency = new Currency(item);
}
}
}
}
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:32,代码来源:AmountSchedule.cs
示例5: button3_Click
private void button3_Click(object sender, RoutedEventArgs e)
{
NavigationService ns;
ns = NavigationService.GetNavigationService(this);
Currency nextPage = new Currency();
ns.Navigate(nextPage);
}
开发者ID:plyux,项目名称:HankeyBannister,代码行数:7,代码来源:MainPage.xaml.cs
示例6: Can_formatPrice_with_distinct_currencyDisplayLocale
public void Can_formatPrice_with_distinct_currencyDisplayLocale()
{
var usd_currency = new Currency()
{
Id = 1,
Name = "US Dollar",
CurrencyCode = "USD",
DisplayLocale = "en-US",
};
var rub_currency = new Currency()
{
Id = 2,
Name = "Russian Ruble",
CurrencyCode = "RUB",
DisplayLocale = "ru-RU",
};
var language = new Language()
{
Id = 1,
Name = "English",
LanguageCulture = "en-US"
};
_priceFormatter.FormatPrice(1234.5M, false, usd_currency, language, false, false).ShouldEqual("$1,234.50");
_priceFormatter.FormatPrice(1234.5M, false, rub_currency, language, false, false).ShouldEqual("1 234,50р.");
}
开发者ID:vic0626,项目名称:nas-merk,代码行数:25,代码来源:PriceFormatterTests.cs
示例7: GetExchangeRates
public static double[] GetExchangeRates(Currency transactionCurrency, Currency pivotCurrency, Currency globalPivotCurrency)
{
double[] rates = new double[2];
if (transactionCurrency.Id == pivotCurrency.Id)
rates[0] = 1.00;
else
{
if (transactionCurrency.Rate != 0)
rates[0] = pivotCurrency.Rate * transactionCurrency.Rate;
else
rates[0] = 0;
}
if (transactionCurrency.Id == globalPivotCurrency.Id)
rates[1] = 1.00;
else
{
if (transactionCurrency.Rate != 0)
rates[1] = globalPivotCurrency.Rate * transactionCurrency.Rate;
else
rates[1] = 0;
}
return rates;
}
开发者ID:secondcore,项目名称:avitrade-backend,代码行数:26,代码来源:Utilities.cs
示例8: CreateRecord
public bool CreateRecord(Object Currency)
{
Boolean flag = false;
CurrencyMaster currency = (CurrencyMaster)Currency;
try
{
Currency _currency = new Currency();
if (currency.CurrencyName != null)
{
_currency.Name = currency.CurrencyName.ToUpper().Trim();
}
if (currency.Symbol != null)
{
_currency.Symbol = currency.Symbol;
}
_currency.CreateBy = currency.CreateBy;
_currency.CreateDate = DateTime.Now;
if (_currency.Name != null)
{
flag = DAL.DALCurrency.CreateCurrency(_currency);
}
}
catch (Exception ex)
{
throw;
}
return flag;
}
开发者ID:arnabknd4,项目名称:scs0400915,代码行数:30,代码来源:BALCurrency.cs
示例9: Main
static void Main()
{
try
{
Currency balance = new Currency(50,35);
Console.WriteLine(balance);
Console.WriteLine("balance is " + balance);
Console.WriteLine("balance is (using ToString()) " + balance.ToString());
float balance2= balance;
Console.WriteLine("After converting to float, = " + balance2);
balance = (Currency) balance2;
Console.WriteLine("After converting back to Currency, = " + balance);
Console.WriteLine(
"Now attempt to convert out of range value of -$100.00 to a Currency:");
checked
{
balance = (Currency) (-50.5);
Console.WriteLine("Result is " + balance.ToString());
}
}
catch(Exception e)
{
Console.WriteLine("Exception occurred: " + e.Message);
}
}
开发者ID:alannet,项目名称:example,代码行数:27,代码来源:SimpleCurrency.cs
示例10: 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;
}
开发者ID:MulderFox,项目名称:Main,代码行数:30,代码来源:Currency.cs
示例11: BtnSubmit_Click
protected void BtnSubmit_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string redirectPage = null;
try
{
Currency info = new Currency();
info.UnitAr = txtUnitAr.Text.Trim();
info.UnitEn = txtUnitEn.Text.Trim();
if (Request.QueryString[CommonStrings.ID] != null)
{
info.ID = Convert.ToInt32(Request.QueryString[CommonStrings.ID]);
if (currencysOperator.Update(info))
redirectPage = Utility.AppendQueryString(PagesPathes.ConfirmUpdate, new KeyValue(CommonStrings.BackUrl, "CurrencyList"));
}
else
{
if (currencysOperator.Add(info))
redirectPage = Utility.AppendQueryString(PagesPathes.ConfirmInsert, new KeyValue(CommonStrings.BackUrl, "CurrencyList"));
}
}
catch
{
redirectPage = Utility.AppendQueryString(PagesPathes.ErrorPage, new KeyValue(CommonStrings.BackUrl, "CurrencyList"));
}
finally
{
Response.Redirect(redirectPage);
}
}
}
开发者ID:mrofferz,项目名称:mrofferz,代码行数:35,代码来源:CurrencyAdd.ascx.cs
示例12: GetOrCreateNewTransientCartAsync
public async Task<CartBuilder> GetOrCreateNewTransientCartAsync(Store store, Customer customer, Language language, Currency currency)
{
_store = store;
_customer = customer;
_currency = currency;
_language = language;
_cartCacheKey = GetCartCacheKey(store.Id, customer.Id);
_cart = await _cacheManager.GetAsync(_cartCacheKey, _cartCacheRegion, async () =>
{
ShoppingCart retVal;
var cartSearchResult = await _cartApi.CartModuleGetCurrentCartAsync(_store.Id, _customer.Id);
if (cartSearchResult == null)
{
retVal = CreateNewTransientCart();
}
else
{
var detalizedCart = await _cartApi.CartModuleGetCartByIdAsync(cartSearchResult.Id);
retVal = detalizedCart.ToWebModel(_currency, _language);
}
return retVal;
});
await EvaluatePromotionsAsync();
return this;
}
开发者ID:adwardliu,项目名称:vc-community,代码行数:30,代码来源:CartBuilder.cs
示例13: OpenPosition
public void OpenPosition(Currency currencyForPosition, Currency baseCurrency, DateTime dateTime)
{
Status = PositionRuntimeStatus.Active;
_currentPositionRecord = new PositionRecord(dateTime, currencyForPosition, baseCurrency, PositionType, this);
PositionRecords.Add(_currentPositionRecord);
}
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:7,代码来源:PositionRuntime.cs
示例14: GetCurrencyString
/// <summary>
/// Gets currency string
/// </summary>
/// <param name="amount">Amount</param>
/// <param name="showCurrency">A value indicating whether to show a currency</param>
/// <param name="targetCurrency">Target currency</param>
/// <returns>Currency string without exchange rate</returns>
protected virtual string GetCurrencyString(decimal amount,
bool showCurrency, Currency targetCurrency)
{
if (targetCurrency == null)
throw new ArgumentNullException("targetCurrency");
string result;
if (!String.IsNullOrEmpty(targetCurrency.CustomFormatting))
{
//custom formatting specified by a store owner
result = amount.ToString(targetCurrency.CustomFormatting);
}
else
{
if (!String.IsNullOrEmpty(targetCurrency.DisplayLocale))
{
//default behavior
result = amount.ToString("C", new CultureInfo(targetCurrency.DisplayLocale));
}
else
{
//not possible because "DisplayLocale" should be always specified
//but anyway let's just handle this behavior
result = String.Format("{0} ({1})", amount.ToString("N"), targetCurrency.CurrencyCode);
return result;
}
}
//display currency code?
if (showCurrency && _currencySettings.DisplayCurrencyLabel)
result = String.Format("{0} ({1})", result, targetCurrency.CurrencyCode);
return result;
}
开发者ID:nvolpe,项目名称:raver,代码行数:40,代码来源:PriceFormatter.cs
示例15: Money
public Money(string currencyCode, decimal amount) {
_currency = new Currency();
if (currencyCode != null) {//sometimes a null currencyCode is passed. This might be a bug somewhere
_currency.CurrencyCode = currencyCode;
}
Amount = amount;
}
开发者ID:xcrash,项目名称:cuyahogacontrib-Cuyahoga.Modules.ECommerce,代码行数:7,代码来源:Money.cs
示例16: CurrencyRate
public CurrencyRate(Currency left, Currency right, decimal rate, int leftCount = 1)
{
Left = left;
Right = right;
Rate = rate;
LeftCount = leftCount;
}
开发者ID:riberk,项目名称:CommonCC,代码行数:7,代码来源:CurrancyRate.cs
示例17: Can_formatPrice_with_distinct_currencyDisplayLocale
public void Can_formatPrice_with_distinct_currencyDisplayLocale()
{
var usd_currency = new Currency()
{
Id = 1,
Name = "US Dollar",
CurrencyCode = "USD",
DisplayLocale = "en-US",
};
var rub_currency = new Currency()
{
Id = 2,
Name = "British Pound",
CurrencyCode = "GBP",
DisplayLocale = "en-GB",
};
var language = new Language()
{
Id = 1,
Name = "English",
LanguageCulture = "en-US"
};
_priceFormatter.FormatPrice(1234.5M, true, usd_currency, language, false, false).ShouldEqual("$1,234.50");
_priceFormatter.FormatPrice(1234.5M, true, rub_currency, language, false, false).ShouldEqual("£1,234.50");
}
开发者ID:mandocaesar,项目名称:MesinkuNew,代码行数:25,代码来源:PriceFormatterTests.cs
示例18: MoneyForExercise2
/// <summary>
/// Represents a money.
/// </summary>
/// <param name="value">Value for the money.</param>
public MoneyForExercise2(decimal value, Currency currency)
{
this.value = value;
this.MinValue = 6;
//
this.currency = currency;
}
开发者ID:bernardobrezende,项目名称:IntroDotNetCSharp,代码行数:11,代码来源:MoneyForExercise2.cs
示例19: RateComparison
public RateComparison(Currency currency, decimal percent, decimal difference, RateComparasionType rateComparasionType)
{
Currency = currency;
Percent = percent;
Difference = difference;
RateComparasionType = rateComparasionType;
}
开发者ID:riberk,项目名称:CommonCC,代码行数:7,代码来源:RateComparison.cs
示例20: Create
public static PaymentGroup Create (Organization organization, DateTime timestamp, Currency currency, Person createdByPerson)
{
return
FromIdentity(SwarmDb.GetDatabaseForWriting().CreatePaymentGroup(organization.Identity, timestamp,
currency.Identity,
System.DateTime.Now, createdByPerson.Identity));
}
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:7,代码来源:PaymentGroup.cs
注:本文中的Currency类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论