paulthepaddy
Well-known member
hi guys, i'm looking to improve some code and get a little bit more specific with it.
The CheckedListBox holds a list of cars and the DataGridView shows the cars Car.Orders
Here's the code i'm using, this code doesn't do everything i need it to, but it worked to allow me to continue creating and finish the form.
Should i store the Return results into a variable then bind it or is it just the same making the data source the direct results?
EDIT : Sorry i really should have mentioned im Using Entity Framework.
I also want to test each car for 3 values:
1: Is the car fully paid(if it has no outstanding work to be invoiced then no point testing it for anything else) Car.FullyPaid = False
2: Does it Have Any orders for this customer,(again if no orders exist for the customer, then no point in searching further) Car.Orders.Department_ID = Invoice.Department_ID, im pretty sure i have to use lambda if not please advise
3: If the order belongs to the selected customer, has it been Order.Invoiced,(im not worried if the order has been paid, if it has been invoiced then it needs chased up, not put onto a new invoice)
i tried searching through the orders and selecting the Order.Car but it would add the car each time their was an order that passed, ending up in the same car being added multiple times
'Me.clbCars.DataSource = From Order As Order In db.Orders Where Order.Department_ID = Invoice.Department_ID Select Order.Car
and Finally, the search results then adds the cars to the CheckedListBox and the DataGridView shows the cars orders, but it is show all the orders not just the orders that passed the search, i understand why this is happening, but any idea how i can refine the search to do these things.
sorry for big post, but i always try to make it very clear what i'm trying to do and what is happening
Thanks in advance for any reply's and help
The CheckedListBox holds a list of cars and the DataGridView shows the cars Car.Orders
Here's the code i'm using, this code doesn't do everything i need it to, but it worked to allow me to continue creating and finish the form.
Should i store the Return results into a variable then bind it or is it just the same making the data source the direct results?
EDIT : Sorry i really should have mentioned im Using Entity Framework.
I also want to test each car for 3 values:
1: Is the car fully paid(if it has no outstanding work to be invoiced then no point testing it for anything else) Car.FullyPaid = False
2: Does it Have Any orders for this customer,(again if no orders exist for the customer, then no point in searching further) Car.Orders.Department_ID = Invoice.Department_ID, im pretty sure i have to use lambda if not please advise
3: If the order belongs to the selected customer, has it been Order.Invoiced,(im not worried if the order has been paid, if it has been invoiced then it needs chased up, not put onto a new invoice)
i tried searching through the orders and selecting the Order.Car but it would add the car each time their was an order that passed, ending up in the same car being added multiple times
'Me.clbCars.DataSource = From Order As Order In db.Orders Where Order.Department_ID = Invoice.Department_ID Select Order.Car
VB.NET:
'For the moment, selects the cars that have ordernumbers for the selected customer(department)
Me.clbCars.DataSource = From Car In db.Cars Where Car.FullyPaid = False AndAlso Car.Orders.Any(Function(ord As Order) ord.Department_ID = Invoice.Department_ID)
and Finally, the search results then adds the cars to the CheckedListBox and the DataGridView shows the cars orders, but it is show all the orders not just the orders that passed the search, i understand why this is happening, but any idea how i can refine the search to do these things.
sorry for big post, but i always try to make it very clear what i'm trying to do and what is happening
Thanks in advance for any reply's and help
Last edited: