PERF: Fix for Dispel CurrentUser/CurrentSite magic

http://orchard.codeplex.com/workitem/16718

--HG--
branch : perf
This commit is contained in:
Suha Can
2010-11-04 20:24:48 -07:00
parent 103ab6e1cc
commit 1ce1cc9521
42 changed files with 311 additions and 328 deletions
@@ -1,33 +1,32 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.Core.Messaging.Models;
using Orchard.Localization;
using Orchard.Email.Models;
using Orchard.Settings;
using Orchard.UI.Admin.Notification;
using Orchard.UI.Notify;
namespace Orchard.Email.Services {
public class MissingSettingsBanner: INotificationProvider {
private readonly IOrchardServices _orchardServices;
public MissingSettingsBanner() {
public MissingSettingsBanner(IOrchardServices orchardServices) {
_orchardServices = orchardServices;
T = NullLocalizer.Instance;
}
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
public Localizer T { get; set; }
public IEnumerable<NotifyEntry> GetNotifications() {
var smtpSettings = CurrentSite.As<SmtpSettingsPart>();
var smtpSettings = _orchardServices.WorkContext.CurrentSite.As<SmtpSettingsPart>();
if ( smtpSettings == null || !smtpSettings.IsValid() ) {
yield return new NotifyEntry { Message = T("The SMTP settings needs to be configured." ), Type = NotifyType.Warning};
}
var messageSettings = CurrentSite.As<MessageSettingsPart>().Record;
var messageSettings = _orchardServices.WorkContext.CurrentSite.As<MessageSettingsPart>().Record;
if ( messageSettings == null || String.IsNullOrWhiteSpace(messageSettings.DefaultChannelService) ) {
yield return new NotifyEntry { Message = T("The default channel service needs to be configured."), Type = NotifyType.Warning };