public object GetData() { var data = new OrderDetailReportData(); using (var connection = SqlConnections.NewFor<OrderRow>()) { var o = OrderRow.Fields; data.Order = connection.TryById<OrderRow>(this.OrderID, q => q .SelectTableFields() .Select(o.EmployeeFullName) .Select(o.ShipViaCompanyName)) ?? new OrderRow(); var od = OrderDetailRow.Fields; data.Details = connection.List<OrderDetailRow>(q => q .SelectTableFields() .Select(od.ProductName) .Select(od.LineTotal) .Where(od.OrderID == this.OrderID)); var c = CustomerRow.Fields; data.Customer = connection.TryFirst<CustomerRow>(c.CustomerID == data.Order.CustomerID) ?? new CustomerRow(); } return data; }
public object GetData() { var data = new OrderDetailReportData(); using (var connection = SqlConnections.NewFor <OrderRow>()) { var o = OrderRow.Fields; data.Order = connection.TryById <OrderRow>(this.OrderID, q => q .SelectTableFields() .Select(o.EmployeeFullName) .Select(o.ShipViaCompanyName)) ?? new OrderRow(); var od = OrderDetailRow.Fields; data.Details = connection.List <OrderDetailRow>(q => q .SelectTableFields() .Select(od.ProductName) .Select(od.LineTotal) .Where(od.OrderID == this.OrderID)); var c = CustomerRow.Fields; data.Customer = connection.TryFirst <CustomerRow>(c.CustomerID == data.Order.CustomerID) ?? new CustomerRow(); } return(data); }