public PartialViewResult Faults() { WCFProductClient pClient = new WCFProductClient(); WCFCart_OrderClient oClient = new WCFCart_OrderClient(); List<Order> orders = oClient.GetOrders(@User.Identity.Name).ToList(); List<OrderProductModel> orderProductsList = new List<OrderProductModel>(); foreach (Order order in orders) { List<Order_Product> orderProducts = oClient.GetOrderProducts(order.ID).ToList(); foreach (Order_Product op in orderProducts) { Product aP = pClient.GetProductByID(op.ProductID); OrderProductModel opM = new OrderProductModel(); opM.ProductID = aP.ID; opM.ProductName = aP.Name; opM.Features = aP.Features; opM.QtyPurchased = op.Quantity; opM.DatePurchased = order.DateOrdered; opM.ExpiryDate = order.DateOrdered.AddYears(2); opM.Status = "Not Available"; if (opM.ExpiryDate > DateTime.Today) { orderProductsList.Add(opM); } } } return PartialView("_ShowFaults",orderProductsList); }
public PartialViewResult ShowOrderDetails(Guid id) { WCFProductClient pClient = new WCFProductClient(); WCFCart_OrderClient oClient = new WCFCart_OrderClient(); @ViewBag.orderID = id; Order cOrder = oClient.GetOrder(id); List<OrderProductModel> orderProductsList = new List<OrderProductModel>(); List<Order_Product> orderProducts = oClient.GetOrderProducts(id).ToList(); foreach (Order_Product op in orderProducts) { Product aP = pClient.GetProductByID(op.ProductID); OrderProductModel opM = new OrderProductModel(); opM.ProductID = aP.ID; opM.ProductName = aP.Name; opM.Features = aP.Features; opM.QtyPurchased = op.Quantity; opM.DatePurchased = cOrder.DateOrdered; opM.ExpiryDate = cOrder.DateOrdered.AddYears(2); Fault f = new WCFFaultClient().GetProductFaultByOrderID(id, aP.ID); if (f != null) { opM.Status = new WCFFaultClient().GetStatusByID(f.Status).Status1; } else { opM.Status = "No Faults Reported"; } Rating r = new WCFProductClient().GetRating(aP.ID, @User.Identity.Name); if (r != null) { opM.Rating = r.Rating1; } else { opM.Rating = 0; } orderProductsList.Add(opM); } return PartialView("_ShowOrderDetails", orderProductsList); }
//need to fix view and status public PartialViewResult ShowOrderDetails(Guid id) { WCFProductClient pClient = new WCFProductClient(); WCFCart_OrderClient oClient = new WCFCart_OrderClient(); Order cOrder = oClient.GetOrder(id); List<OrderProductModel> orderProductsList = new List<OrderProductModel>(); List<Order_Product> orderProducts = oClient.GetOrderProducts(id).ToList(); foreach (Order_Product op in orderProducts) { Product aP = pClient.GetProductByID(op.ProductID); OrderProductModel opM = new OrderProductModel(); opM.ProductID = aP.ID; opM.ProductName = aP.Name; opM.Features = aP.Features; opM.QtyPurchased = op.Quantity; opM.DatePurchased = cOrder.DateOrdered; opM.ExpiryDate = cOrder.DateOrdered.AddYears(2); opM.Status = "Not Available"; orderProductsList.Add(opM); } return PartialView("_ShowOrderDetails", orderProductsList); }