public override IList Elements() { PropertyList propertyList = dataPrototype.Info().CreatePropertyList(); DataField[] keyFields = dataPrototype.Info().GetKeyFields(); if (keyFields.Length > 1) { throw new UnsupportedOperationException(); } for (int i = 0; i < keyFields.Length; i++) { propertyList.AddProperty(keyFields[i].GetFieldName()); } propertyList.AddProperty(dataPrototype.Info().GetTitleField().GetFieldName()); ICollection collection = GetAllDataCollection(propertyList); ArrayList list = new ArrayList(collection == null ? 0 : collection.Count); if (collection != null) { for (IEnumerator i = collection.GetEnumerator(); i.MoveNext();) { DataContent data = (DataContent)i.Current; list.Add( new Element( data.GetDataKey().KeyPartAt(0), data.GetProperty(dataPrototype.Info().GetTitleField().GetFieldName()).ToString() ) ); } } return(list); }
public override String GetKeyRenderer(Object key) { try { PropertyList propertyList = dataPrototype.Info().CreatePropertyList(); propertyList.AddProperty(dataPrototype.Info().GetTitleField().GetFieldName()); DataContent data = GetData(propertyList, key); return(data == null ? "" : data.GetProperty(dataPrototype.Info().GetTitleField().GetFieldName()).ToString()); } catch (Exception e) { Console.WriteLine(e); } return(null); }
public MyProgram(bool Generate, int cadastralCount, int personsCount, int propertyListCount, int propertyCount) : this() { if (Generate) { Random personsR = new Random(100); Random cadR = new Random(101); for (int i = 0; i < personsCount; i++) { Persons.Add(new Person(personsR.Next(personsCount * 10).ToString())); } CadastralArea c = null; PropertyList pl = null; Property p = null; for (int i = 0; i < cadastralCount; i++) { c = new CadastralArea(cadR.Next(cadastralCount + 10)); if (CadastralAreasByID.Add(new CadastralAreaByID(c))) { CadastralAreasByName.Add(new CadastralAreaByName(c)); for (int j = 1; j <= propertyListCount; j++) { pl = new PropertyList(j, c); if (c.AddPropertyList(pl)) { pl.AddOwner(Persons.Find(), 1); for (int k = 0; k < propertyCount; k++) { p = new Property(c.Properties.Count, "Address" + (j + k), "Unknown", pl); p.AddOccupant(pl.Owners.GetRoot().Person); pl.AddProperty(p); } } } } } } }