本文整理汇总了C#中Receipt.totalPrice方法的典型用法代码示例。如果您正苦于以下问题:C# Receipt.totalPrice方法的具体用法?C# Receipt.totalPrice怎么用?C# Receipt.totalPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Receipt
的用法示例。
在下文中一共展示了Receipt.totalPrice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: insertReceipt
internal void insertReceipt(Receipt receip, Customer customer)
{
using (BSPetShopEntities context = new BSPetShopEntities())
{
var customerWithID = from c in context.CustomerSet where c.PhoneNumber.Equals(customer.phonenumber) select c;
context.ReceiptSet.Add(new ReceiptSet() { Totalprice = receip.totalPrice().ToString(), Date = receip.date, Customer_Id = customerWithID.Single().Id }); context.SaveChanges();
foreach (Animal a in receip.animals)
{
Type birdType = typeof(Bird);
Type fishType = typeof(Fish);
var receipt = from r in context.ReceiptSet where r.Date == receip.date && r.Customer_Id == customer.id select r;
if (a.GetType() == birdType)
{
var query = from b in context.BirdSet where b.Id == a.id select b;
foreach (BirdSet b in query)
{
b.Receipt_Id = receipt.Single().Id;
}
context.SaveChanges();
} else
{
var queryF = from f in context.FishSet where f.Id == a.id select f;
foreach (FishSet f in queryF)
{
f.Receipt_Id = receipt.Single().Id;
}
context.SaveChanges();
}
}
}
}