Пример #1
0
 public PBaseObject(int id, PCollection ownerCollection, IPDataModel model)
 {
     this.Id = id;
     _attrs = new Dictionary<string, string>();
     _collects = new List<PCollection>();
     _ownerCollection = ownerCollection;
     Model = model;
     Templates = new PTemplates(this);
 }
Пример #2
0
 public bool FillCollection(PCollection coll)
 {
     List<int> lst = this._db.ListCollectionObjects(coll.Owner.Id, coll.Name);
     foreach (int id in lst)
     {
         this.LoadNewObject(id, coll);
     }
     return true;
 }
Пример #3
0
        private PBaseObject LoadNewObject(int id, PCollection ownerCollection)
        {
            PBaseObject obj = new PBaseObject(id, ownerCollection, this);

            if (ownerCollection != null)
                ownerCollection.InsertObject(obj);
            Dictionary<string, string> attrs = this._db.ListAttributes(id);
            foreach (KeyValuePair<string, string> p in attrs)
            {
                obj.SetAttr(p.Key, p.Value);
            }

            List<string> listColl = this._db.ListCollections(id);

            foreach (string coll in listColl)
            {
                obj.GetCollection(coll, true);
            }

            _listObjects.Add(obj.Id, obj);
            return obj;
        }
Пример #4
0
        public PCollection NewCollection(PBaseObject owner, string name)
        {
            PCollection col = new PCollection(owner, name, this.DeferredLoad, this);
            if (!this.DeferredLoad)
            {
                this.FillCollection(col);
            }

            return col;
        }