예제 #1
0
        private async Task CreateBuildAsync(BuildFacade buildFacade, NotificationService notificationService, ITurnContext <IMessageActivity> turnContext, CancellationToken cancellationToken, string buildName)
        {
            var build = await buildFacade.CreateBuildAsync(buildName);

            await notificationService.AddNotificationAsync(build.Id, conversationId, ShouldWatch?WatchLevel.Stage : WatchLevel.Build);

            await notificationService.SendReplyAsync($"Created build {build}", turnContext, cancellationToken);
        }
예제 #2
0
        private async Task Send()
        {
            var notification = new Notification();

            try
            {
                var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);

                if (user != null)
                {
                    notification.SiteId          = PageState.Site.SiteId;
                    notification.FromUserId      = PageState.User.UserId;
                    notification.FromDisplayName = PageState.User.DisplayName;
                    notification.FromEmail       = PageState.User.Email;
                    notification.ToUserId        = user.UserId;
                    notification.ToDisplayName   = user.DisplayName;
                    notification.ToEmail         = user.Email;
                    notification.Subject         = subject;
                    notification.Body            = body;
                    notification.ParentId        = notificationid;
                    notification.CreatedOn       = DateTime.UtcNow;
                    notification.IsDelivered     = false;
                    notification.DeliveredOn     = null;
                    notification.SendOn          = DateTime.UtcNow;
                    notification = await NotificationService.AddNotificationAsync(notification);

                    await logger.LogInformation("Notification Created {Notification}", notification);

                    NavigationManager.NavigateTo(NavigateUrl());
                }
                else
                {
                    AddModuleMessage("User Does Not Exist. Please Verify That The Username Provided Is Correct.", MessageType.Warning);
                }
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Adding Notification {Notification} {Error}", notification, ex.Message);

                AddModuleMessage("Error Adding Notification", MessageType.Error);
            }
        }