本文整理汇总了C#中eRestaurantSystem.DAL.eRestaurantContext类的典型用法代码示例。如果您正苦于以下问题:C# eRestaurantContext类的具体用法?C# eRestaurantContext怎么用?C# eRestaurantContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
eRestaurantContext类属于eRestaurantSystem.DAL命名空间,在下文中一共展示了eRestaurantContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReservationsByEvent
public List<Reservation> ReservationsByEvent(string eventcode)
{
using (eRestaurantContext context = new eRestaurantContext())
{
return context.Reservations.Where(anItem => anItem.EventCode == eventcode).ToList();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例6: SpecialEventByEventCode
public SpecialEvent SpecialEventByEventCode(string eventCode)
{
using (eRestaurantContext context = new eRestaurantContext())
{
return context.SpecialEvents.Find(eventCode);
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例13: SpecialEvent_List
public List<SpecialEvent> SpecialEvent_List()
{
//interfacing with our Context class
using(eRestaurantContext context = new eRestaurantContext())
{
return context.SpecialEvents.ToList();
}
}
示例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();
}
}
示例15: GetLastBillDateTime
public DateTime GetLastBillDateTime()
{
using (var context = new eRestaurantContext())
{
var result = context.Bills.Max(x => x.BillDate);
return result;
}
}