private void SetCategoryAsFilter(Category category) { try { if (category != null) { this.currentCategory = category; } else { this.currentCategory = agendaSystem.CategoryList.LookFor(Category.EtqCategoryAll); } if (CategoryList.IsCategoryAll(CurrentCategory)) { this.persons = agendaSystem.PersonsList; } else { persons = new PersonsList(); foreach (var p in agendaSystem.PersonsList) { if (p.HasCategory(CurrentCategory)) { persons.Insert(p); } } } } catch (Exception exc) { Util.MsgError(this, AppInfo.Name, exc.Message); } }
public override PersonsList Import() { string[] parts = null; PersonsList toret = new PersonsList(); var file = new StreamReader( FileName ); string line = file.ReadLine(); while( !file.EndOfStream ) { parts = SplitCsvLine( line ); if ( parts.Length >= 4 ) toret.Insert( new Person( parts[ 0 ], parts[ 1 ], parts[ 2 ], parts[ 3 ] ) ); else throw new ApplicationException( "Bad CSV format" ); line = file.ReadLine(); } file.Close(); return toret; }
private void SetCategoryAsFilter(Category category) { try { if ( category != null ) this.currentCategory = category; else this.currentCategory = agendaSystem.CategoryList.LookFor( Category.EtqCategoryAll ); if ( CategoryList.IsCategoryAll( CurrentCategory ) ) { this.persons = agendaSystem.PersonsList; } else { persons = new PersonsList(); foreach(var p in agendaSystem.PersonsList) { if ( p.HasCategory( CurrentCategory ) ) { persons.Insert( p ); } } } } catch(Exception exc) { Util.MsgError( this, AppInfo.Name, exc.Message ); } }