Пример #1
0
 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);
                         }
                     }
                 }
             }
         }
     }
 }