コード例 #1
0
        public async Task sendNotification(RequestedItem requestedItem,
                                           NotificationType notificationType,
                                           string notificationTitle,
                                           string notificationMessage,
                                           bool dataOnly)
        {
            var devices = await _beachBuddyRepository.GetDevices();

            Dictionary <string, string> data;

            if (dataOnly)
            {
                data = new Dictionary <string, string>
                {
                    { "notificationType", notificationType.ToString() },
                    { "updateOnly", "true" }
                };
            }
            else
            {
                data = new Dictionary <string, string>
                {
                    { "notificationType", notificationType.ToString() },
                    { "updateOnly", "false" },
                    { "itemId", $"{requestedItem.Id}" },
                    { "name", $"{requestedItem.Name}" },
                    { "count", $"{requestedItem.Count}" },
                    { "sentByUserId", $"{requestedItem.RequestedByUserId}" }
                };
            }

            var deviceList = devices.ToList();
            var results    = await SendFcmNotification(deviceList, notificationTitle, notificationMessage, dataOnly, data);

            for (var i = 0; i < results.Count; i++)
            {
                var response = results[i];
                var device   = deviceList[i];
                if (response.IsSuccess)
                {
                    _logger.LogDebug($"Message was sent!");
                    // Woohoo!
                }
                else
                {
                    _logger.LogWarning(response.Exception.InnerException,
                                       $"Error sending notification to device {device.DeviceToken}");
                    if (response.Exception.MessagingErrorCode.HasValue &&
                        response.Exception.MessagingErrorCode == MessagingErrorCode.Unregistered)
                    {
                        // the token has been unregistered, must delete the device record
                        _beachBuddyRepository.DeleteDevice(device);
                        await _beachBuddyRepository.Save();

                        _logger.LogDebug($"Device {device.DeviceToken} has been unregistered");
                    }
                }
            }
        }
コード例 #2
0
        private EmailTemplate GetEmailTemplateByType(NotificationType templateType)
        {
            string templateContent = GetTemplateContent("Templates", templateType.ToString());

            return new EmailTemplate
            {
                Body = templateContent,
                Type = templateType.ToString()
            };
        }
コード例 #3
0
        public static IEnumerable <String> GetNotifications(this HtmlHelper htmlHelper, NotificationType notificationType)
        {
            IEnumerable <string> notifications = null;

            if (htmlHelper.ViewContext.Controller.TempData.ContainsKey(notificationType.ToString()))
            {
                notifications = htmlHelper.ViewContext.Controller.TempData[notificationType.ToString()] as IEnumerable <string>;
            }

            return(notifications);
        }
コード例 #4
0
        protected virtual void AddNotification(string message, NotificationType notificationType)
        {
            if (!this.TempData.ContainsKey(notificationType.ToString()))
            {
                this.TempData.Add(notificationType.ToString(), new HashSet <string>());
            }

            var notifications = this.TempData[notificationType.ToString()] as ICollection <string>;

            notifications.Add(message);
        }
コード例 #5
0
 internal void AddNotification(string container, string message, NotificationType type)
 {
     if (container == "ViewBag")
     {
         ViewBag.messageType = (string)type.ToString();
         ViewBag.message     = message;
     }
     else if (container == "TempData")
     {
         TempData["messageType"] = (string)type.ToString();
         TempData["message"]     = message;
     }
 }
コード例 #6
0
        public void Notify(string message, string title      = "Sweet Alert Toastr Demo",
                           NotificationType notificationType = NotificationType.success)
        {
            var msg = new {
                message  = message,
                title    = title,
                icon     = notificationType.ToString(),
                type     = notificationType.ToString(),
                provider = GetProvider()
            };

            TempData["Message"] = JsonConvert.SerializeObject(msg);
        }
コード例 #7
0
        public void Notify(string message, string title      = "Blue Fin Inc", string provider = "sweetAlert",
                           NotificationType notificationType = NotificationType.success)
        {
            var msg = new
            {
                message  = message,
                title    = title,
                icon     = notificationType.ToString(),
                type     = notificationType.ToString(),
                provider = provider
            };

            TempData["Message"] = JsonConvert.SerializeObject(msg);
        }
コード例 #8
0
        private static string FormatDiscussiongMsg(string dTitle, string note, NotificationType type)
        {
            string i = type.ToString();
            string msg;

            switch (i)
            {
            case "Meeting_New_Discussion":
                // note is meeting title
                msg  = "<b>A new discussion is started for the meeting: </b><br><hr>";
                msg += "<b>Meeting Details</b><br>";
                msg += "Title: " + note + "<br><hr>";
                msg += "<b>Discussion Title: </b>" + dTitle;
                return(msg);

            case "Agenda_New_Discussion":
                // note is agenda title
                msg  = "<b>A new discussion is started for the agenda: </b><br><hr>";
                msg += "<b>" + note + "</b><br><hr>";
                msg += "<b>Discussion Title: </b>" + dTitle;
                return(msg);

            case "New_Reply":
                // note is user name
                msg  = "<b> " + note + "A new reply has been posted for the discussion: </b><br><hr>";
                msg += "<b>Discussion Title: </b>" + dTitle;
                return(msg);

            default:
                return("");
            }
        }
コード例 #9
0
 public static string GenerateAlert(NotificationType type, Exception exception)
 {
     return(JsonConvert.SerializeObject(new AlertNotification()
     {
         Notification = type.ToString() + "!", Type = type, Message = exception.Message
     }));
 }
コード例 #10
0
        public List <int> GetCheckDays(NotificationType notificationType)
        {
            var val  = ConfigurationManager.AppSettings[notificationType.ToString()];
            var list = val.Split(',').Select(x => Convert.ToInt32(x)).ToList();

            return(list);
        }
コード例 #11
0
        public void Alert(string message, NotificationType notificationType)
        {
            var msg = "<script>Swal.fire('" + notificationType.ToString().ToUpper() + "', '"
                      + message + "','" + notificationType + "')" + "</script>";

            TempData["notification"] = msg;
        }
コード例 #12
0
        public async Task SendBatchNotifications(NotificationType type, bool useHttps, string host, int?count = null)
        {
            if (!type.ShouldBeBatched())
            {
                throw new InvalidOperationException($"Notifications of type {type} can't be batched");
            }

            using (var db = _dbService.GetConnection())
            {
                var userIds = await db.QueryAsync <int>($@"
Select Id
From   Users
Where  {type.GetUserColumnName()} < @now", new { now = DateTime.UtcNow });

                var successfulUserIds = new List <int>();
                foreach (var userId in userIds)
                {
                    var message = new Models.Services.PushNotificationMessage(
                        type.GetTitle(count),
                        type.GetUrl(useHttps, host, userId),
                        type.GetBody(),
                        type.ToString(),
                        true);
                    if (await SendNotification(userId, message))
                    {
                        successfulUserIds.Add(userId);
                    }
                }

                await db.ExecuteAsync($@"
Update Users
Set    {type.GetUserColumnName()} = DateAdd(minute, NotificationsIntervalId * NotificationsIntervalValue, @now)
Where  Id In @successfulUserIds", new { successfulUserIds, columnName = type.GetUserColumnName(), now = DateTime.UtcNow });
            }
        }
コード例 #13
0
 /// <summary>
 /// Sends a message based on the configured message templates
 /// Allows for body to be formatted with arguments.
 /// </summary>
 /// <param name="messageKey">key of the message configured during the setup</param>
 /// <param name="args">array of arguments (optional)</param>
 private void SendNotificationsPriv(string flowName, string transactionId, string toEmailAddresses, NotificationType notificationType,
                                    string subject, Stream attachmentContent, string attachmentName,
                                    string[] args)
 {
     SendNotificationsPriv(flowName, transactionId, toEmailAddresses, notificationType.ToString(), subject,
                           attachmentContent, attachmentName, args);
 }
コード例 #14
0
ファイル: BasePortalController.cs プロジェクト: radtek/vnr
        public string ShowMessages(NotificationType type, params string[] objectName)
        {
            var strMessages = string.Empty;

            if (objectName != null)
            {
                strMessages = objectName.FirstOrDefault() + "|";
                var count           = objectName.Count();
                var arrayObjectName = new string[count];
                for (int i = 0; i < count; i++)
                {
                    arrayObjectName[i] = objectName[i].TranslateString();
                }

                var messages = string.Format(type.ToString().TranslateString(), arrayObjectName);
                var strType  = "alert-danger";
                var strClose = Constant.Close.TranslateString();

                if (type == NotificationType.Success)
                {
                    strType = "alert-success";
                }
                if (type == NotificationType.E_ChangePass_Success)
                {
                    strType = "alert-success";
                }

                strMessages += "<div class=\"alert " + strType + " alert-dismissible\" role=\"alert\">" +
                               "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">" + strClose + "</span></button>" + messages +
                               "</div>";
            }

            return(strMessages);
        }
コード例 #15
0
        public static IssueEmailInfoBase ToEmailInfo(this Issue issue, NotificationType notificationType, Error instance, Application application, Duration duration = null)
        {
            IssueEmailInfoBase emailInfo;

            switch (notificationType)
            {
            case NotificationType.NotifyOnNewIssueCreated:
                emailInfo = new NewIssueReceivedEmailInfo();
                break;

            case NotificationType.NotifyOnNewInstanceOfSolvedIssue:
                emailInfo = new SolvedIssueRecurrenceEMailInfo();
                break;

            case NotificationType.AlwaysNotifyOnInstanceOfIssue:
                emailInfo = new PeriodicIssueNotificationEmailInfo()
                {
                    NotificationFrequency = duration.Description,
                };
                break;

            default:
                throw new ErrorditeUnexpectedValueException("NotificationType", notificationType.ToString());
            }

            emailInfo.ApplicationName  = application.Name;
            emailInfo.ExceptionMessage = instance.ExceptionInfos.First().Message;
            emailInfo.Type             = instance.ExceptionInfos.First().Type;
            emailInfo.Method           = instance.ExceptionInfos.First().MethodName;
            emailInfo.IssueId          = issue.FriendlyId;
            emailInfo.IssueName        = issue.Name;
            emailInfo.AppId            = issue.ApplicationId;
            emailInfo.OrgId            = issue.OrganisationId;
            return(emailInfo);
        }
コード例 #16
0
ファイル: PushNotify.cs プロジェクト: HyggeMail/DevHygge
        public void NotifyIOSUser(string token, string json, NotificationType type)
        {
            ////Fluent construction of an iOS notification
            ////IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate
            ////  for registered for remote notifications is called, and the device token is passed back to you
            //------------------------- // APPLE NOTIFICATIONS //-------------------------
            //Configure and start Apple APNS // IMPORTANT: Make sure you use the right Push certificate.  Apple allows you to
            //generate one for connecting to Sandbox, and one for connecting to Production.  You must
            // use the right one, to match the provisioning profile you build your
            //   app with!
            var appleCert = File.ReadAllBytes(HostingEnvironment.MapPath(APNSCerticateFile));

            //IMPORTANT: If you are using a Development provisioning Profile, you must use
            // the Sandbox push notification server
            //  (so you would leave the first arg in the ctor of ApplePushChannelSettings as
            // 'false')
            //  If you are using an AdHoc or AppStore provisioning profile, you must use the
            //Production push notification server
            //  (so you would change the first arg in the ctor of ApplePushChannelSettings to
            //'true')
            if (_pushBroker == null)
            {
                _pushBroker = new PushBroker();
            }

            _pushBroker.RegisterAppleService(new ApplePushChannelSettings(false, appleCert, APNSCerticateFilePassword, true));

            _pushBroker.QueueNotification(new AppleNotification()
                                          .ForDeviceToken(token)
                                          .WithAlert(json)
                                          .WithCategory(type.ToString())
                                          .WithSound("sound.caf"));
        }
コード例 #17
0
 protected void ShowNotification(
     string message,
     NotificationType notificationType = NotificationType.Error)
 {
     this.TempData[NotificationConstants.NotificationMessageKey] = message;
     this.TempData[NotificationConstants.NotificationTypeKey]    = notificationType.ToString();
 }
コード例 #18
0
        private static string FormatAgendaMsg(Agendum m, NotificationType type, string mTitle)
        {
            string t = type.ToString();
            string msg;

            switch (t)
            {
            case "Agenda_New":
                // note is meeting title
                msg  = "<b>A new agendum has been added to the meeting: </b><br><hr>";
                msg += "<b>Meeting Details</b><br>";
                msg += "Title: " + mTitle + "<br><hr>";
                msg += "<b>Agendum Title: </b>" + m.AgendaTitle;
                return(msg);

            case "Agenda_Update":
                // note is agenda title
                msg  = "<b>An update has been made to Meeting Agenda: </b><br><hr>";
                msg += "<b>Meeting Title: </b>" + mTitle;
                return(msg);

            default:
                return("");
            }
        }
コード例 #19
0
        public void Alert(string message, NotificationType notificationType)
        {
            var msg = "<script language='javascript'>Swal.fire('" + notificationType.ToString().ToUpper() + "', '" + message + "','" + notificationType + "')" + "</script>";

            //var msg = "<script language='javascript'>Swal.fire({title:'',text: '" + message + "',type:'" + notificationType + "',allowOutsideClick: false,allowEscapeKey: false,allowEnterKey: false})" + "</script>";
            TempData["notification"] = msg;
        }
コード例 #20
0
        public void Alert(string message, NotificationType notificationType, int timer)
        {
            string        bgr         = "white";
            List <string> backgrounds = new List <string> {
                "#429cb6", "#54b07d", "#EB5E28", "#F3BB45"
            };                                                                                          //info, success, error, warning

            if (notificationType.Equals(NotificationType.info))
            {
                bgr = backgrounds[0];
            }
            if (notificationType.Equals(NotificationType.success))
            {
                bgr = backgrounds[1];
            }
            if (notificationType.Equals(NotificationType.error))
            {
                bgr = backgrounds[2];
            }
            if (notificationType.Equals(NotificationType.warning))
            {
                bgr = backgrounds[3];
            }

            var msg1 = "Swal.fire({ background: '" + bgr + "', position: 'top', type: '" + notificationType + "', toast: true, title: '" + message + "', showConfirmButton: true, timer: " + timer + " })";
            var msg  = "Swal.fire({ title: '" + notificationType.ToString().ToUpper() + "', html: '" + message + "', type: '" + notificationType + "', timer: '" + timer + "', icon: '" + notificationType + "' })";

            TempData["notification"] = msg;
        }
コード例 #21
0
        public async Task AddNotificationAsync(string text, NotificationType type, DateTime dateTime, int userId)
        {
            Notification notification = null;

            if (type == NotificationType.NewMessage)
            {
                notification = await db.Notification.GetLastUnreadNotificationByType(userId, NotificationType.NewMessage.ToString());

                if (notification != null)
                {
                    await db.Notification.UpdateNotificationTime(notification.Id, dateTime);

                    db.Save();
                    return;
                }
            }

            notification = new Notification
            {
                Text     = text,
                Type     = type.ToString(),
                UserId   = userId,
                DateTime = dateTime,
                IsRead   = false
            };

            await db.Notification.AddNotificationAsync(notification);

            db.Save();
        }
コード例 #22
0
ファイル: Server.cs プロジェクト: proxodilka/web-labs
        public string GetNotification(NotificationType type, List <string> arguments = null, ChatClient invoker = null)
        {
            Dictionary <string, string> notification = new Dictionary <string, string>()
            {
                ["type"]          = type.ToString(),
                ["invoker_name"]  = invoker == null? "null" : invoker.name,
                ["invoker_color"] = invoker == null? "null" : invoker.color,
                ["message"]       = ""
            };

            switch (type)
            {
            case NotificationType.JOIN:
                break;

            case NotificationType.EXIT:
                break;

            case NotificationType.SERVER_MESSAGE:
            case NotificationType.MESSAGE:
                notification["message"] = arguments[0];
                break;

            default:
                Log($"ERROR: client {invoker.socket.RemoteEndPoint} has invoked an unknown event: {type}");
                break;
            }
            return(JsonConvert.SerializeObject(notification));
        }
コード例 #23
0
ファイル: PushNotifier.cs プロジェクト: HyggeMail/DevHygge
        public static void NotifyIOSUser(string token, string message, NotificationType type)
        {
            /// /Fluent construction of an iOS notification
            ////IMPORTANT: For iOS you MUST MUST MUST use your own DeviceToken here that gets generated within your iOS app itself when the Application Delegate
            ////  for registered for remote notifications is called, and the device token is passed back to you
            //------------------------- // APPLE NOTIFICATIONS //-------------------------
            //Configure and start Apple APNS // IMPORTANT: Make sure you use the right Push certificate.  Apple allows you to
            //generate one for connecting to Sandbox, and one for connecting to Production.  You must
            // use the right one, to match the provisioning profile you build your
            //   app with!
            var appleCert = File.ReadAllBytes(HostingEnvironment.MapPath(APNSCerticateFile));
            //IMPORTANT: If you are using a Development provisioning Profile, you must use
            // the Sandbox push notification server
            //  (so you would leave the first arg in the ctor of ApplePushChannelSettings as
            // 'false')
            //  If you are using an AdHoc or AppStore provisioning profile, you must use the
            //Production push notification server
            //  (so you would change the first arg in the ctor of ApplePushChannelSettings to
            //'true')

            var payLoad = new AppleNotificationPayload();

            payLoad.AddCustom("NotificationType", NotificationType.MessageAlert);
            payLoad.AddCustom("Badge", 7);
            payLoad.AddCustom("DeviceID", token);
            PushBroker.QueueNotification(new AppleNotification(token, payLoad) //the recipient device id
                                         .WithAlert(message)                   //the message
                                         .WithBadge(7)
                                         .WithCategory(type.ToString())
                                         .WithSound("sound.caf")
                                         );
        }
コード例 #24
0
        public static MailMessage LoadTemplate(NotificationType type)
        {
            #region Load Template XML
            var xml = new XmlDocument();
            using (var reader = new XmlTextReader(System.Web.HttpContext.Current.Server.MapPath("~/static/templates.xml")))
            {
                xml.Load(reader);
            }

            var shellHtml = xml.SelectSingleNode("/templates/template[@name='Master']/html").InnerText;
            var temp      = xml.SelectSingleNode("/templates/template[@name='" + type.ToString() + "']");
            #endregion

            #region Do replacements


            var subject = temp.SelectSingleNode("subject").InnerText;
            var body    = temp.SelectSingleNode("html").InnerText;

            var html = ReplaceTokens(shellHtml, new Dictionary <string, string> {
                { "BODY", body }
            });
            #endregion

            #region Create Message
            var msg = new MailMessage();
            msg.Subject    = subject;
            msg.Body       = html;
            msg.IsBodyHtml = true;
            #endregion

            return(msg);
        }
コード例 #25
0
        // formatting msg subject
        public static string GetSubject(NotificationType type)
        {
            string t = type.ToString();

            switch (t)
            {
            case "Meeting_Parti_Insert":
                return("Meeting Invitation");

            case "Meeting_Info_Update":
                return("Meeting Update");

            case "Meeting_New_Discussion":
            case "Agenda_New_Discussion":
                return("New Discussion");

            case "New_Reply":
                return("New Reply");

            case "Meeting_Parti_Disinvite":
                return("Disinvite from a Meeting");

            case "Agenda_New":
                return("New Agenda");

            case "Agenda_Update":
                return("Agenda Update");

            case "Task_Assignment":
                return("A new Task Assignment");

            default:
                return("Nothing!");
            }
        }
コード例 #26
0
        private void ShowInternal(NotificationType type, string message)
        {
            message = string.IsNullOrWhiteSpace(message) ? $"{_count++} {type.ToString()}" : message;
            switch (type)
            {
            case NotificationType.Error:
                _vm.ShowError(message);
                break;

            case NotificationType.Information:
                _vm.ShowInformation(message);
                break;

            case NotificationType.Success:
                _vm.ShowSuccess(message);
                break;

            case NotificationType.Warning:
                _vm.ShowWarning(message);
                break;

            default:
                throw new NotImplementedException($"Following notification type isn't supported : {type}");
            }
        }
コード例 #27
0
        public string Alert(string message, NotificationType notificationType)
        {
            string msg = "<script language='javascript'>swal('" + notificationType.ToString().ToUpper() + "', '" + message + "','" + notificationType + "')" + "</script>";

            ViewBag.notification = msg;
            return(msg);
        }
コード例 #28
0
ファイル: MobileNotification.cs プロジェクト: anojht/Ombi
        private static Dictionary <string, string> GetNotificationData(NotificationMessageContent parsed, NotificationType type)
        {
            var notificationData = parsed.Data.ToDictionary(x => x.Key, x => x.Value);

            notificationData[nameof(NotificationType)] = type.ToString();
            return(notificationData);
        }
コード例 #29
0
ファイル: Notifier.cs プロジェクト: AdrianCurtin/TecPomodoro
        public void ShowMessageNotification(NotificationType type, bool alarm)
        {
            alarm = !alarm;
            string resource = "";

            resource = "Toast" + type.ToString();

            string title = loader.GetString(resource + 0 + "/Text");
            string text  = loader.GetString(resource + 1 + "/Text");
            string image = "Assets/Images/" + loader.GetString(resource + "Image" + "/Text");

            ToastContent content = new ToastContent()
            {
                Launch = "app-defined-string",

                Visual = new ToastVisual()
                {
                    BindingGeneric = new ToastBindingGeneric()
                    {
                        Children =
                        {
                            new AdaptiveText()
                            {
                                Text = title
                            },

                            new AdaptiveText()
                            {
                                Text = text
                            }
                        },

                        AppLogoOverride = new ToastGenericAppLogo()
                        {
                            Source = image
                        },
                    },
                }
            };


            if (type == NotificationType.Finish || type == NotificationType.Focus || type == NotificationType.Free)
            {
                content.Audio = new ToastAudio()
                {
                    Src = new Uri("ms-appx:///Assets/Sounds/alarm.wav")
                }
            }
            ;

            if (alarm)
            {
                Show(content.GetXml());
            }
            else
            {
                PlaySound();
            }
        }
コード例 #30
0
ファイル: Notification.cs プロジェクト: haim6678/Maze-game
        /// <summary>
        /// To the json.
        /// </summary>
        /// <returns></returns>
        public string ToJSON()
        {
            JObject j = new JObject();

            j["Data"]             = Data;
            j["NotificationType"] = NotificationType.ToString();
            return(j.ToString());
        }
コード例 #31
0
        private static StringContent ConvertToStringContent(string title, string body, Dictionary <string, string> customdata, NotificationType Type)
        {
            string name        = RandomeName();
            string CustomDatas = ConvertCustomData(customdata);
            string data        = $"{{ \"notification_target\": {{\"type\": \"{Type.ToString()}\",}},\"notification_content\": {{\"name\":\"{name}\",\"title\": \"{title}\",\"body\": \"{body}\",\"custom_data\":{CustomDatas} }}}}";

            return(new StringContent(data, Encoding.UTF8, "application/json"));
        }
コード例 #32
0
 public NotificationSummary(ISummary sum, NotificationType notificationType)
 {
     Subject = sum.Subject;
     Received = sum.Received;
     Sender = sum.Sender;
     EnvelopeId = sum.EnvelopeId;
     UniqueId = sum.UniqueId;
     CcLine = sum.CcLine;
     NotificationType = notificationType.ToString();
 }
コード例 #33
0
ファイル: BaseController.cs プロジェクト: sbudihar/SIRIUSrepo
 /// <summary>
 ///     Show message or notification on the page.
 /// </summary>
 /// <param name="notificationType">Message severity level, type of AdIns.Common.NotificationType enum.</param>
 /// <param name="message">Message to show.</param>
 /// <param name="showAfterRedirect">True if the message show after redirect, default is false.</param>
 public void ShowNotification(NotificationType notificationType, string message, bool showAfterRedirect = false)
 {
     var notificationTypeKey = notificationType.ToString();
     if (showAfterRedirect)
     {
         this.TempData[notificationTypeKey] = message;
     }
     else
     {
         this.ViewData[notificationTypeKey] = message;
     }
 }
コード例 #34
0
ファイル: NotificationForm.cs プロジェクト: olexta/Toolkit
		private NotificationForm( string msg, string details, NotificationType type )
		{
			InitializeComponent();

			if( Application.OpenForms.Count > 0 ) {
				this.Text = Application.OpenForms[ 0 ].Text;
			} else {
				this.Text = Application.ProductName;
				this.StartPosition = FormStartPosition.CenterScreen;
			}

			tbMessage.Text = Regex.Replace( msg, @"\\n", @"\\r\\n" );
			if( !string.IsNullOrEmpty( details ) ) {
				tbDetails.Text = details;
			} else {
				btnDetails.Visible = false;
			}

			btnClose.Text = m_rm.GetString( type.ToString() + "_btnClose_text" );
			this.Icon = (Icon)m_rm.GetObject( type.ToString() + "_ico" );

			update_btnDetails();
		}
コード例 #35
0
        /// <summary>
        /// Creates the specified Notice type.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="args">The args.</param>
        /// <returns></returns>
        public INotification Create(NotificationType type, params object[] args)
        {
            // get type info
            QualifiedTypeNameAttribute QualifiedNameAttr =
                EnumAttributeUtility<NotificationType, QualifiedTypeNameAttribute>.GetEnumAttribute(type.ToString());

            // Initialize instance
            INotification instance = null;

            // create instance
            instance =
                (INotification)
                this.CreateObjectInstance(QualifiedNameAttr.AssemblyFileName, QualifiedNameAttr.QualifiedTypeName, args);

            // return
            return instance;
        }
コード例 #36
0
ファイル: PhoneHooks.cs プロジェクト: stevehansen/vidyano_v1
        public override async Task ShowNotification(string notification, NotificationType notificationType)
        {
            var messageBox = new CustomMessageBox
                             {
                                 Caption = Service.Current.Messages[notificationType.ToString()],
                                 Message = notification,
                                 LeftButtonContent = Service.Current.Messages["OK"],
                                 RightButtonContent = Service.Current.Messages["Copy"]
                             };

            var waiter = new AutoResetEvent(false);
            messageBox.Dismissed += (s1, e1) =>
            {
                if (e1.Result == CustomMessageBoxResult.RightButton)
                    Clipboard.SetText(notification);

                waiter.Set();
            };

            messageBox.Show();

            await Task.Factory.StartNew(() => waiter.WaitOne());
        }
コード例 #37
0
 protected void Notify(string message, NotificationType type)
 {
     this.TempData["message"] = message;
     this.TempData["type"] = type.ToString();
 }
コード例 #38
0
ファイル: TaskManager.cs プロジェクト: evkap/DVS
		private Dictionary<TaskParamsKey, string> GetParamsDictionary(
			NotificationType notificationType,
			string userEmail = null,
			string userContactEmail = null,
			string userName = null,
			string userPassword = null,
			string userDetailsUrl = null,
			string resetPasswordUrl = null,
			string licenseNumber = null,
			string expirationDays = null,
			string phone = null,
			string companyName = null,
			string message = null,
			string contactUsUrl = null,
			string taskType = null,
			string publicOrderId = null,
			string propertyZip = null,
			string propertyAddress = null,
			string numbeOfUsersThatWereNotified = null,
			string numberOfHoursOpen = null,
			string nextRunTime = null,
			string clientUserFirstName = null,
			string clientUserLastName = null,
			string orderLink = null,
			string isCompany = null,
			string orderId = null
			)
		{
			var taskParams = new Dictionary<TaskParamsKey, string>();
			taskParams.Add(TaskParamsKey.NotificationType, notificationType.ToString());

			var user = _userRepository.GetByEmail(userEmail);
			if (user != null)
				AddParam(TaskParamsKey.UserId, user.Id.ToString(), taskParams);

			AddParam(TaskParamsKey.UserContactEmail, userContactEmail, taskParams);
			AddParam(TaskParamsKey.UserName, userName, taskParams);
			AddParam(TaskParamsKey.Password, userPassword, taskParams);
			AddParam(TaskParamsKey.UserDetailsUrl, userDetailsUrl, taskParams);
			AddParam(TaskParamsKey.ResetPasswordUrl, resetPasswordUrl, taskParams);
			AddParam(TaskParamsKey.LicenseNumber, licenseNumber, taskParams);
			AddParam(TaskParamsKey.ExpirationDays, expirationDays, taskParams);
			AddParam(TaskParamsKey.Phone, phone, taskParams);
			AddParam(TaskParamsKey.CompanyName, companyName, taskParams);
			AddParam(TaskParamsKey.Message, message, taskParams);
			AddParam(TaskParamsKey.ContactUsUrl, contactUsUrl, taskParams);
			AddParam(TaskParamsKey.TaskType, taskType, taskParams);
			AddParam(TaskParamsKey.PublicOrderId, publicOrderId, taskParams);
			AddParam(TaskParamsKey.ProperyZip, propertyZip, taskParams);
			AddParam(TaskParamsKey.PropertyAddress, propertyAddress, taskParams);
			AddParam(TaskParamsKey.NumbeOfUsersThatWereNotified, numbeOfUsersThatWereNotified, taskParams);
			AddParam(TaskParamsKey.NumberOfHoursOpen, numberOfHoursOpen, taskParams);
			AddParam(TaskParamsKey.NextRunTime, nextRunTime, taskParams);
			AddParam(TaskParamsKey.ClientUserFirstName, clientUserFirstName, taskParams);
			AddParam(TaskParamsKey.ClientUserLastName, clientUserLastName, taskParams);
			AddParam(TaskParamsKey.OrderLink, orderLink, taskParams);
			AddParam(TaskParamsKey.IsCompany, isCompany, taskParams);
			AddParam(TaskParamsKey.OrderId, orderId, taskParams);

			return taskParams;
		}
コード例 #39
0
ファイル: FuelSDK.cs プロジェクト: tarekchaya/HorseTapGame
	public static bool IsNotificationEnabled (NotificationType notificationType)
	{
		FuelSDKCommon.Log (FuelSDKCommon.LogLevel.DEBUG, "validating if notification type '" + notificationType.ToString () + "' is enabled");

		bool succeed = false;
		
		if (!Application.isEditor) {
			succeed = GetFuelSDKPlatform().IsNotificationEnabled(notificationType);
		}

		if (succeed) {
			FuelSDKCommon.Log (FuelSDKCommon.LogLevel.DEBUG, "notification type '" + notificationType.ToString () + "' is enabled");
		} else {
			FuelSDKCommon.Log (FuelSDKCommon.LogLevel.DEBUG, "notification type '" + notificationType.ToString () + "' is disabled");
		}

		return succeed;
	}
コード例 #40
0
ファイル: FuelSDK.cs プロジェクト: tarekchaya/HorseTapGame
	public static void DisableNotification (NotificationType notificationType)
	{
		FuelSDKCommon.Log (FuelSDKCommon.LogLevel.DEBUG, "disabling notification type: " + notificationType.ToString ());
		
		if (!Application.isEditor) {
			GetFuelSDKPlatform().DisableNotification(notificationType);
		}
	}
コード例 #41
0
        //Send notification to default recipients (sys admin)
        public bool SendNotification(NotificationType recipientType)
        {
            string defaultRecipients = ConfigurationManager.AppSettings["DefaultRecipientEmailAddresses"].ToString();
            string customRecipients = ConfigurationManager.AppSettings["DefaultRecipientEmailAddresses_" + recipientType.ToString()];
            if (!String.IsNullOrEmpty(customRecipients)) defaultRecipients = customRecipients;

            return SendNotification(defaultRecipients, null);
        }
コード例 #42
0
 /// <summary>
 /// Logs the notification to client.
 /// </summary>
 /// <param name="messageType">Type of the message.</param>
 /// <param name="message">The message.</param>
 private void LogNotificationToClient(NotificationType messageType, string message)
 {
     try
     {
         IHubContext context = GlobalHost.ConnectionManager.GetHubContext<PushNotificationLoggingHub>();
         context.Clients.All.PushNotificationLog(messageType.ToString(), message);
     }
     catch (Exception ex)
     {
         ex.ExceptionValueTracker(messageType, message);
     }
 }
コード例 #43
0
 public static object ConstructEvent(NotificationType type, object obj)
 {
     return new {Event = type.ToString(), Data = obj};
 }
コード例 #44
0
ファイル: StoreHooks.cs プロジェクト: stevehansen/vidyano_v1
        protected internal virtual void ShowNotificationAsDialog(string notification, NotificationType notificationType)
        {
            var showDialog = new Action(async () =>
            {
                var dialog = new MessageDialog(notification, notificationType.ToString());
                await dialog.ShowAsync();
            });

            NotifyableBase.Dispatch(showDialog);
        }
コード例 #45
0
        private static void ShowSvgNotification(string source,
						NotificationSource nsource,
						string header,
						string body,
						int timeout,
						int width,
						int height,
						NotificationType type,
						TimerEndedHandler thandler)
        {
            Stream stream;
            string svg = "";
            if (source == null)
            {
            NotificationFactory factory = new NotificationFactory ();
            Assembly assembly = Assembly.GetAssembly (factory.GetType ());
            stream = assembly.GetManifestResourceStream (type.ToString () + ".svg");
            StreamReader reader = new StreamReader (stream);
            svg = reader.ReadToEnd ();
            reader.Close ();
            stream.Close ();
            } else {
            if (nsource == NotificationSource.File) {
            stream = new FileStream (source, FileMode.Open, FileAccess.Read);
            StreamReader reader = new StreamReader (stream);
            svg = reader.ReadToEnd ();
            reader.Close ();
            stream.Close ();
            } else if (nsource == NotificationSource.Text)
            svg = source;
            }

            svg = ReplaceMacros (svg, header, body);
            NotificationAreaMessage msg = new NotificationAreaMessage (svg, NotificationSource.Text, NotificationContent.Svg);
            if (thandler != null)
            msg.TimerEndedEvent += thandler;
            msg.TimeOut = timeout;
            msg.BubbleWidth = width;
            msg.BubbleHeight = height;
            msg.Notify ();
        }
コード例 #46
0
        public void SendNotification(string deviceToken, long id, string content, NotificationType type)
        {
            var notification = new Notification(deviceToken);

            notification.Payload.Alert.Body = content;
            notification.Payload.Sound = "default";
            notification.Payload.Badge = 1;

            notification.Payload.AddCustom("Type", type.ToString());
            notification.Payload.AddCustom("Id", id);

            //queue the notification for notification
            notificationService.QueueNotification(notification);
        }
コード例 #47
0
ファイル: Notifier.cs プロジェクト: narzul/SmartWard
 protected static object ConstructEvent(NotificationType type, object obj)
 {
     var notevent = new { Event = type.ToString(), Data = obj };
     return notevent;
 }
コード例 #48
0
ファイル: StoreHooks.cs プロジェクト: stevehansen/vidyano_v1
#pragma warning disable 1998
        public override async Task ShowNotification(string notification, NotificationType notificationType)
#pragma warning restore 1998
        {
            var notifier = ToastNotificationManager.CreateToastNotifier();
            if (notifier.Setting == NotificationSetting.Enabled && Service.Current != null)
            {
                var toastXml = new XmlDocument();

                var toast = toastXml.CreateElement("toast");
                toastXml.AppendChild(toast);

                var visual = toastXml.CreateElement("visual");
                visual.SetAttribute("version", "1");
                visual.SetAttribute("lang", "en-US");
                toast.AppendChild(visual);

                var binding = toastXml.CreateElement("binding");
                binding.SetAttribute("template", "ToastImageAndText02");
                visual.AppendChild(binding);

                var image = toastXml.CreateElement("image");
                image.SetAttribute("id", "1");
                image.SetAttribute("src", @"Assets/Notification" + Service.Current.Messages[notificationType.ToString()] + ".png");
                binding.AppendChild(image);

                var notificationTypeText = toastXml.CreateElement("text");
                notificationTypeText.SetAttribute("id", "1");
                notificationTypeText.InnerText = notificationType.ToString();
                binding.AppendChild(notificationTypeText);

                var notificationText = toastXml.CreateElement("text");
                notificationText.SetAttribute("id", "2");
                notificationText.InnerText = notification;
                binding.AppendChild(notificationText);

                var toastNotification = new ToastNotification(toastXml);
                toastNotification.Activated += (sender, args) => ShowNotificationAsDialog(notification, notificationType);
                notifier.Show(toastNotification);
            }
            else
                ShowNotificationAsDialog(notification, notificationType);
        }