public DataTable GenerateCustomerOrdersDataTable(OrdersList customerOrderList) { DataTable customerOrdersTable = new DataTable(); foreach (CustomerOrderColumnsNames header in Enum.GetValues(typeof(CustomerOrderColumnsNames))) { customerOrdersTable.Columns.Add(header.ToString()); } customerOrdersTable.Columns[CustomerOrderColumnsNames.Delivery_Date.ToString()].DataType = typeof(DateTime); foreach (Order order in customerOrderList.OrderList) { DataRow drow = customerOrdersTable.NewRow(); drow[CustomerOrderColumnsNames.Customer_Name.ToString()] = order.Person.Name; drow[CustomerOrderColumnsNames.Customer_ID.ToString()] = order.Person.ID; drow[CustomerOrderColumnsNames.Order_ID.ToString()] = order.OrderID; drow[CustomerOrderColumnsNames.Delivery_Date.ToString()] = order.OrderDeliveryDate.ToShortDateString(); drow[CustomerOrderColumnsNames.Total_Order_Price.ToString()] = order.GetOrderAmount().ToString(); drow[CustomerOrderColumnsNames.Possible_To_Deliver.ToString()] = Warehouse.CanGetProducts(order).ToString(); customerOrdersTable.Rows.Add(drow); } customerOrdersTable = sortDataTable(customerOrdersTable, CustomerOrderColumnsNames.Delivery_Date.ToString()); return(customerOrdersTable); }//end GenerateCustomerDataTable
private void CustomerOrderDelivery(string orderID) { Order order = marketingManager.GetCustomerOrder(orderID); bool canGetOrder = WarehouseManager.CanGetProducts(order); if (!canGetOrder) { cantDeliverOrder(); } else { WarehouseManager.GetProducts(order); marketingManager.RemoveCustomerOrder(order); Event_CustomerOrdersListUpdate(this, null); } }