コード例 #1
0
        public string NotifyMessage(string language = null)//Message message)
        {
            INotifier notifier     = new ConsoleNotifier();
            string    notifierType = "none";

            try
            {
                notifierType = ConfigurationManager.AppSettings["NotifierType"];
            }
            catch (Exception) { }

            Message message = GetNotificationMessage();// Language.GetFromResourceFile("BaseHelloMessage");// "Hello World";


            if (notifierType.ToUpper().Trim() == "CONSOLE")
            {
                notifier = new ConsoleNotifier();
            }
            else if (notifierType.ToUpper().Trim() == "FILE")
            {
                notifier = new FileNotifier();
            }
            else if (notifierType.ToUpper().Trim() == "DB")
            {
                notifier = new DBNotifier();
            }
            else
            {
                notifier = new Notifier();
            }
            return(NotifyMessage(message, notifier));
        }
コード例 #2
0
        public string Notify(IConfigurationManager configurationManager)
        {
            if (configurationManager == null)
            {
                throw new ArgumentNullException("configurationManager");
            }

            INotifier notifier     = new ConsoleNotifier();
            string    notifierType = "none";

            try
            {
                notifierType = configurationManager.GetAppSetting("NotifierType");
                // notifierType =  ConfigurationManager.AppSettings["NotifierType"];
            }
            catch (Exception) { }

            Message message = new Message();

            message.messageText = Language.GetFromResourceFile("BaseHelloMessage");// "Hello World";


            if (notifierType.ToUpper().Trim() == "CONSOLE")
            {
                notifier = new ConsoleNotifier();
            }
            else if (notifierType.ToUpper().Trim() == "FILE")
            {
                notifier = new FileNotifier();
            }
            else if (notifierType.ToUpper().Trim() == "DB")
            {
                notifier = new DBNotifier();
            }
            else
            {
                notifier = new Notifier();
            }
            return(NotifyMessage(message, notifier));
        }