예제 #1
0
        /// <summary>
        /// This method is used to store page size into database.
        /// </summary>
        /// <param name="pageSize">Page size to be stored.</param>
        /// <param name="pageType">Page for which the page size needs to be stored.</param>
        /// <param name="userObjectId">User's Azure Active Directory Id.</param>
        /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
        public async Task CreateOrUpdateUserPageSizeChoiceDataAsync(
            int pageSize,
            PageType pageType,
            string userObjectId)
        {
            UserPageSizeChoiceTableEntity userPageSizeChoiceDataEntity = await this.GetUserPageSizeAsync("default", userObjectId);

            if (userPageSizeChoiceDataEntity == null)
            {
                userPageSizeChoiceDataEntity = new UserPageSizeChoiceTableEntity();
            }

            userPageSizeChoiceDataEntity.DefaultValue = "default";
            userPageSizeChoiceDataEntity.UserObjectId = userObjectId;
            if (pageType == PageType.DistributionList)
            {
                userPageSizeChoiceDataEntity.DistributionListPageSize = pageSize;
            }
            else
            {
                userPageSizeChoiceDataEntity.DistributionListMemberPageSize = pageSize;
            }

            await this.UpdateUserPageSizeAsync(userPageSizeChoiceDataEntity);
        }
예제 #2
0
        /// <summary>
        /// This method is used to store page size into database.
        /// </summary>
        /// <param name="userPrincipalName">User Principal Name of the logged in User.</param>
        /// <param name="pageSize">Page size to be stored.</param>
        /// <param name="pageType">Page for which the page size needs to be stored.</param>
        /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
        public async Task CreateOrUpdateUserPageSizeChoiceDataAsync(
            string userPrincipalName,
            int pageSize,
            PageType pageType)
        {
            UserPageSizeChoiceTableEntity userPageSizeChoiceDataEntity = await this.GetAsync("default", userPrincipalName);

            if (userPageSizeChoiceDataEntity == null)
            {
                userPageSizeChoiceDataEntity = new UserPageSizeChoiceTableEntity();
            }

            userPageSizeChoiceDataEntity.DefaultValue      = "default";
            userPageSizeChoiceDataEntity.UserPrincipalName = userPrincipalName.ToLower();

            if (pageType == PageType.DistributionList)
            {
                userPageSizeChoiceDataEntity.DistributionListPageSize = pageSize;
            }
            else
            {
                userPageSizeChoiceDataEntity.DistributionListMemberPageSize = pageSize;
            }

            await this.CreateOrUpdateAsync(userPageSizeChoiceDataEntity);
        }
예제 #3
0
        /// <summary>
        /// Create or update an entity in the table storage.
        /// </summary>
        /// <param name="userPageSizeChoiceTableEntity">User page size entity to be updated.</param>
        /// <returns>A task that represents the delete queued to execute.</returns>
        public async Task UpdateUserPageSizeAsync(UserPageSizeChoiceTableEntity userPageSizeChoiceTableEntity)
        {
            try
            {
                await this.EnsureInitializedAsync();

                TableOperation operation = TableOperation.InsertOrReplace(userPageSizeChoiceTableEntity);
                await this.DlLookupCloudTable.ExecuteAsync(operation);
            }
            catch (Exception ex)
            {
                this.logger.LogError(ex, $"An error occurred in UpdateUserPageSizeAsync: UserObjectId: {userPageSizeChoiceTableEntity.UserObjectId}.");
                throw;
            }
        }