public OrderViewManager(Order order, ListView list) { InitializeComponent(); textOrderDate.Text = order.OrderDate.ToString("dd-MM-yyyy"); if (order.Status == OrderStatus.NOTYETCARE) { textOrderDate.Text = "No order date yet"; } this.order = order; this.list = list; #region find req, unit and host var req = (from item in bl.GetGuestRequests() where item.GuestRequestKey == order.GuestRequestKey select item).FirstOrDefault(); var unit = (from item in bl.GetHostingUnits() where item.HostingUnitKey == order.HostingUnitKey select item).FirstOrDefault(); var host = (from item in bl.GetHosts() where item.Id == unit.OwnerId select item).FirstOrDefault(); this.DataContext = order; #endregion #region dataContext FirstNameReqText.DataContext = req; LastNameReqText.DataContext = req; GuestReqKeyText.DataContext = req; EntryDateReqText.DataContext = req; ReleaseDateReqText.DataContext = req; FirstNameHostText.DataContext = host; LastNameHostText.DataContext = host; HostKeyText.DataContext = host; HostingUnitNameText.DataContext = unit; HostingUnitKeyText.DataContext = unit; #endregion }
public OrderView(Order order, List<Order> goodOrders, ListView list) { InitializeComponent(); this.order = order; this.goodOrders = goodOrders; this.list = list; if (order.Status == OrderStatus.MAILSENT) Status.Content = "Confirm Order"; if (order.Status == OrderStatus.CARE) Status.Content = "Order is Yours"; req = (from item in bl.GetGuestRequests() where item.GuestRequestKey == order.GuestRequestKey select item).FirstOrDefault(); unit = (from item in bl.GetHostingUnits() where item.HostingUnitKey == order.HostingUnitKey select item).FirstOrDefault(); host = (from item in bl.GetHosts() where item.Id == unit.OwnerId select item).FirstOrDefault(); this.DataContext = req; OrderKeyText.DataContext = order; Icon.DataContext = order; }