Exemplo n.º 1
0
        public ApplicationGroup CreateGroup(string parent, string name, string description, GroupType groupType, bool isGlobalGroup)
        {
            XmlApplicationGroup ag = new XmlApplicationGroup();

            ag.Key           = System.Guid.NewGuid().ToString();
            ag.Name          = name;
            ag.Description   = description;
            ag.GroupType     = groupType;
            ag.IsGlobalGroup = isGlobalGroup;

            ag.Groups = new Collections.ApplicationGroupCollection(true);

            XmlElement parentNode = null;

            if (isGlobalGroup)
            {
                parentNode = _Service.LoadRoot();
            }
            else
            {
                parentNode = _Service.Load(parent);
            }
            _Service.Save(ag.ToXml(parentNode));

            return(new ApplicationGroup(ag));
        }
Exemplo n.º 2
0
        ///// <summary>
        ///// Saves changes to the current node. Base implementation does nothing
        ///// </summary>
        ///// <param name="parent">parent element</param>
        //public virtual void Update(XmlElement parent)
        //{ }

        //protected System.Collections.ObjectModel.ReadOnlyCollection<T> GetCollection<T>(XmlNodeList nodes, Type innerType)
        //{
        //    List<T> result = new List<T>();
        //    Type t = typeof(T);

        //    foreach (XmlNode item in nodes)
        //    {
        //        result.Add((T)Activator.CreateInstance(t, Activator.CreateInstance(innerType, (XmlElement)item, Factory)));
        //    }

        //    return new System.Collections.ObjectModel.ReadOnlyCollection<T>(result);
        //}

        public void Load(string uniqueName)
        {
            XmlElement e = Service.Load(uniqueName);

            Load(e);
        }