• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DAL.eRestaurantContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中eRestaurantSystem.DAL.eRestaurantContext的典型用法代码示例。如果您正苦于以下问题:C# eRestaurantContext类的具体用法?C# eRestaurantContext怎么用?C# eRestaurantContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



eRestaurantContext类属于eRestaurantSystem.DAL命名空间,在下文中一共展示了eRestaurantContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ReservationsByEvent

 public List<Reservation> ReservationsByEvent(string eventcode)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         return context.Reservations.Where(anItem => anItem.EventCode == eventcode).ToList();
     }
 }
开发者ID:rgraham15,项目名称:Practice-Repo,代码行数:7,代码来源:eRestaurantController.cs


示例2: CategoryMenuItems_List

        public List<CategoryMenuItems> CategoryMenuItems_List()
        {
            using (var context = new eRestaurantContext())
            {

                //query status
                var results = from category in context.MenuCategories
                              orderby category.Description
                              select new CategoryMenuItems() //DTO
                              {
                                  Description = category.Description,
                                  MenuItems = from row in category.MenuItems //collection of navigated rows of ICollection
                                                //in Special Event entity

                                                select new MenuItem() //POCO class
                                                {
                                                    Description = row.Description,
                                                    Price =row.CurrentPrice,
                                                    Calories =row.Calories,
                                                    Comment = row.Comment

                                                }
                              };
                return results.ToList();
            }
        }
开发者ID:bartykbayev1,项目名称:InClassDemos,代码行数:26,代码来源:AdminController.cs


示例3: GetReservationsByDate

        public List<ReservationsByDate> GetReservationsByDate(string reservationdate)
        {
            using (var context = new eRestaurantContext())
            {
                //Linq is not very playful or cooperative with
                //DateTime

                //extract the year, month and day ourselves out
                //of the passed parameter value
                int theYear = (DateTime.Parse(reservationdate)).Year;
                int theMonth = (DateTime.Parse(reservationdate)).Month;
                int theDay = (DateTime.Parse(reservationdate)).Day;

                var results = from eventitem in context.SpecialEvents
                              orderby eventitem.Description
                              select new ReservationsByDate() //a new instance for each specialevent row on the table
                              {
                                  Description = eventitem.Description,
                                  Reservations = from row in eventitem.Reservations
                                                 where row.ReservationDate.Year == theYear
                                                   && row.ReservationDate.Month == theMonth
                                                   && row.ReservationDate.Day == theDay
                                                 select new ReservationDetail() // a new for each reservation of a particular specialevent code
                                                 {
                                                     CustomerName = row.CustomerName,
                                                     ReservationDate = row.ReservationDate,
                                                     NumberInParty = row.NumberInParty,
                                                     ContactPhone = row.ContactPhone,
                                                     ReservationStatus = row.ReservationStatus
                                                 }

                              };
                return results.ToList();
            }
        }
开发者ID:DilpreetSandhu,项目名称:InClassDemos-master,代码行数:35,代码来源:AdminController.cs


示例4: GetReservationsByDate

        public List<ReservationByDate> GetReservationsByDate(string reservationdate)
        {
            using (var context = new eRestaurantContext())
            {
                int theYear =(DateTime.Parse(reservationdate)).Year;
                int theMonth =(DateTime.Parse(reservationdate)).Month;
                int theDay =(DateTime.Parse(reservationdate)).Day;
                //query syntax
                var results = from item in context.SpecialEvents
                              orderby item.Description
                              select new ReservationByDate()
                              {
                                    Description = item.Description,
                                    Reservations = from r in item.Reservations
                                                   where r.ReservationDate.Year == theYear
                                                     && r.ReservationDate.Month == theMonth
                                                     && r.ReservationDate.Day == theDay
                                                    select new ReservationDetail()
                                                    {
                                                        CustomerName = r.CustomerName,
                                                        ReservationDate = r.ReservationDate,
                                                        NumberInParty = r.NumberInParty,
                                                        ContactPhone = r.ContactPhone,
                                                        ReservationStatus = r.ReservationStatus,
                                                    }

                              };
                return results.ToList();
            }
        }
开发者ID:mcharlebois2,项目名称:InClassDemos,代码行数:30,代码来源:AdminController.cs


示例5: CategoryMenuItems_List

        public List<eRestaurantSystem.DAL.Entities.DTOs.CategoryMenuItems> CategoryMenuItems_List()
        {
            using (var context = new eRestaurantContext())
            {

                //Query syntax

                var result = from category in context.MenuCategories
                             orderby category.Description
                             select new eRestaurantSystem.DAL.Entities.DTOs.CategoryMenuItems() //DTO
                             {
                                 Description = category.Description,
                                 MenuItems = from row in category.MenuItems //virtual property ......collection of navigated rows of ICollection in SpecialEvent
                                                select new MenuItem() //POCO
                                                {
                                                    Description = row.Description,
                                                    Price = row.CurrentPrice,
                                                    Calories = row.Calories,
                                                    Comment = row.Comment
                                                }

                             };
                return result.ToList();
            }
        }
开发者ID:zzisha1,项目名称:InClassDemos,代码行数:25,代码来源:AdminController.cs


示例6: SpecialEventByEventCode

 public SpecialEvent SpecialEventByEventCode(string eventCode)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         return context.SpecialEvents.Find(eventCode);
     }
 }
开发者ID:RelSavo,项目名称:Temp2,代码行数:7,代码来源:eRestaurantController.cs


示例7: GetReservationsByDate

        public List<ReservationByDate> GetReservationsByDate(string reservationdate)
        {
            using (var context = new eRestaurantContext())
            {
                //remember Linq does not like using DateTime casting
                int theYear = (DateTime.Parse(reservationdate)).Year;
                int theMonth = (DateTime.Parse(reservationdate)).Month;
                int theDay = (DateTime.Parse(reservationdate)).Day;

                var results = from item in context.SpecialEvents
                              orderby item.Description
                              select new ReservationByDate()//DTO
                              {
                                  Description = item.Description,
                                  Reservation = from row in item.Reservations //collection of navigated rows of collection
                                                 where row.ReservationDate.Year == theYear
                                                   && row.ReservationDate.Month == theMonth
                                                   && row.ReservationDate.Day == theDay
                                                   select new ReservationDetail() //POCO
                                                   {
                                                       CustomerName = row.CustomerName,
                                                       ReservationDate = row.ReservationDate,
                                                       NumberInParty = row.NumberInParty,
                                                       ContactPhone = row.ContactPhone,
                                                       ReservationStatus = row.ReservationStatus
                                                   }
                              };
                return results.ToList();
            }
        }
开发者ID:SuperBigL,项目名称:InClassDemos,代码行数:30,代码来源:AdminController.cs


示例8: GetCategoryMenuItems_List

        public List<eRestaurantSystem.Entities.DTOs.CategoryMenuItems> GetCategoryMenuItems_List()
        {
            using (var context = new eRestaurantContext())
            {
                //remember LINQ does not like using DateTime casting

                //Query syntax
                var results = from category in context.MenuCategories
                              orderby category.Description
                              select new eRestaurantSystem.Entities.DTOs.CategoryMenuItems() //DTO
                              {
                                  Description = category.Description,
                                  MenuItems = from row in category.MenuItems

                                                 select new MenuItem()
                                                 {
                                                     Description = row. Description,
                                                      Price = row.CurrentPrice,
                                                      Calories = row.Calories,
                                                      Comment = row.Comment
                                                 }
                              };
                return results.ToList();
            }
        }
开发者ID:gthind4,项目名称:InClassDemo,代码行数:25,代码来源:AdminController.cs


示例9: using

        public List<WaiterBilling>GetWaiterBillReport()
        {
            using (eRestaurantContext context = new eRestaurantContext())
            {

                var results = from abillrow in context.Bills//context? 1. put context
                              where abillrow.BillDate.Month == 5
                              orderby abillrow.BillDate,
                                      abillrow.Waiter.LastName,
                                      abillrow.Waiter.FirstName
                              select new WaiterBilling() //3.put class name
                              {
                                  BillDate =  abillrow.BillDate.Year +"/"+
                                                 abillrow.BillDate.Month +"/"+
                                                 abillrow.BillDate.Day,
                                  WaiterName = abillrow.Waiter.LastName + ", " +
                                               abillrow.Waiter.FirstName,
                                  BillID = abillrow.BillID,
                                  BillTotal = abillrow.Items.Sum(eachbillitemrow =>  //billitem=>item?
                                            eachbillitemrow.Quantity * eachbillitemrow.SalePrice),
                                  PartySize = abillrow.NumberInParty,
                                  Contact = abillrow.Reservation.CustomerName
                              }; //2. put ;

             return results.ToList();

            }
        }
开发者ID:swu18,项目名称:InClassDemo,代码行数:28,代码来源:AdminController.cs


示例10: ReservationByTime

 public List<ReservationCollection> ReservationByTime(DateTime date)
 {
     using (var context = new eRestaurantContext())
     {
         var result = (from data in context.Reservations
                       where data.ReservationDate.Year == date.Year &&
                             data.ReservationDate.Month == date.Month
                             && data.ReservationDate.Day == date.Day
                           //&& data.ReservationDate.Hour == ti
                             && data.ReservationStatus == Reservation.Booked
                       select new ReservationSummary()
                       {
                           ID = data.ReservationID,
                           Name = data.CustomerName,
                           Date = data.ReservationDate,
                           NumberInParty = data.NumberInParty,
                           Status = data.ReservationStatus,
                           Event = data.Event.Description,
                           Contact = data.ContactPhone
                       }).ToList();
         var finalREsult = from item in result
                           orderby item.NumberInParty
                           group item by item.Date.Hour into itemGroup
                           select new ReservationCollection()
                           {
                               Hour = itemGroup.Key,
                               Reservations = itemGroup.ToList()
                           };
         return finalREsult.OrderBy(x => x.Hour).ToList();
     }
 }
开发者ID:SuperBigL,项目名称:InClassDemos,代码行数:31,代码来源:SeatingController.cs


示例11: Reservations_List

 public List<Reservation> Reservations_List()
 {
     //interfacing with our context class.DbContext, ties into entity framework.
     using (eRestaurantContext context = new eRestaurantContext())
     {
         return context.Reservations.ToList();
     }
 }
开发者ID:rgraham15,项目名称:Practice-Repo,代码行数:8,代码来源:eRestaurantController.cs


示例12: SpecialEvent_List

 public List<SpecialEvent> SpecialEvent_List()
 {
     //interfacing with our context class.DbContext, ties into entity framework.
     using (eRestaurantContext context = new eRestaurantContext())
     {
         return context.SpecialEvents.ToList();
     }
 }
开发者ID:rgraham15,项目名称:Practice-Repo,代码行数:8,代码来源:eRestaurantController.cs


示例13: SpecialEvent_List

 public List<SpecialEvent> SpecialEvent_List()
 {
     //interfacing with our Context class
     using(eRestaurantContext context = new eRestaurantContext())
     {
         return context.SpecialEvents.ToList();
     }
 }
开发者ID:kmavko1,项目名称:ClassDemos,代码行数:8,代码来源:eRestaurantController.cs


示例14: Reservation_List

 public List<SpecialEvent> Reservation_List()
 {
     //interfacing with our context class which inherits from DbContext 
     using (eRestaurantContext context = new eRestaurantContext())
     {
         return context.Reservations.ToList();
     }
 }
开发者ID:awarraich1,项目名称:RepoPractice3,代码行数:8,代码来源:eRestaurantController.cs


示例15: GetLastBillDateTime

 public DateTime GetLastBillDateTime()
 {
     using (var context = new eRestaurantContext())
     {
         var result = context.Bills.Max(x => x.BillDate);
         return result;
     }
 }
开发者ID:SuperBigL,项目名称:InClassDemos,代码行数:8,代码来源:AdminController.cs


示例16: Reservation_List

 public List<Reservation> Reservation_List()
 {
     //interfacing with our Context class
     using (eRestaurantContext context = new eRestaurantContext())
     {
         return context.Reservations.ToList();
     }
 }
开发者ID:SeymoreThrottle,项目名称:DVCSExercise,代码行数:8,代码来源:eRestaurantController.cs


示例17: SpecialEvents_Update

 public void SpecialEvents_Update(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         context.Entry<SpecialEvent>(context.SpecialEvents.Attach(item)).State =System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
开发者ID:SeymoreThrottle,项目名称:DVCSExercise,代码行数:8,代码来源:eRestaurantController.cs


示例18: GetLastBillDateTime

 public DateTime GetLastBillDateTime()
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         var result = context.Bills.Max(eachBillrow => eachBillrow.BillDate);
         return result;
     }
 }
开发者ID:swu18,项目名称:InClassDemo,代码行数:8,代码来源:AdminController.cs


示例19: SpecialEvents_Delete

 public void SpecialEvents_Delete(SpecialEvent item)
 {
     using (eRestaurantContext context = new eRestaurantContext())
     {
         SpecialEvent existing = context.SpecialEvents.Find(item.EventCode);
         context.SpecialEvents.Remove(existing);
         context.SaveChanges();
     }
 }
开发者ID:RelSavo,项目名称:Temp2,代码行数:9,代码来源:eRestaurantController.cs


示例20: Waiters_List

 public List<Waiter> Waiters_List()
 {
     using (var context = new eRestaurantContext())
     {
         var results = from item in context.Waiters
                       orderby item.LastName, item.FirstName
                       select item;
         return results.ToList();  //none, 1 or more rows
     }
 }
开发者ID:dkowalczuk1,项目名称:0b_InClassDemos-byDon,代码行数:10,代码来源:AdminController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# eSARDAL.DCFIEntities类代码示例发布时间:2022-05-26
下一篇:
C# DAL.RestaurantContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap