public ReservationItemDetail(IItemData itemData, IReservationItemData reservationItemData, int reservationId, int itemId) { ReservationItem reservationItem = reservationItemData.Get(reservationId, itemId); ReservationId = reservationId; ItemId = itemId; Name = itemData.Get(itemId).Name; Amount = reservationItem.Amount; Price = reservationItem.Price; }
public ReservationChangeItems(ICatagoryData catagoryData, IItemData itemData, IReservationItemData reservationItemData, int reservationId) { ReservationId = reservationId; ReservationItems = reservationItemData.Get(reservationId); IEnumerable <Catagory> catagories = catagoryData.GetAll(); List <ItemsInCatagory> newItemsPerCatagory = new List <ItemsInCatagory>(); foreach (Catagory catagory in catagories) { ItemsInCatagory newItemsInCatory = new ItemsInCatagory(catagoryData, itemData, catagory.Id); if (newItemsInCatory.Items.Count() > 0) { newItemsPerCatagory.Add(newItemsInCatory); } } ItemsPerCatagory = newItemsPerCatagory; }
public ReceiptDetails(IBtwTypeData btwTypeData, IItemData itemData, IReservationData reservationData, IReservationItemData reservationItemData, ITableData tableData, IWaiterData waiterData, int reservationId) { Reservation reservation = reservationData.Get(reservationId); Waitername = waiterData.Get(reservation.WaitorId).Name; StartTime = reservation.StartTime; TableNumber = tableData.Get(reservation.TableId).Number; List <ReservationItemDetail> newReservationItems = new List <ReservationItemDetail>(); IEnumerable <ReservationItem> reservationItems = reservationItemData.Get(reservationId); foreach (ReservationItem reservationItem in reservationItems) { newReservationItems.Add(new ReservationItemDetail(itemData, reservationItemData, reservationItem.ReservationId, reservationItem.ItemId)); } this.reservationItems = newReservationItems; BtwTypes = btwTypeData.GetAll(); }
public ItemsOfReservation(IReservationItemData reservationItemData, ITableData tableData, IItemData itemData, Reservation reservation, bool prepared, bool delivered, int?stationId = null) { TableNumber = tableData.Get(reservation.TableId).Number; List <ReservationItemDetail> newItems = new List <ReservationItemDetail>(); IEnumerable <ReservationItem> reservationItems = reservationItemData.Get(reservation.Id).Where(o => o.Prepared == prepared && o.Delivered == delivered); foreach (ReservationItem reservationItem in reservationItems) { if (stationId != null) { if (itemData.Get(reservationItem.ItemId).StationId == stationId) { newItems.Add(new ReservationItemDetail(itemData, reservationItemData, reservation.Id, reservationItem.ItemId)); } } else { newItems.Add(new ReservationItemDetail(itemData, reservationItemData, reservation.Id, reservationItem.ItemId)); } } Items = newItems; }