Ejemplo n.º 1
0
        public async Task NotifyFriend(long currentUserId, SendNotificationModel notificationModel)
        {
            var notification = facade.SendNotification(notificationModel, currentUserId);

            await Clients.Others.SendAsync("NotificationReceived", notification);

            await Clients.Caller.SendAsync("NotificationSent");
        }
Ejemplo n.º 2
0
 public void SendNotification(SendNotificationModel model)
 {
     TemplateApi.SendMessage(model.AccessToken, new TemplateMessage()
     {
         Url        = model.Url,
         Data       = model.Data,
         TemplateId = model.TemplateId,
         Topcolor   = model.TopColor,
         Touser     = model.OpenIdSendTo,
     });
 }
Ejemplo n.º 3
0
        public UiViewsModule(ActivityTracker tracker)
            : base(BaseUrl)
        {
            _tracker                       = tracker;
            Get["/"]                       = _ => View["views/status.sshtml"];
            Get["/status"]                 = _ => View["views/status.sshtml"];
            Get["/activity"]               = _ => View["views/activity.sshtml"];
            Get["/gallery"]                = _ => View["views/gallery.sshtml"];
            Get["/configure"]              = _ => View["views/configure.sshtml"];
            Get["/about"]                  = _ => View["views/about.sshtml"];
            Get["/tools/diagnostics"]      = _ => View["views/diagnostics.sshtml"];
            Get["/tools/sendnotification"] = _ =>
            {
                var siteInfo = _tracker.StartEvent;

                var config = Container.Resolve <WebServiceActivityConfig>();

                var notification = new NotificationEvent
                {
                    AgentId                = siteInfo.AgentId,
                    CheckId                = "CheckId",
                    CriticalFailure        = false,
                    CriticalFailureDetails = null,
                    Data           = "JSON Serialised copy of this...",
                    MinuteBucket   = AnalyticsBaseline.MinuteBucket,
                    HourBucket     = AnalyticsBaseline.HourBucket,
                    DayBucket      = AnalyticsBaseline.DayBucket,
                    DisplayUnit    = "",
                    EventType      = "",
                    GeneratedOnUtc = DateTime.UtcNow,
                    Id             = Guid.NewGuid(),
                    Latitude       = "",
                    Longitude      = "",
                    Message        = "Message",
                    Properties     = new Properties {
                        { "SomeProperty", "SomeValue" }
                    },
                    Result      = false,
                    ResultCount = 0,
                    SiteId      = siteInfo.SiteId,
                    State       = MessageStateTypes.NotSet,
                    Tags        = new List <string> {
                        "SomeTag"
                    },
                    Version = Guid.Empty
                };
                var keys = config.ApiKeys != null?config.ApiKeys.ToArray() : new string[0];

                var model = new SendNotificationModel(notification, keys);
                return(View["views/sendnotification.sshtml", model]);
            };
        }
        public async Task <ActionResult> SendNotification(SendNotificationModel model)
        {
            try
            {
                // Initialize the graph client
                var graphClient = _graphSdkHelper.GetAuthenticatedClient(User);

                await GraphService.PostNotificationAsync(graphClient, model.Notification);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                model.Error = ex.ToString();
                return(View(model));
            }
        }
        public NotificationModel SendNotification(SendNotificationModel notificationModel, long currentUserId)
        {
            var addedNotification = NotificationManager.SendNotification(Mapper.Mapper.AutoMap <SendNotificationModel, Notification>(notificationModel), currentUserId);

            return(Mapper.Mapper.Map(addedNotification));
        }
 public NotificationModel AddSavedMovie([FromBody] SendNotificationModel notificationModel)
 {
     return(facadeNotification.SendNotification(notificationModel, CurrentUser.Id));
 }