// ORDER methods // Method takes a database order result and populates it with person & inventory item objects public List <Order> PopulateOrders(List <Order> orderList) { // List to be used in the folowing loops List <Order> orders = orderList; foreach (Order order in orders) { // Get a translated customer [data entity object] by searching ny personId Customer orderCustomer = Translators.Customer.ToBusinessObject(_dataAccessObjects.GetCustomerByPersonId(order.Person.PersonId)); // Create a fully populated customer [business layer object], based on the partially populated [data entity object] Customer populatedCustomer = PopulateCustomer(orderCustomer); // Add fully populated person to order order.Person = populatedCustomer; // Search for order items that are associated with the order List <OrderItem> orderItems = Translators.OrderItem.ToBusinessObject(_dataAccessObjects.GetOrderItemByOrderId(order.OrderId)); if (orderItems == null) { continue; } foreach (OrderItem orderItem in orderItems) { // Search for - and populate the catalog information for each inventory item orderItem.CatalogItem = Translators.CatalogItem.ToBusinessObject(_dataAccessObjects.GetCatalogItemByCatalogItemId(orderItem.CatalogItem.CatalogItemId)); } // add populated order item list to order order.ItemList = orderItems; } return(orders); }