private static IProfile GetProfile(IAccount account, PluginProfile legacyProfile) { var convertedProfileName = String.Concat(legacyProfile.ProfileName, "_converted"); return(account.Profiles.FirstOrDefault(x => x.Name == convertedProfileName) ?? account.Profiles.FirstOrDefault(x => x.Name == legacyProfile.ProfileName)); }
private static IProfile GetProfile(IAccount account, PluginProfile legacyProfile) { var convertedProfileName = String.Format("{0} _re-converted_", legacyProfile.ProfileName); return(account.Profiles.FirstOrDefault(x => x.Name == convertedProfileName) ?? account.Profiles.FirstOrDefault(x => x.Name == legacyProfile.ProfileName)); }
protected override void ExecuteForProfile(PluginProfile legacyProfile, IAccount account) { var profile = GetProfile(account, legacyProfile); if (profile == null) { return; } MigrateRevisions(legacyProfile, profile); profile.Save(); }
private void MigrateBugs(IStorageRepository storageRepository, PluginProfile legacyProfile) { var bugs = _context.ExternalReferences .Where(r => r.EntityTypeID == BugzillaConstants.BugEntityTypeId) .Where(r => r.PluginProfileID == legacyProfile.PluginProfileID) .ToList() .Distinct(new ExternalIdComparer()) .Join(_context.Bugs, e => e.TpID, b => b.BugID, (e, b) => new { TpId = b.BugID, ExternalId = e.ExternalID }) .ToList(); var tpBugs = new List <int>(); foreach (var externalReference in bugs) { var tpId = externalReference.TpId; var externalId = externalReference.ExternalId; storageRepository.Get <TargetProcessBugId>(externalId).Add(new TargetProcessBugId { Value = tpId }); storageRepository.Get <BugzillaBugInfo>(tpId.ToString(CultureInfo.InvariantCulture)) .Add(new BugzillaBugInfo { Id = externalId, TpId = tpId }); foreach (var team in _context.Teams.Where(t => t.AssignableID == tpId)) { storageRepository.Get <TeamDTO>(team.TeamID.ToString(CultureInfo.InvariantCulture)).Clear(); storageRepository.Get <TeamDTO>(team.TeamID.ToString(CultureInfo.InvariantCulture)).Add( new TeamDTO { AssignableID = team.AssignableID, ID = team.TeamID, RoleID = team.RoleID, TeamID = team.TeamID, UserID = team.UserID }); } tpBugs.Add(tpId); } MigrateBugsEntities(tpBugs, storageRepository); }
public void SetProfileName(string profileName) { var xmlDocument = new XmlDocument(); xmlDocument.LoadXml( string.Format( @"<?xml version=""1.0"" encoding=""utf-16""?> <{0} xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""> </{0}>", SettingsXmlNode)); LegacyProfile = new PluginProfile { PluginName = PluginName, ProfileName = profileName, Active = true, Settings = xmlDocument.OuterXml, }; Context.PluginProfiles.InsertOnSubmit(LegacyProfile); }
public void MigrateBugzillaEntities(IStorageRepository storageRepository, PluginProfile legacyProfile) { MigrateBugs(storageRepository, legacyProfile); }