File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -209,9 +209,20 @@ public string Finish()
209209 // if we have new participant selected, we need to create it in the pplist
210210 if ( participantSelector . IsNewSelected ( ) )
211211 {
212- // add new participant to list
213- row = ppList . NewRow ( ) ;
214- ppList . Rows . Add ( row ) ;
212+ // if new participant is given an id that exists in pplist, throw error
213+ DataRow searchResultRow = ppList . AsEnumerable ( ) . SingleOrDefault ( r => r . Field < string > ( "ppid" ) == ppid ) ;
214+ if ( searchResultRow != null )
215+ {
216+ form . ppidElement . controller . DisplayFault ( ) ;
217+ throw new Exception ( "Participant ID already exists! Enter a new ID or select the existing participant from the dropdown." ) ;
218+ }
219+ // else new id has been entered
220+ else
221+ {
222+ // add new participant to list
223+ row = ppList . NewRow ( ) ;
224+ ppList . Rows . Add ( row ) ;
225+ }
215226 }
216227 // else we update the row with any changes we made in the form
217228 else
You can’t perform that action at this time.
0 commit comments