Beispiel #1
0
        /// <summary>
        /// Creates a LexEntryType with all the basic properties filled in for the xml (necessary for S/R) and adds it to the dto
        /// </summary>
        private static void CreateLexEntryType(IDomainObjectDTORepository repoDto, string entryTypeGuid, string entryTypeListGuid,
                                               string abbr, string name, string reverseAbbr, DateTime createTime)
        {
            var entryTypeDto = DataMigrationServices.CreatePossibility(repoDto, entryTypeListGuid, entryTypeGuid, name, abbr, createTime, "LexEntryType");
            var letElement   = XElement.Parse(entryTypeDto.Xml);
            //// Add the Reverse Abbreviation
            var sb = new StringBuilder();

            sb.Append("<ReverseAbbr>");
            sb.AppendFormat("<AUni ws=\"en\">{0}</AUni>", reverseAbbr);
            sb.Append("</ReverseAbbr>");
            var reverseAbbrElement = XElement.Parse(sb.ToString());
            var abbrevElement      = letElement.Element("Abbreviation");

            // ReSharper disable once PossibleNullReferenceException -- CreatePossibility always adds an Abbreviation Element
            abbrevElement.AddAfterSelf(reverseAbbrElement);
            entryTypeDto.Xml = letElement.ToString();
            repoDto.Update(entryTypeDto);
        }
Beispiel #2
0
        /// <summary>
        /// Add LexDb.ExtendedNoteTypes possibility list to data
        /// </summary>
        /// <remarks>internal for testing</remarks>
        internal static void AddNewExtendedNoteCluster(IDomainObjectDTORepository repoDto)
        {
            const string extNoteListGuid = "ed6b2dcc-e82f-4631-b61a-6b630de332d0";

            var lexDbDTO = repoDto.AllInstancesSansSubclasses("LexDb").FirstOrDefault();

            if (lexDbDTO == null)
            {
                return;                 // This must be a test that doesn't care about LexDb.
            }
            var lexDbElt = XElement.Parse(lexDbDTO.Xml);

            if (lexDbElt.Element("ExtendedNoteTypes") != null)
            {
                return;                 // probably a test involving NewLangProj which is still languishing at v7000062
            }
            CreateNewLexDbProperty(lexDbElt, "ExtendedNoteTypes", extNoteListGuid);
            // create ExtendedNoteTypes' possibility list
            var lexDbGuid        = lexDbElt.Attribute("guid").Value;
            var culturalGuid     = "7ad06e7d-15d1-42b0-ae19-9c05b7c0b181";
            var grammarGuid      = "30115b33-608a-4506-9f9c-2457cab4f4a8";
            var inflectionalGuid = "d3d28628-60c9-4917-8185-ba64c59f20c4";
            var collocationGuid  = "2f06d436-b1e0-47ae-a42e-1f7b893c5fc2";

            DataMigrationServices.CreatePossibilityList(repoDto, extNoteListGuid, lexDbGuid,
                                                        new[] { new Tuple <string, string, string>("en", "ExtNoteTyp", "Extended Note Types") },
                                                        new DateTime(2016, 6, 27, 18, 48, 18), WritingSystemServices.kwsAnals, new [] { culturalGuid, collocationGuid, grammarGuid, inflectionalGuid });

            // Now add our 4 default possibilities
            var migrationDate = new DateTime(2016, 06, 27, 18, 48, 18);

            DataMigrationServices.CreatePossibility(repoDto, extNoteListGuid, collocationGuid, "Collocation", "Coll.", migrationDate);
            DataMigrationServices.CreatePossibility(repoDto, extNoteListGuid, culturalGuid, "Cultural", "Cult.", migrationDate);
            DataMigrationServices.CreatePossibility(repoDto, extNoteListGuid, grammarGuid, "Grammar", "Gram.", migrationDate);
            DataMigrationServices.CreatePossibility(repoDto, extNoteListGuid, inflectionalGuid, "Inflectional", "Infl.", migrationDate);

            DataMigrationServices.UpdateDTO(repoDto, lexDbDTO, lexDbElt.ToString());
        }