Esempio n. 1
0
 private ChildrenCollection GetPath(ChildrenCollection entities)
 {
     entities.Insert(0, this);
     if (this.Parent != null)
     {
         entities = Parent.GetPath(entities);
     }
     return(entities);
 }
Esempio n. 2
0
        internal void PostAttributes()
        {
            ChildrenCollection attrs = this.attributes;

            for (int i = 0; i < attrs.Count; i++)
            {
                Attribute a = (Attribute)attrs[i];
                if (a.IsModified)
                {
                    a.Post();
                }
            }
        }
Esempio n. 3
0
        /*public new object this[string attributeName]
         *      {
         *              get
         *              {
         *                      ChildrenCollection attrs = Attributes;
         *                      for (int i = 0; i < attrs.Count; i++)
         *                      {
         *                              Attribute a = (Attribute)attrs[i];
         *                              if (a.Name.Equals(attributeName)) return a.GetValue();
         *                      }
         *                      throw new Exception("У объекта " + this.Name + " отсутствует свойство " + attributeName);
         *              }
         *      }
         *      object IBaseClass.this[string attributeName]
         *      {
         *              get
         *              {
         *                      return this[attributeName];
         *              }
         *      }*/
        public Attribute GetAttribute(int ID)
        {
            ChildrenCollection attrs = Attributes;

            for (int i = 0; i < attrs.Count; i++)
            {
                Attribute a = (Attribute)attrs[i];
                if (a.Id.Equals(ID))
                {
                    return(a);
                }
            }
            return(null);
        }
Esempio n. 4
0
        public Attribute GetAttribute(string attributeName)
        {
            ChildrenCollection attrs = Attributes;

            for (int i = 0; i < attrs.Count; i++)
            {
                Attribute a = (Attribute)attrs[i];
                if (a.Name.Equals(attributeName))
                {
                    return(a);
                }
            }
            return(null);
        }
Esempio n. 5
0
 private string ToDisplay(Parser[] pf)
 {
     if (pf != null)
     {
         string list_string = "";
         for (int i = 0; i < pf.Length; i++)
         {
             if (pf[i].Type == ParseType.Delimeter)
             {
                 list_string += pf[i].Value;
             }
             else
             {
                 if (pf[i].Value == "Name")
                 {
                     list_string += this.Name;
                 }
                 else if (pf[i].Value == "Id")
                 {
                     list_string += this.Id.ToString();
                 }
                 else
                 {
                     ChildrenCollection attrs = this.Attributes;
                     bool finded = false;
                     for (int j = 0; j < attrs.Count; j++)
                     {
                         Attribute a = (Attribute)attrs[j];
                         if (a.Name.Equals(pf[i].Value))
                         {
                             list_string += a.Value;
                             finded       = true;
                             break;
                         }
                     }
                     if (!finded)
                     {
                         list_string += pf[i].Value;
                     }
                 }
             }
         }
         return(list_string);
     }
     else
     {
         return(this.ToString());
     }
 }
Esempio n. 6
0
        //public Attribute GetAttributeForModify(string attributeName)
        //{
        //    ChildrenCollection attrs = this.Attributes;
        //    for (int i = 0; i < attrs.Count; i++)
        //    {
        //        Attribute a = (Attribute)attrs[i];
        //        if (a.Name == attributeName)
        //        {
        //            if (a.Owner == this)
        //            {
        //                a.Load();
        //                return a;
        //            }
        //            else
        //            {
        //                Attribute new_a = (Attribute)Manager.NewObject("ATTRIBUTE");
        //                new_a.Owner = this;
        //                new_a.Parent = a;
        //                return new_a;
        //            }
        //        }
        //    }
        //    return null;
        //}
        public Attribute GetAttributeForView(string attributeName)
        {
            ChildrenCollection attrs = this.Attributes;

            for (int i = 0; i < attrs.Count; i++)
            {
                Attribute a = (Attribute)attrs[i];
                if (a.Name == attributeName)
                {
                    if (a.Owner == this)
                    {
                        return(a);
                    }
                    else
                    {
                        throw new Exception("јттрибут " + attributeName + " не существует");
                    }
                }
            }
            return(null);
        }
Esempio n. 7
0
        public ChildrenCollection GetPath()
        {
            ChildrenCollection entities = new ChildrenCollection();

            return(this.GetPath(entities));
        }