Exemple #1
0
        public override bool Parse(XElement xml)
        {
            if (xml == null)
            {
                return(false);
            }

            List <SnippetBCK> snippets = new List <SnippetBCK>();
            int userID = -1;

            xml.ParseNode("UserID", ref userID, false);

            List <XElement> snips = xml.GetNodes("Snippet", false);

            foreach (XElement snip in snips)
            {
                SnippetBCK s = new SnippetBCK();
                s.Parse(snip);
                snippets.Add(s);
            }

            Init(snippets, userID);

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// This is the init/copy method for this class.
        /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object.
        /// </summary>
        /// <param name="objToCopy"></param>
        protected bool Init(SnippetBCK objToCopy)
        {
            if (objToCopy == null)
            {
                return(false);
            }

            //save the values of the properties with private setters:
            ID             = objToCopy.ID;
            CreatorName    = objToCopy.CreatorName;
            OwnerGroupName = objToCopy.OwnerGroupName;
            Title          = objToCopy.OwnerGroupName;
            Description    = objToCopy.Description;
            Code           = objToCopy.Code;
            Created        = objToCopy.Created;
            Modified       = objToCopy.Modified;
            Visibility     = objToCopy.Visibility;
            Properties     = objToCopy.Properties;
            Tags           = objToCopy.Tags;

            return(true);
        }
        public override bool Parse(XElement xml)
        {
            if (xml == null)
                return false;

            List<SnippetBCK> snippets = new List<SnippetBCK>();
            int userID = -1;

            xml.ParseNode("UserID", ref userID, false);

            List<XElement> snips = xml.GetNodes("Snippet", false);         
            foreach (XElement snip in snips)
            {
                SnippetBCK s = new SnippetBCK();
                s.Parse(snip);
                snippets.Add(s);
            }

            Init(snippets, userID);

            return true;
        }
        /// <summary>
        /// This is the init/copy method for this class.
        /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object.
        /// </summary>
        /// <param name="objToCopy"></param>
        protected bool Init(SnippetBCK objToCopy)
        {
            if (objToCopy == null)
                return false;

            //save the values of the properties with private setters:
            ID = objToCopy.ID;
            CreatorName = objToCopy.CreatorName;
            OwnerGroupName = objToCopy.OwnerGroupName;
            Title = objToCopy.OwnerGroupName;
            Description = objToCopy.Description;
            Code = objToCopy.Code;
            Created = objToCopy.Created;
            Modified = objToCopy.Modified;
            Visibility = objToCopy.Visibility;
            Properties = objToCopy.Properties;
            Tags = objToCopy.Tags;

            return true;
        }