本文整理汇总了C#中Mapper.SetPricePolicy方法的典型用法代码示例。如果您正苦于以下问题:C# Mapper.SetPricePolicy方法的具体用法?C# Mapper.SetPricePolicy怎么用?C# Mapper.SetPricePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapper
的用法示例。
在下文中一共展示了Mapper.SetPricePolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseAndSave
public void ParseAndSave()
{
var file = httpContext.Request.Files[0];
IEnumerable<ISupplier> list = null;
Dictionary<string, Dictionary<string, int>> ConversionDictionary = null;
switch (model.Supplier)
{
case "Igal":
list = csvParser.Parse<Igal>(file.InputStream);
ConversionDictionary = Igal.ConversionDictionary;
break;
case "IgalGIA":
list = csvParser.Parse<IgalGIA>(file.InputStream);
ConversionDictionary = IgalGIA.ConversionDictionary;
break;
}
list = list.Distinct().ToList();
var mapper = new Mapper<INV_DIAMONDS_INVENTORY>(ConversionDictionary);
mapper.SetPricePolicy(PricePolicy.Calibrate);
mapper.OurPriceCalibration((decimal)1.07);
var dblist = list.Select(mapper.Map).ToList();
var db = new DatabasePersistence();
db.AddSupplierDiamondList(dblist);
db.SaveOrUpdate();
}
示例2: Map_ShouldMapThePriceCorrectyWithMultiplyByWeightAndCalibration
public void Map_ShouldMapThePriceCorrectyWithMultiplyByWeightAndCalibration()
{
//Arrange
var mapper = new Mapper<INV_DIAMONDS_INVENTORY>(Igal.ConversionDictionary);
mapper.SetPricePolicy(PricePolicy.MultiplyByWeightAndCalibrate);
mapper.OurPriceCalibration((decimal) 1.17);
var igalDiamond = new Igal()
{
Clarity = "SI2",
Culet = "",
Color = "H",
Cut = "VG",
DepthPresentage = (decimal)4.25,
InventoryCode = "12345",
Fluorescence = "MB",
Girdle = "",
Length = (decimal)3.5,
Polish = "G",
Price = 9999,
Report = "EGL IL",
ReportURL = "",
Shape = "BR",
Symmetry = "EX",
Table = (decimal)54.5,
Weight = (decimal)2.41,
Width = (decimal)6.35
};
//Act
var inv_entry = mapper.Map(igalDiamond);
//Assert
inv_entry.totalprice.Should().Be((decimal)28194.1803);
}