private void PrintOrders(OrderList orderList, string d) { var o = orderList.Orders; DateTime fDate = DateTime.Parse(d.Substring(0, 2) + "/" + d.Substring(2, 2) + "/" + d.Substring(4, 4)); Console.WriteLine("Orders placed on " + fDate.ToString("D") + "\n"); foreach (var i in o) { Console.WriteLine("Order Number: - - - - - - - " + i.OrderNumber); Console.WriteLine("Customer Name: > > > > > > > " + i.Name); Console.WriteLine("State: - - - - - - - - - - - " + i.StateAbbr); Console.WriteLine("Tax Rate: > > > > > > > > > {0:P}", i.TaxRate/100); Console.WriteLine("Product Type: - - - - - - - " + i.ProductType); Console.WriteLine("Area: > > > > > > > > > > > " + i.Area); Console.WriteLine("Cost Per Square Foot: - - - {0:C}", i.CostPerSquareFoot); Console.WriteLine("Labor Cost Per Square Foot: {0:C}", i.LaborCostPerSquareFoot); Console.WriteLine("-------------------------------------------"); Console.WriteLine("\nTotal material cost is: > > {0:C}", i.MaterialCost); Console.WriteLine("Total labor cost is: - - - - {0:C}", i.LaborCost); Console.WriteLine("Total tax cost is: > > > > > {0:C}\n", i.TaxCost); Console.WriteLine("-------------------------------------------"); Console.WriteLine("\nTotal: {0:C}", i.TotalCost); Console.WriteLine("\n==========================================\n"); } }
public Response<OrderList> GetOrders(string date) { Response<OrderList> response = new Response<OrderList>(); try { if (!OrderExist(date)) { response.Success = false; response.Message = "This order does not exist"; } else { OrderList orderListObj = new OrderList(); orderListObj.Orders = _repo.GetAllOrders(date); response.Success = true; response.Data = orderListObj; } } catch (Exception ex) { response.Success = false; response.Message = "Error occurred."; _repo.LogError(ex); } return response; }