private void DisplayCustomerOrders() { OrderController orderController = new OrderController(); ArrayList orders = orderController.GetCustomerOrders(PortalId, customerNav.CustomerID); if (orders.Count > 0) { orderStatusList = orderController.GetOrderStatuses(); grdOrders.DataSource = orders; grdOrders.DataBind(); } else { lblError.Text = Localization.GetString("NoOrdersFound", this.LocalResourceFile); } }
private DataTable getOrdersData(int orderId, int customerId, int orderStatusId) { OrderController orderController = new OrderController(); //Create Tempory Table DataTable dtTemp = new DataTable(); //Creating Header Row dtTemp.Columns.Add("<b>Order Number</b>"); // 0 dtTemp.Columns.Add("<b>Login</b>"); // 1 dtTemp.Columns.Add("<b>Name</b>"); // 2 dtTemp.Columns.Add("<b>Company(Profile)</b>"); // 3 dtTemp.Columns.Add("<b>Company(Wisdom)</b>"); // 4 dtTemp.Columns.Add("<b>Order Date</b>"); // 5 dtTemp.Columns.Add("<b>Order Total</b>"); // 6 dtTemp.Columns.Add("<b>Status</b>"); // 7 dtTemp.Columns.Add("<b>Product</b>"); // 8 dtTemp.Columns.Add("<b>Delivery</b>"); // 9 dtTemp.Columns.Add("<b>Qty</b>"); // 10 dtTemp.Columns.Add("<b>SubTotal</b>"); // 11 UserController userController = new UserController(); ArrayList orders = new ArrayList(); DataRow drAddItem; if (orderId != -1) { OrderInfo orderInfo = orderController.GetOrder(orderId); ArrayList orderDetailsList = orderController.GetOrderDetails(orderId); UserInfo userInfo = userController.GetUser(this.PortalId, orderInfo.CustomerID); foreach (OrderDetailsInfo orderDetails in orderDetailsList) { drAddItem = dtTemp.NewRow(); drAddItem[0] = orderInfo.OrderID + ""; drAddItem[1] = userInfo.Username; drAddItem[2] = userInfo.DisplayName; drAddItem[3] = userInfo.Profile.GetPropertyValue("Company"); drAddItem[4] = getUserCompanyName(orderInfo.CustomerID); drAddItem[5] = orderInfo.OrderDate.ToString("dd/MM/yyyy HH:mm"); drAddItem[6] = orderInfo.OrderTotal + ""; drAddItem[7] = GetOrderStatus(orderInfo.OrderStatusID, orderInfo.OrderIsPlaced); // drAddItem[7] = orderInfo.sta; drAddItem[8] = getProductName(orderDetails.ModelName, orderDetails.ProdReference); //orderDetails.ModelName; drAddItem[9] = getProdDeliveryMethodStr(orderDetails.ProdDeliveryMethod); drAddItem[10] = orderDetails.Quantity; drAddItem[11] = orderDetails.ProdCost; dtTemp.Rows.Add(drAddItem); } } else if (customerId != -1) { orders = orderController.GetCustomerOrders(this.PortalId, customerId); foreach (OrderInfo orderInfo in orders) { UserInfo userInfo = userController.GetUser(this.PortalId, orderInfo.CustomerID); ArrayList orderDetailsList = orderController.GetOrderDetails(orderInfo.OrderID); foreach (OrderDetailsInfo orderDetails in orderDetailsList) { drAddItem = dtTemp.NewRow(); drAddItem[0] = orderInfo.OrderID + ""; drAddItem[1] = userInfo.Username; drAddItem[2] = userInfo.DisplayName; drAddItem[3] = userInfo.Profile.GetPropertyValue("Company"); drAddItem[4] = getUserCompanyName(orderInfo.CustomerID); drAddItem[5] = orderInfo.OrderDate.ToString("dd/MM/yyyy HH:mm"); drAddItem[6] = orderInfo.OrderTotal + ""; drAddItem[7] = GetOrderStatus(orderInfo.OrderStatusID, orderInfo.OrderIsPlaced); // drAddItem[7] = orderInfo.sta; drAddItem[8] = getProductName(orderDetails.ModelName, orderDetails.ProdReference); //orderDetails.ModelName; drAddItem[9] = getProdDeliveryMethodStr(orderDetails.ProdDeliveryMethod); drAddItem[10] = orderDetails.Quantity; drAddItem[11] = orderDetails.ProdCost; dtTemp.Rows.Add(drAddItem); } } } else if (orderStatusId != -1) { orders = orderController.GetOrders(this.PortalId, orderStatusId); foreach (OrderInfo orderInfo in orders) { UserInfo userInfo = userController.GetUser(this.PortalId, orderInfo.CustomerID); ArrayList orderDetailsList = orderController.GetOrderDetails(orderInfo.OrderID); foreach (OrderDetailsInfo orderDetails in orderDetailsList) { drAddItem = dtTemp.NewRow(); drAddItem[0] = orderInfo.OrderID + ""; drAddItem[1] = userInfo.Username; drAddItem[2] = userInfo.DisplayName; drAddItem[3] = userInfo.Profile.GetPropertyValue("Company"); drAddItem[4] = getUserCompanyName(orderInfo.CustomerID); drAddItem[5] = orderInfo.OrderDate.ToString("dd/MM/yyyy HH:mm"); drAddItem[6] = orderInfo.OrderTotal + ""; drAddItem[7] = GetOrderStatus(orderInfo.OrderStatusID, orderInfo.OrderIsPlaced); // drAddItem[7] = orderInfo.sta; drAddItem[8] = getProductName(orderDetails.ModelName, orderDetails.ProdReference); //orderDetails.ModelName; drAddItem[9] = getProdDeliveryMethodStr(orderDetails.ProdDeliveryMethod); drAddItem[10] = orderDetails.Quantity; drAddItem[11] = orderDetails.ProdCost; dtTemp.Rows.Add(drAddItem); } } } { // Response.Write("<br>" + ((Decimal)drW["VolumeMillionLitres"]).ToString()); } return dtTemp; }