示例#1
0
        public bool InsertNotifications([FromBody] NotificationPostModel NotyPostModel)
        {
            bool result = false;

            try
            {
                if (!string.IsNullOrEmpty(NotyPostModel.ImageStr))
                {
                    NotyPostModel.ImageURL = Utilities.SaveImage(NotyPostModel.ImageStr, NotyPostModel.ImageType, FileSavePath.NOTIFICATIONIMGPATH.ToString());
                }

                if (!string.IsNullOrEmpty(NotyPostModel.DocStr))
                {
                    NotyPostModel.DocURL = Utilities.SaveImage(NotyPostModel.DocStr, NotyPostModel.DocType, FileSavePath.NOTIFICATIONDOCPATH.ToString());
                }

                result = _activityService.InsertNotification(NotyPostModel);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(result);
        }
        /// <inheritdoc />
        public Task PushAsync(string title, string content, string targetDeviceId)
        {
            var request = new NotificationPostModel()
            {
                Title   = title,
                Content = content,
                TargetDeviceIdentity = targetDeviceId,
                PushType             = "note"
            };

            return(_pushBulletService.PushNotification(request));
        }
示例#3
0
        public async Task <ActionResult> GetNotificationpost(Guid?postid, string sourceId)
        {
            //From Sponsor Page
            var services = new OrganiserBasicDetailsServices();
            NotificationPostModel notificationPost = new NotificationPostModel();

            notificationPost.sourceID = sourceId;
            notificationPost.PostId   = postid;
            var sponsorList = services.GetSponsorList(SessionToken, Guid.Parse(User.Identity.GetUserId())).Entity;

            if (sponsorList != null)
            {
                var notifiedSponsorPost = sponsorList.Where(x => x.ImageId == postid).Select(x => x.Image).FirstOrDefault();
                if (notifiedSponsorPost != null)
                {
                    notificationPost.Image = Imageget(notifiedSponsorPost);
                }
            }
            //From Gallery Page of Participants
            var galleryList = await services.GetParticipantGallerydata(SessionToken);

            if (galleryList != null)
            {
                var filteredGallery = galleryList.FirstOrDefault(x => x.PostId == postid);

                notificationPost.Image = filteredGallery == null ? null : Imageget(filteredGallery.ImageData);
                notificationPost.Video = filteredGallery == null ? null : filteredGallery.VideoData;
            }
            //Participation post
            var participantPost = await services.GetParticipantRegistration(SessionToken);

            if (participantPost != null)
            {
                var filteredParticiapnts = participantPost.FirstOrDefault(x => x.VideoId == postid && x.OrganizerId == User.Identity.GetUserId());
                var eventImageorVideo    = await services.GetEventRegistrationImageVideo(SessionToken);

                if (filteredParticiapnts != null)
                {
                    var ImageorVideo = eventImageorVideo == null ? null : eventImageorVideo.Where(x => x.Imagevideo.EventIdImageorVideo == filteredParticiapnts.EventId).Select(x => x.Imagevideo.imageorvideo).FirstOrDefault();
                    if (ImageorVideo == 1)
                    {
                        notificationPost.Image = filteredParticiapnts == null ? null : Imageget(filteredParticiapnts.Data);
                    }
                    else if (ImageorVideo == 2)
                    {
                        notificationPost.Video = filteredParticiapnts == null ? null : filteredParticiapnts.Data;
                    }
                }
            }
            //Home post
            var homeList = await services.GetHomePage(SessionToken);

            if (homeList != null)
            {
                notificationPost.PostId = postid;
                var homePost = homeList.FirstOrDefault(x => x.Postid == postid && x.UserId == User.Identity.GetUserId());
                if (homePost != null)
                {
                    if (homePost.Image != null)
                    {
                        notificationPost.Image = Imageget(homePost.Image);
                    }
                    if (homePost.Video != null)
                    {
                        notificationPost.Video = homePost.Video;
                    }
                }
            }
            ViewBag.LikeCount    = data.GetTotalLikesOfPost(SessionToken).Entity == null ? 0 : data.GetTotalLikesOfPost(SessionToken).Entity.Where(x => x.Imageid == postid && x.DestinationUserId == User.Identity.GetUserId() && x.LikeStatus == true).Select(x => x).Count();
            ViewBag.DislikeCount = data.GetTotalLikesOfPost(SessionToken).Entity.Where(x => x.Imageid == postid && x.DestinationUserId == User.Identity.GetUserId() && x.LikeStatus == false).Select(x => x).Count();
            ViewBag.commentCount = data.GetcommentCount(SessionToken).Entity.Where(x => x.PostId == postid && x.DestinationUserId == User.Identity.GetUserId()).Select(x => x).Count();
            return(View(notificationPost));
        }
        public async Task PushNotification(NotificationPostModel request)
        {
            var pushRequest = JsonConvert.SerializeObject(request);

            await Post(_token, "pushes", pushRequest).ConfigureAwait(false);
        }
示例#5
0
 public bool InsertNotification(NotificationPostModel notificationPostModel)
 {
     return(_ActivityRepo.InsertNotification(notificationPostModel));
 }