/// <summary> /// Gets the import information control for the specified import provider. /// </summary> /// <param name="provider">Provider info.</param> /// <returns></returns> public static Control GetImportInformationControl(ImportProvider provider) { if (provider == null) throw new ArgumentNullException("provider"); return provider.GatherImportInformation(); }
/// <summary> /// Begins the import using the information within the populated Control. /// </summary> /// <param name="populatedControl">Control containing the user's answers.</param> public static void Import(Control populatedControl, ImportProvider provider) { provider.Import(populatedControl); IPagedCollection<BlogInfo> blogs; int totalBlogCount = Config.BlogCount; const int pageSize = 100; int pages = totalBlogCount/pageSize; int currentPage = 1; SkinTemplateCollection skins = new SkinTemplateCollection(); if (totalBlogCount % pageSize > 0) { pages++; } while (currentPage <= pages) { blogs = BlogInfo.GetBlogs(currentPage, pageSize, ConfigurationFlags.IsActive); foreach(BlogInfo currentBlogInfo in blogs) { if (skins.GetTemplate(currentBlogInfo.Skin.TemplateFolder) == null) { currentBlogInfo.Skin = SkinConfig.GetDefaultSkin(); Config.UpdateConfigData(currentBlogInfo); } } currentPage++; } }
private void SetProviderFormQueryString() { string providerName = Request.QueryString["Provider"]; if(providerName == null || providerName.Length == 0) Response.Redirect("Step01_SelectImportProvider.aspx"); _providerInfo = ImportProvider.Providers[providerName]; if(_providerInfo == null) Response.Redirect("Step01_SelectImportProvider.aspx"); }
/// <summary> /// Validates the import information provided by the user. /// Returns a string with error information. The string is /// empty if there are no errors. /// </summary> /// <param name="populatedControl">Information.</param> /// <param name="provider"></param> /// <returns></returns> public static string ValidateImportAnswers(Control populatedControl, ImportProvider provider) { if (populatedControl == null) throw new ArgumentNullException("populatedControl"); if (provider == null) throw new ArgumentNullException("provider"); return provider.ValidateImportInformation(populatedControl); }