示例#1
0
 public Project_Author(
     DTO_Project project = null,
     DTO_Author author = null)
 {
     Project = project;
     Author = author;
 }
示例#2
0
 public Project_Author(
     DTO_Project project = null,
     DTO_Author author   = null)
 {
     Project = project;
     Author  = author;
 }
        private DTO_Project ReadCofFile(string fullPath)
        {
            try
            {
                DTO_Project result = new DTO_Project();

                XDocument data = FileBusiness.XmlHandler.readFromFile(fullPath, BusinessLogic.Config.XML_KEY_COF_HEAD);

                // OVERVIEW INFO =============================================
                var overview = data.Root.Element(XName.Get(BusinessLogic.Config.XML_KEY_COF_HEAD));
                result.ProjectName = overview.Element(XName.Get(BusinessLogic.Config.XML_KEY_COF_ATTRIBUTE_PROJECT_NAME)).Value;
                result.Desc = overview.Value;

                // GROUP INFO ================================================
                var group = data.Root.Element(XName.Get(BusinessLogic.Config.XML_KEY_COF_GROUP));
                result.GroupName = group.Attribute(XName.Get(BusinessLogic.Config.XML_KEY_COF_GROUP_ATTRIBUTE_NAME)).Value;
                foreach (var author in group.Elements(XName.Get(BusinessLogic.Config.XML_KEY_COF_AUTHOR)))
                {
                    DTO_Author dtoAuthor = new DTO_Author();
                    dtoAuthor.Name = author.Attribute(XName.Get(BusinessLogic.Config.XML_KEY_COF_AUTHOR_ATTRIBUTE_NAME)).Value;
                    dtoAuthor.AdditionalInfo = author.Value;
                    result.Authors.Add(dtoAuthor);
                }

                // NOTES =====================================================
                var notes = data.Root.Element(XName.Get(BusinessLogic.Config.XML_KEY_COF_NOTES));
                foreach (var noteDetail in notes.Elements(XName.Get(BusinessLogic.Config.XML_KEY_COF_NOTE_DETAIL)))
                {
                    result.Notes.Add(noteDetail.Value);
                }

                return result;
            }
            catch (Exception)
            {
                return null;
            }
        }