示例#1
0
        internal SLGroup Clone()
        {
            var g = new SLGroup();

            g.Name         = Name;
            g.UniqueName   = UniqueName;
            g.Caption      = Caption;
            g.UniqueParent = UniqueParent;
            g.Id           = Id;

            g.GroupMembers = new List <SLGroupMember>();
            foreach (var gm in GroupMembers)
            {
                g.GroupMembers.Add(gm.Clone());
            }

            return(g);
        }
        internal void FromGroupLevel(GroupLevel gl)
        {
            SetAllNull();

            if (gl.UniqueName != null)
            {
                UniqueName = gl.UniqueName.Value;
            }
            if (gl.Caption != null)
            {
                Caption = gl.Caption.Value;
            }
            if (gl.User != null)
            {
                User = gl.User.Value;
            }
            if (gl.CustomRollUp != null)
            {
                CustomRollUp = gl.CustomRollUp.Value;
            }

            if (gl.Groups != null)
            {
                SLGroup g;
                using (var oxr = OpenXmlReader.Create(gl.Groups))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(Group))
                        {
                            g = new SLGroup();
                            g.FromGroup((Group)oxr.LoadCurrentElement());
                            Groups.Add(g);
                        }
                    }
                }
            }
        }