Remove entity from collection without deleting the actual data from the table

Posts   
 
    
kaiboe
User
Posts: 20
Joined: 04-Jul-2006
# Posted on: 29-Nov-2007 10:37:51   

Hi All.

I know this sounds strange. I've experimented around with typed lists, views and entities and have not found a better way so far. I've owned LLBLGen for a year, but have not been able to use it until now. Ok, here it goes.

I have a warecollection which contains wares and a detail entity with batchnumbers. This is connected to a DevEx XtraGrid and it looks great. There's a button on each row. When the user click this, the waredata is copied into a Generic class connected to a list. This is my code for this:


 WareEntity currentWare = (WareEntity)this.bsWareWithBatch.Current;
 if (currentWare == null)
 {
    // errmsg goes here
    return;
 }

 string wareno = currentWare.Warenr;
 string name = currentWare.Name;
 SelectedWaresList.Add(new SelectedWare(wareno, name));

And now to my point. I need to remove the selected ware from the grid so that the user dosen't select the same row twice. I had this functionality in my own custom objects before I started using LLBLGen, but would prefer to stick to LLBLGen as much as possible and don't want to go down that path again.

Any suggestions ?

TIA Best wishes Kai Bohli Norway

kaiboe
User
Posts: 20
Joined: 04-Jul-2006
# Posted on: 29-Nov-2007 11:18:12   

I just found out that I could use the bindingsource's remove method. As long as I don't save the entities, I'll be fine.

Best wishes Kai Bohli