Data tranfer object for Stats retrieval
Exemple #1
0
 /// <summary>
 /// Update the options object
 /// </summary>
 /// <param name="options">The options DTO</param>
 public static void UpdateOptions(ConfigOptionsDTO options)
 {
     BgResources.Email_UserName = options.Email_UserName;
     BgResources.Email_SmtpPort = options.Email_SmtpPort;
     BgResources.Email_Server = options.Email_Server;
     BgResources.Email_Password = options.Email_Password;
     BgResources.Email_SSL = options.Email_SSL;
     BgResources.Send_Mail_When_Comment_Received = options.Send_Mail_When_Comment_Received;
     BgResources.Analytics_GoogleAnalyticsCode = options.Analytics_GoogleAnalyticsCode;
     BgResources.Messages_Copyright = options.Messages_Copyright;
     BgResources.Messages_SiteTitle = options.Messages_SiteTitle;
     BgResources.Messages_SiteUrl = options.Messages_SiteUrl;
     BgResources.Pager_CategoriesPerPage = options.Pager_CategoriesPerPage;
     BgResources.Pager_CommentsPerPage = options.Pager_CommentsPerPage;
     BgResources.Pager_PostPerPage = options.Pager_PostPerPage;
     BgResources.Pager_RolesPerPage = options.Pager_RolesPerPage;
     BgResources.Pager_TagsPerPage = options.Pager_TagsPerPage;
     BgResources.Pager_UsersPerPage = options.Pager_UsersPerPage;
     BgResources.Pager_SearchImagesPerPage = options.Pager_SearchImagesPerPage;
     BgResources.Pager_SearchVideosPerPage = options.Pager_SearchVideosPerPage;
     BgResources.Recaptcha_PrivateKeyHttp = options.Recaptcha_PrivateKeyHttp;
     BgResources.Recaptcha_PublicKeyHttp = options.Recaptcha_PublicKeyHttp;
     BgResources.Akismet_API_key = options.Akismet_API_key;
     BgResources.Security_PremiumRole = options.Security_PremiumRole;
     BgResources.Security_AdminRole = options.Security_AdminRole;
     BgResources.Pager_HomeIndexPostsPerPage = options.Pager_HomeIndexPostsPerPage;
     BgResources.Twitter_User = options.Twitter_User;
     BgResources.Twitter_Search_Query = options.Twitter_Search_Query;
 }
 /// <summary>
 /// Update the configuration options
 /// </summary>
 /// <param name="options">The DTO object with options</param>
 public void UpdateConfigOptions(ConfigOptionsDTO options)
 {
     IEnumerable<BlogResource> blogresources = BlogResourceRepository.Get(null, null, null);
     foreach (BlogResource res in blogresources)
     {
         switch (res.Name)
         {
             case "Admin_Role":
                 res.Value = options.Security_AdminRole;
                 BgResources.Security_AdminRole = res.Value;
                 break;
             case "Categories_Number_of_Categories_per_Page":
                 res.Value = options.Pager_CategoriesPerPage;
                 BgResources.Pager_CategoriesPerPage = res.Value;
                 break;
             case "Comments_Number_of_Comments_per_Page":
                 res.Value = options.Pager_CommentsPerPage;
                 BgResources.Pager_CommentsPerPage = res.Value;
                 break;
             case "Copyright":
                 res.Value = options.Messages_Copyright;
                 BgResources.Messages_Copyright = res.Value;
                 break;
             case "Default_Theme":
                 res.Value = options.Themes_Default;
                 BgResources.Themes_Default = res.Value;
                 break;
             case "Email_Password":
                 res.Value = options.Email_Password;
                 BgResources.Email_Password = res.Value;
                 break;
             case "Email_UserName":
                 res.Value = options.Email_UserName;
                 BgResources.Email_UserName = res.Value;
                 break;
             case "Google_Analytics_Track_Code":
                 res.Value = options.Analytics_GoogleAnalyticsCode;
                 BgResources.Analytics_GoogleAnalyticsCode = res.Value;
                 break;
             case "Index_Number_of_Posts":
                 res.Value = options.Pager_PostPerPage;
                 BgResources.Pager_PostPerPage = res.Value;
                 break;
             case "Posts_Number_of_Posts_per_Page":
                 res.Value = options.Pager_PostPerPage;
                 BgResources.Pager_PostPerPage = res.Value;
                 break;
             case "Premium_Role":
                 res.Value = options.Security_PremiumRole;
                 BgResources.Security_PremiumRole = res.Value;
                 break;
             case "Recaptcha_Private_Key_Http":
                 res.Value = options.Recaptcha_PrivateKeyHttp;
                 BgResources.Recaptcha_PrivateKeyHttp = res.Value;
                 break;
             case "Recaptcha_Public_Key_Http":
                 res.Value = options.Recaptcha_PublicKeyHttp;
                 BgResources.Recaptcha_PublicKeyHttp = res.Value;
                 break;
             case "Akismet_API_key":
                 res.Value = options.Akismet_API_key;
                 BgResources.Akismet_API_key = res.Value;
                 break;
             case "Roles_Number_of_Roles_per_Page":
                 res.Value = options.Pager_RolesPerPage;
                 BgResources.Pager_RolesPerPage = res.Value;
                 break;
             case "SearchImages_Number_of_Images_per_Page":
                 res.Value = options.Pager_SearchImagesPerPage;
                 BgResources.Pager_SearchImagesPerPage = res.Value;
                 break;
             case "SearchVideos_Number_of_Videos_per_Page":
                 res.Value = options.Pager_SearchVideosPerPage;
                 BgResources.Pager_SearchVideosPerPage = res.Value;
                 break;
             case "SiteTitle":
                 res.Value = options.Messages_SiteTitle;
                 BgResources.Messages_SiteTitle = res.Value;
                 break;
             case "SiteUrl":
                 res.Value = options.Messages_SiteUrl;
                 BgResources.Messages_SiteUrl = res.Value;
                 break;
             case "Smtp_Port":
                 res.Value = options.Email_SmtpPort;
                 BgResources.Email_SmtpPort = res.Value;
                 break;
             case "Smtp_Server":
                 res.Value = options.Email_Server;
                 BgResources.Email_Server = res.Value;
                 break;
             case "Email_SSL":
                 res.Value = options.Email_SSL.ToString();
                 BgResources.Email_SSL = bool.Parse(res.Value);
                 break;
             case "Send_Mail_When_Comment_Received":
                 res.Value = options.Send_Mail_When_Comment_Received.ToString();
                 BgResources.Send_Mail_When_Comment_Received = bool.Parse(res.Value);
                 break;
             case "Tags_Number_of_Tags_per_Page":
                 res.Value = options.Pager_TagsPerPage;
                 BgResources.Pager_TagsPerPage = res.Value;
                 break;
             case "Users_Number_of_Users_per_Page":
                 res.Value = options.Pager_UsersPerPage;
                 BgResources.Pager_UsersPerPage = res.Value;
                 break;
             case "Posts_HomeIndexPostsPerPage":
                 res.Value = options.Pager_HomeIndexPostsPerPage;
                 BgResources.Pager_HomeIndexPostsPerPage = res.Value;
                 break;
             case "Twitter_User":
                 res.Value = options.Twitter_User;
                 BgResources.Twitter_User = res.Value;
                 break;
             case "Twitter_Search_Query":
                 res.Value = options.Twitter_Search_Query;
                 BgResources.Twitter_Search_Query = res.Value;
                 break;
         }
         BlogResourceRepository.Update(res);
     }
     BlogResourceRepository.UnitOfWork.Commit();
 }