本文整理汇总了C#中Price类的典型用法代码示例。如果您正苦于以下问题:C# Price类的具体用法?C# Price怎么用?C# Price使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Price类属于命名空间,在下文中一共展示了Price类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItemPriceModel
/// <summary>
/// Gets the item price model.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="lowestPrice">The lowest price.</param>
/// <param name="tags">Additional tags for promotion evaluation</param>
/// <returns>price model</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
public PriceModel GetItemPriceModel(Item item, Price lowestPrice, Hashtable tags)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
if (lowestPrice == null)
{
return new PriceModel();
}
var price = lowestPrice.Sale ?? lowestPrice.List;
var discount = _client.GetItemDiscountPrice(item, lowestPrice, tags);
var priceModel = CreatePriceModel(price, price - discount, UserHelper.CustomerSession.Currency);
priceModel.ItemId = item.ItemId;
//If has any variations
/* performance too slow with this method, need to store value on indexing instead
if (CatalogHelper.CatalogClient.GetItemRelations(item.ItemId).Any())
{
priceModel.PriceTitle = "Starting from:".Localize();
}
* */
return priceModel;
}
示例2: ToViewModel
public static Product ToViewModel(this DataContracts.Product product, Price price)
{
var productViewModel = new Product();
if (product.EditorialReviews != null)
{
var editorialReview = product.EditorialReviews.FirstOrDefault(er => !string.IsNullOrEmpty(er.ReviewType) && er.ReviewType.Equals("quickreview", StringComparison.OrdinalIgnoreCase));
if (editorialReview != null)
{
productViewModel.Description = editorialReview.Content;
}
}
if (product.PrimaryImage != null)
{
productViewModel.FeaturedImage = product.PrimaryImage.ToViewModel();
}
productViewModel.Id = product.Id;
productViewModel.Price = price;
productViewModel.Sku = product.Code;
if (product.Seo != null)
{
var seo = product.Seo.FirstOrDefault(s => !string.IsNullOrEmpty(s.Keyword));
if (seo != null)
{
productViewModel.Slug = seo.Keyword;
}
}
productViewModel.Title = product.Name;
return productViewModel;
}
示例3: TestAddition
public void TestAddition()
{
var testPrice1 = new Price(100, CurrencyCode.USD);
var testPrice2 = new Price(100, CurrencyCode.RUB);
var testPrice3 = new Price(102.674, CurrencyCode.USD);
Assert.AreEqual(testPrice1 + testPrice2, testPrice3);
}
示例4: AddPrice
public HtmlString AddPrice(List<Price> oldPrices, Price newPrice)
{
List<Price> result = new List<Price>();
DateTime endingDatePrevious = newPrice.StartingDate.AddDays(-1);
if (oldPrices != null)
{
if (oldPrices.All(price => !price.EndingDate.HasValue || newPrice.StartingDate > price.EndingDate.Value))
{
Price currentPrice = oldPrices.FirstOrDefault(price => !price.EndingDate.HasValue);
if (currentPrice != null)
{
currentPrice.EndingDate = endingDatePrevious;
}
}
else
{
Price currentPrice = oldPrices.FirstOrDefault(price => price.EndingDate > newPrice.StartingDate);
DateTime? oldEndingDate = currentPrice.EndingDate;
currentPrice.EndingDate = endingDatePrevious;
if (newPrice.EndingDate.HasValue && oldEndingDate > newPrice.EndingDate.Value)
{
result.Add(new Price() { Article = currentPrice.Article, BasePrice = currentPrice.BasePrice, StartingDate = newPrice.EndingDate.Value.AddDays(1), EndingDate = oldEndingDate });
}
}
result.AddRange(oldPrices);
}
result.Add(newPrice);
return result.ToHtmlJson();
}
示例5: OriginQuotation
public OriginQuotation(Instrument instrument, CollectorQuotation cq)
{
this.modifyState = ModifyState.Added;
this.instrument = instrument;
this.timestamp = cq.Timestamp;
this.ask = Price.CreateInstance(cq.Ask, instrument.NumeratorUnit, instrument.Denominator);
this.bid = Price.CreateInstance(cq.Bid, instrument.NumeratorUnit, instrument.Denominator);
this.high = Price.CreateInstance(cq.High, instrument.NumeratorUnit, instrument.Denominator);
this.low = Price.CreateInstance(cq.Low, instrument.NumeratorUnit, instrument.Denominator);
this.volume = cq.Volume;
this.totalVolume = cq.TotalVolume;
this.origin = instrument.CalculateOrigin(this.ask, this.bid, instrument.OriginQReceived != null);
//Special handle, it's not so strict
//NOTE: Has problem for session clear !
if (this.origin == null && instrument.OriginQReceived != null)
{
if (this.ask == null) this.ask = this.instrument.OriginQReceived.ask;
if (this.bid == null) this.bid = this.instrument.OriginQReceived.bid;
this.origin = instrument.CalculateOrigin(this.ask, this.bid, false);
}
this.FilterErrorHighLow(instrument, false);
}
示例6: CaptureAction
public static CaptureResponse CaptureAction(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
IOffAmazonPaymentsService service, string amazonAuthorizationId, string orderAmount, string orderReferenceId, int indicator, string providerId, string creditAmountString)
{
//initiate the capture request
CaptureRequest captureRequest = new CaptureRequest();
captureRequest.SellerId = propertiesCollection.MerchantID;
captureRequest.AmazonAuthorizationId = amazonAuthorizationId;
Price price = new Price();
price.Amount = orderAmount;
price.CurrencyCode = propertiesCollection.CurrencyCode;
captureRequest.CaptureAmount = price;
captureRequest.CaptureReferenceId = orderReferenceId.Replace('-', 'c') + "captureRef" + indicator.ToString();
if (!String.IsNullOrEmpty(providerId) && !String.IsNullOrEmpty(creditAmountString))
{
ProviderCredit providerCredit = new ProviderCredit();
providerCredit.ProviderId= providerId;
Price creditAmount = new Price();
creditAmount.Amount = creditAmountString;
creditAmount.CurrencyCode = propertiesCollection.CurrencyCode;
providerCredit.CreditAmount= creditAmount;
ProviderCreditList providerCreditList = new ProviderCreditList();
providerCreditList.member = new List<ProviderCredit>();
providerCreditList.member.Add(providerCredit);
captureRequest.ProviderCreditList = providerCreditList;
}
return CaptureSample.InvokeCapture(service, captureRequest);
}
示例7: Decode
public static Price Decode(IByteReader stream)
{
Price decodedPrice = new Price();
decodedPrice.N = Int32.Decode(stream);
decodedPrice.D = Int32.Decode(stream);
return decodedPrice;
}
示例8: fromApp
public void fromApp(QuickFix.Message message, SessionID sessionID)
{
// receiving messages
Symbol sym = new Symbol();
message.getField(sym);
Tick k = new TickImpl(sym.getValue());
{
// bid
BidPx bp = new BidPx();
BidSize bs = new BidSize();
k.bid = (decimal)bp.getValue();
k.bs = (int)message.getField(bs).getValue();
}
{
// ask
OfferPx op = new OfferPx();
OfferSize os = new OfferSize();
k.ask = (decimal)op.getValue();
k.os = (int)message.getField(os).getValue();
}
{
// last
Price price = new Price();
message.getField(price);
k.trade = (decimal)price.getValue();
}
tl.newTick(k);
//ClOrdID clOrdID = new ClOrdID();
//message.getField(clOrdID);
}
示例9: frmNewMember
public frmNewMember()
{
InitializeComponent();
price = new Price();
members = new Member();
cards = new Cards();
cardUsage = new CardUsage();
}
示例10: Order
internal Order(
Price price, OrderState state, Uid market, Uid contract, Side side)
{
Price = price;
State = state;
Market = market;
Contract = contract;
Side = side;
}
示例11: GetFristCol
public Stock GetFristCol(string data)
{
List<Price> prices = new List<Price>();
List<DataItem> items = new List<DataItem>();
string firstCol = string.Empty;
List<string> lines = data.Split('\n').ToList<string>();
for (int i = 2; i < lines.Count; i++)
{
string line = lines[i];
List<string> numStrs = line.Split(' ').ToList<string>();
if (numStrs.Count < 5)
continue;
DataItem item = new DataItem();
Price price = new Price();
price.content = new string[4];
for (int numI = 0; numI < numStrs.Count; numI++)
{
if (numI == 0)
item.content = numStrs[numI];
if (numI > 0 && numI < 5)
{
price.content[numI-1] = numStrs[numI];
if (numI == 3)
{
price.content[numI-1] = numStrs[numI+1];
}
if (numI == 4)
{
price.content[numI - 1] = numStrs[numI-1];
}
}
// if (numI > 0 && numI < 4)
//price.content += ",";
}
items.Add(item);
prices.Add(price);
}
Stock stock = new Stock();
stock.price = new Price[prices.Count];
for (int itemI = 0; itemI < items.Count; itemI++)
{
stock.data += items[itemI].content;
if (itemI != items.Count - 1)
stock.data += ",";
}
for (int priceI = 0; priceI < prices.Count; priceI++)
{
stock.price[priceI] = prices[priceI]; // += "[" + prices[priceI].content + "]";
//if (priceI != prices.Count - 2)
// stock.price += ";";
}
// stock.data = "[" + stock.data + "]";
// stock.price = "[" + stock.price + "]";
return stock;
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
this.Price = Recruit.GetPrice(TroopType.Nobleman);
int heroCount = this.Village.Heroes.Count + 1;
this.Price = new Price(this.Price.Name, 0, this.Price.Wood * heroCount, this.Price.Clay * heroCount, this.Price.Iron * heroCount, this.Price.Population);
}
示例13: NavPosition
public NavPosition(InstrumentSize Size, Price ClosingPriceUsed, Decimal ExchangeRateUsed,
IPriceDetail ClosingPriceRecord, IExRate ExchangeRateRecord)
{
this.Size = Size;
this.ClosingPriceUsed = ClosingPriceUsed;
this.ExchangeRateUsed = ExchangeRateUsed;
this.ClosingPriceRecord = ClosingPriceRecord;
this.ExchangeRateRecord = ExchangeRateRecord;
setCurrentValue();
setCurrentBaseValue();
}
示例14: ToViewModel
public static Price ToViewModel(this DataContracts.Price price)
{
var priceModel = new Price();
priceModel.PricelistId = price.PricelistId;
priceModel.Original = price.List;
priceModel.ProductId = price.ProductId;
priceModel.Sale = price.Sale;
return priceModel;
}
示例15: AddPrice
public bool AddPrice(Price price)
{
bool canAddPrice = IsUniquePrice(price);
if (canAddPrice)
{
ticketsDataSet.Price.AddPriceRow(price.Value);
provider.UpdateAllData();
return true;
}
return false;
}