public Order GetOrderByID(int order_header_key) { Log.Info("Accessing OrderHeaderBusinessEngine GetOrderHeaderByID function"); return(ExecuteFaultHandledOperation(() => { var order_header_data = _order_header_repo.GetByID(order_header_key); Log.Info("OrderHeaderBusinessEngine GetByID function completed"); if (order_header_data.OrderKey != 0) { var order_header = Map(order_header_data); order_header.Account = _account_be.GetAccountByID(order_header.AccountKey, true); var order_items = new List <OrderItem>(); var order_items_data = _order_item_repo.GetAll(order_header_data); foreach (var ord_item_data in order_items_data) { order_items.Add(MapOrderItemDataToOrderItem(ord_item_data)); //*****!! GET ORDER ITEM ADDRESSES, PRODUCT, TOO!!! ******// -> Done in MapOrderItemDataToOrderItem, dickweed! } order_header.OrderItems = order_items; order_header.Comments = _comment_be.GetCommentsByEntity(order_header_data.OrderKey, QIQOEntityType.Order); return order_header; } else { NotFoundException ex = new NotFoundException(string.Format("Order with key {0} is not in database", order_header_key)); throw new FaultException <NotFoundException>(ex, ex.Message); } })); }
public Invoice GetInvoiceByID(int invoice_key) { Log.Info("Accessing InvoiceBusinessEngine GetInvoiceByID function"); return(ExecuteFaultHandledOperation(() => { var invoice_data = _invoice_repo.GetByID(invoice_key); Log.Info("InvoiceBusinessEngine GetByID function completed"); if (invoice_data.InvoiceKey != 0) { var invoice = Map(invoice_data); invoice.Account = _account_be.GetAccountByID(invoice.AccountKey, true); var invoice_items_data = _invoice_item_repo.GetAll(invoice_data); foreach (var inv_item_date in invoice_items_data) { invoice.InvoiceItems.Add(Map(inv_item_date)); } invoice.Comments = _comment_be.GetCommentsByEntity(invoice_key, QIQOEntityType.Invoice); return invoice; } else { NotFoundException ex = new NotFoundException(string.Format("Invoice with key {0} is not in database", invoice_key)); throw new FaultException <NotFoundException>(ex, ex.Message); } })); }
private List <Comment> GetComments(int acct_key, QIQOEntityType type) { return(_comment_be.GetCommentsByEntity(acct_key, type)); }