예제 #1
0
        private async Task WonRewardsScheduleRefactorInsideAgain(List <Domain.Dto.RewardsOnDate> userCompletedRewards, Domain.Dto.ProgramInfoDto prg, List <Domain.Dto.UserDeviceDto> userDeviceIds, GeneralSetting serverApiKey, PushNotifications push)
        {
            foreach (var item in userCompletedRewards)
            {
                if (item.ProgramId == prg.id)
                {
                    try
                    {
                        notificationMessage = MessagesConstants.WonRewardNotificationMessage + item.MerchantName;
                        notificationTitle   = MessagesConstants.WonRewardNotificationTitle;

                        await push.SendPushBulk(userDeviceIds.Select(m => m.UserDeviceId).ToList(), notificationTitle, notificationMessage, "", item.RewardId.ToString(), "awards", "icon", "awards", 1, (serverApiKey != null ? serverApiKey.Value : ""), true, "CompleteRewards", item.MerchantId);

                        await _userPushedNotificationService.AddAsync(new UserPushedNotifications()
                        {
                            notificationMessage = notificationMessage,
                            notificationTitle   = notificationTitle,
                            notificationType    = (int)NotificationSettingsEnum.Awards,
                            referenceId         = item.RewardId,
                            createdBy           = item.CreatedBy,
                            modifiedBy          = item.CreatedBy,
                            ProgramId           = item.ProgramId,
                            IsRedirect          = true,
                            NotificationSubType = "CompleteRewards",
                            CustomReferenceId   = item.MerchantId
                        });
                    }
                    catch (Exception ex)
                    {
                        HttpContext.RiseError(new Exception(string.Concat("API := (Scheduler := GeSchedulerForOffersNRewards)", ex.Message, " Stack Trace : ", ex.StackTrace, " Inner Exception : ", ex.InnerException)));
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// NewOffersScheduleRefactorInsideAgain
        /// </summary>
        /// <param name="userOffers"></param>
        /// <param name="prg"></param>
        /// <param name="userDeviceIds"></param>
        /// <param name="serverApiKey"></param>
        /// <param name="push"></param>
        /// <returns></returns>
        private async Task NewOffersScheduleRefactorInsideAgain(List <Domain.Dto.RewardsOnDate> userOffers, Domain.Dto.ProgramInfoDto prg, List <Domain.Dto.UserDeviceDto> userDeviceIds, GeneralSetting serverApiKey, PushNotifications push)
        {
            try
            {
                foreach (var item in userOffers)
                {
                    if (item.ProgramId == prg.id)
                    {
                        var chkFavorites = await _userFavorite.GetUsersListForFavoriteMerchant(userDeviceIds.Select(m => m.Id).ToList(), item.MerchantId);

                        var userFavorites = userDeviceIds.Where(x => chkFavorites.Contains(x.Id)).ToList();
                        await PushToFavorites(serverApiKey, push, item, userFavorites);

                        var userAll = userDeviceIds.Where(x => !chkFavorites.Contains(x.Id)).ToList();
                        await UserAllPushNotifications(serverApiKey, push, item, userAll);

                        await _userPushedNotificationService.AddAsync(new UserPushedNotifications()
                        {
                            notificationMessage = notificationMessage,
                            notificationTitle   = notificationTitle,
                            notificationType    = (int)NotificationSettingsEnum.Offers,
                            referenceId         = item.RewardId,
                            createdBy           = item.CreatedBy,
                            modifiedBy          = item.CreatedBy,
                            ProgramId           = item.ProgramId,
                            IsRedirect          = true,
                            NotificationSubType = "Offers",
                            CustomReferenceId   = item.MerchantId
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                HttpContext.RiseError(new Exception(string.Concat("API := (Scheduler := GeSchedulerForOffersNRewards)", ex.Message, " Stack Trace : ", ex.StackTrace, " Inner Exception : ", ex.InnerException)));
            }
        }
예제 #3
0
        private async Task <List <Domain.Dto.UserDeviceDto> > WonRewardsScheduleRefactorInside(List <Domain.Dto.RewardsOnDate> userCompletedRewards, Domain.Dto.ProgramInfoDto prg, List <Domain.Dto.UserDeviceDto> userDeviceIds)
        {
            if (userDeviceIds.Count > 0)
            {
                var serverApiKeyForWonRewards       = (await _setting.GetGeneratSettingValueByKeyGroup(Constants.FireBaseConstants.FireBaseServerKey)).FirstOrDefault();
                PushNotifications pushForWinRewards = new PushNotifications();
                var usrNotifyForWinRewards          = await _userNotificationSettingsService.GetUserNotificationSettingByNotificaction(userDeviceIds.Select(m => m.Id).ToList(), (int)NotificationSettingsEnum.Awards);

                if (usrNotifyForWinRewards.Count > 0)
                {
                    userDeviceIds = userDeviceIds.Where(x => usrNotifyForWinRewards.Contains(x.Id)).ToList();
                    if (userDeviceIds.Count > 0)
                    {
                        await WonRewardsScheduleRefactorInsideAgain(userCompletedRewards, prg, userDeviceIds, serverApiKeyForWonRewards, pushForWinRewards);
                    }
                }
            }
            return(userDeviceIds);
        }
예제 #4
0
 private async Task NewRewardScheduleRefactorInsideAgain(List <Domain.Dto.RewardsOnDate> userRewards, Domain.Dto.ProgramInfoDto prg, List <Domain.Dto.UserDeviceDto> userDeviceIds, GeneralSetting serverApiKey, PushNotifications push)
 {
     foreach (var item in userRewards)
     {
         if (item.ProgramId == prg.id)
         {
             try
             {
                 await SendPushBulkWithAddPushAsync(userDeviceIds, serverApiKey, push, item);
             }
             catch (Exception ex)
             {
                 HttpContext.RiseError(new Exception(string.Concat("API := (Scheduler := GeSchedulerForOffersNRewards)", ex.Message, " Stack Trace : ", ex.StackTrace, " Inner Exception : ", ex.InnerException)));
             }
         }
     }
 }