当前位置: 首页>>代码示例>>C#>>正文


C# Receipt.totalPrice方法代码示例

本文整理汇总了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();
                    }
                }

            }
        }
开发者ID:Bryanoh,项目名称:BSPetShopWebApp,代码行数:37,代码来源:DatabaseConnector.cs


注:本文中的Receipt.totalPrice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。