Spy GetRandomSpy( SpyList spies) { Random random = new Random(); int index = random.Next( 0, spies.Count - 1 ); return spies[index]; }
internal SortedBindingList<Spy> ApplySortForOperation( SpyList spies ) { SortedBindingList<Spy> list = new Csla.SortedBindingList<Spy>( spies ); switch ( Operation.ID ) { case 1: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Larceny == 0 ) list.RemoveAt( spy ); list.ApplySort( "Larceny", ListSortDirection.Descending ); break; case 2: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Surveillance == 0 ) list.RemoveAt( spy ); list.ApplySort( "Surveillance", ListSortDirection.Descending ); break; case 3: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Reconnaissance == 0 ) list.RemoveAt( spy ); list.ApplySort( "Reconnaissance", ListSortDirection.Descending ); break; case 4: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].MICE == 0 ) list.RemoveAt( spy ); list.ApplySort( "MICE", ListSortDirection.Descending ); break; case 5: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Ambush == 0 ) list.RemoveAt( spy ); list.ApplySort( "Ambush", ListSortDirection.Descending ); break; case 6: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Sabotage == 0 ) list.RemoveAt( spy ); list.ApplySort( "Sabotage", ListSortDirection.Descending ); break; case 7: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Expropriation == 0 ) list.RemoveAt( spy ); list.ApplySort( "Expropriation", ListSortDirection.Descending ); break; case 8: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Inspection == 0 ) list.RemoveAt( spy ); list.ApplySort( "Inspection", ListSortDirection.Descending ); break; case 9: for ( int spy = 0; spy < list.Count; spy++ ) if ( list[spy].Subversion == 0 ) list.RemoveAt( spy ); list.ApplySort( "Subversion", ListSortDirection.Descending ); break; } return list; }