示例#1
0
        /// <summary>
        /// Stores newly created group activity details into storage.
        /// </summary>
        /// <param name="groupActivityEntity">Holds group activity details and group card conversation id.</param>
        /// <returns>A task that represents group activity entity is saved or updated.</returns>
        private async Task <TableResult> StoreOrUpdateEntityAsync(GroupActivityEntity groupActivityEntity)
        {
            await this.EnsureInitializedAsync();

            TableOperation addOrUpdateOperation = TableOperation.InsertOrReplace(groupActivityEntity);

            return(await this.cloudTable.ExecuteAsync(addOrUpdateOperation));
        }
示例#2
0
        /// <summary>
        /// Methods stores newly created group activity into azure table storage.
        /// </summary>
        /// <param name="serviceUrl">Bot activity service URL.</param>
        /// <param name="groupActivityId">Group activity Id.</param>
        /// <param name="teamId">Team id of team where bot is installed.</param>
        /// <param name="groupDetail">Group activity details entered by users in task module.</param>
        /// <param name="groupActivityCreator">Team owner who initiated the group activity.</param>
        /// <param name="groupingCardConversationId">Conversation id of group detail card sent into channel.</param>
        /// <param name="groupingCardActivityId">Activity id of group detail card sent into channel.</param>
        /// <returns>A task that stores group activity data to table storage.</returns>
        public async Task StoreGroupActivityDetailsAsync(string serviceUrl, string groupActivityId, string teamId, GroupDetail groupDetail, string groupActivityCreator, string groupingCardConversationId, string groupingCardActivityId)
        {
            try
            {
                GroupActivityEntity groupActivityEntity = new GroupActivityEntity
                {
                    GroupActivityId          = groupActivityId,
                    GroupActivityTitle       = groupDetail.GroupTitle,
                    GroupActivityDescription = groupDetail.GroupDescription,
                    IsPrivateChannel         = groupDetail.ChannelType == Constants.PrivateChannelType ? true : false,
                    DueDate              = groupDetail.DueDate,
                    CreatedOn            = DateTime.UtcNow,
                    CreatedBy            = groupActivityCreator,
                    ConversationId       = groupingCardConversationId,
                    ActivityId           = groupingCardActivityId,
                    TeamId               = teamId,
                    ServiceUrl           = serviceUrl,
                    IsNotificationActive = groupDetail.ChannelType == Constants.PrivateChannelType ? false : (groupDetail.AutoReminders == Constants.AutoReminderNo ? false : true),
                };

                var isGroupActivitySaved = await this.groupActivityStorageHelper.UpsertGroupActivityAsync(groupActivityEntity);

                if (!isGroupActivitySaved)
                {
                    this.logger.LogError($"Error while saving Group activity data in storage for teamId : {teamId}");
                    return;
                }

                this.logger.LogInformation($"Group activity data successfully saved in storage for teamId : {teamId}");
            }
            catch (Exception ex)
            {
                this.logger.LogError(ex, $"Error while saving Group activity data in storage for teamId : {teamId}");
                throw;
            }
        }
示例#3
0
        /// <summary>
        /// Method stores newly created group activity details into storage.
        /// </summary>
        /// <param name="groupActivityEntity">Holds group activity details.</param>
        /// <returns>A task that return true if group activity data is saved or updated.</returns>
        public async Task <bool> UpsertGroupActivityAsync(GroupActivityEntity groupActivityEntity)
        {
            var result = await this.StoreOrUpdateEntityAsync(groupActivityEntity);

            return(result.HttpStatusCode == (int)HttpStatusCode.NoContent);
        }