private static XmlDocument GetRequest(Uri url, BlogConfigurationDto configuration) { using (MemoryStream ms = new MemoryStream()) { using (XmlTextWriter writer = new XmlTextWriter(ms, Encoding.ASCII)) { writer.WriteStartDocument(); writer.WriteStartElement("methodCall"); writer.WriteElementString("methodName", "weblogUpdates.ping"); writer.WriteStartElement("params"); writer.WriteStartElement("param"); writer.WriteElementString("value", configuration.Name); writer.WriteEndElement(); writer.WriteStartElement("param"); writer.WriteElementString("value", url.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); } XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(ms); return xmlDocument; } }
public void CreateSetupConfiguration(BlogConfigurationDto configurationDto) { if (this.GetConfiguration() != null) { throw new SecurityException("This method could be called only during the setup procedure"); } this.SaveConfiguration(configurationDto); }
public async Task InitializeAsync(Setup item) { string defaultPostPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/Setup/defaultPost.dxt"); var defaultPostTask = this.GetDefaultPostContent(defaultPostPath, item.SiteDomain.Host); var membershipTask = this.CreateMembershipAndRole(item); BlogConfigurationDto configuration = new BlogConfigurationDto(item.BlogName, item.SiteDomain); configuration.TimeZone = TimeZoneInfo.FindSystemTimeZoneById("UTC"); this.configurationDataService.CreateSetupConfiguration(configuration); this.logger.Debug("Created blog configuration."); //Creating default category this.categoryService.SaveOrUpdate(new CategoryDto { Name = "Various", IsDefault = true }); this.logger.Debug("Created default category."); PostDto defaultPost = new PostDto(); defaultPost.Title = "Welcome to Dexter!"; defaultPost.Tags = new[] { "Dexter" }; defaultPost.Categories = new[] { "Various" }; defaultPost.Status = ItemStatus.Published; defaultPost.PublishAt = DateTimeOffset.Now.AsMinutes(); defaultPost.Author = item.AdminUsername; defaultPost.AllowComments = true; await Task.WhenAll(defaultPostTask, membershipTask); defaultPost.Content = defaultPostTask.Result; this.postDataService.SaveOrUpdate(defaultPost); this.logger.Debug("Created default post."); }
public PublishedBackgroundTask(ItemDto item, IConfigurationDataService configurationDataService) { this.configuration = configurationDataService.GetConfiguration(); this.item = item; }
public void SaveConfiguration(BlogConfigurationDto configurationDto) { this.Session.Store(configurationDto); }
public void SaveOrUpdateConfiguration(BlogConfigurationDto item) { this.configurationDataService.SaveConfiguration(item); }