Exemple #1
0
        public void Merge(WrapperParam wrapperParam)
        {
            foreach (string author in wrapperParam.Authors)
            {
                if (!Authors.Contains(author))
                {
                    Authors.Add(author);
                }
            }

            // now we need to search for any section and add it into the wrapper AS WELL AS merging same sections of same wrappers together
            foreach (SectionParam section in wrapperParam.SectionDict.Values)
            {
                if (section.DataStructureDict.Count < 1)                 // do not include empty sections
                {
                    continue;
                }

                // section already exists?
                SectionParam finalSection = null;

                foreach (SectionParam tmpSection in SectionDict.Values)
                {
                    if (tmpSection.SectionName == section.SectionName)
                    {
                        finalSection = tmpSection;

                        break;
                    }
                }

                if (finalSection == null)
                {
                    SectionDict.Add(section.SectionName, section);                     // add missing section directly into the wrappers section list
                }
                else
                {
                    finalSection.Merge(section);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Получить полные данные для объекта, включая присоединённые элементы коллекций
        /// </summary>
        /// <returns></returns>
        public void GetFullData(SIDocument document, InfoOwner owner)
        {
            var length = owner.Info.Authors.Count;

            for (int i = 0; i < length; i++)
            {
                var docAuthor = document.GetLink(owner.Info.Authors, i);
                if (docAuthor != null)
                {
                    if (Authors == null)
                    {
                        Authors = new List <AuthorInfo>();
                    }

                    if (!Authors.Contains(docAuthor))
                    {
                        Authors.Add(docAuthor);
                    }
                }
            }

            length = owner.Info.Sources.Count;
            for (int i = 0; i < length; i++)
            {
                var docSource = document.GetLink(owner.Info.Sources, i);
                if (docSource != null)
                {
                    if (Sources == null)
                    {
                        Sources = new List <SourceInfo>();
                    }

                    if (!Sources.Contains(docSource))
                    {
                        Sources.Add(docSource);
                    }
                }
            }
        }