Beispiel #1
0
        //private async Task RefreshNotifications()
        //{
        //    // await SL.Manager.RefreshNotificationsAsync(ProcessNotificationList);
        //}

        private void ProcessNotificationList(NotificationResponseModel notification)
        {
            //if(notification.NotificationObject!=null)
            //    PushNotificationService.CreateLocalNotification(notification.NotificationObject);
            //var notifications = profile?.ResponseNotificationList;
            //if (notifications?.Count > 0)
            //{

            //}
        }
        private void RefreshNotificationsComplete(NotificationResponseModel response)
        {
            if (response.ResponseCode > 0)
            {
                TableView.ReloadData();
            }

            //TableView.HideLoader();

            RefreshTable(response.ResponseNotificationList);
        }
        public static NotificationResponseModel ToModel(NotificationDTO notificationDTO)
        {
            var notificationResponseModel = new NotificationResponseModel()
            {
                Id      = notificationDTO.Id,
                IsRead  = notificationDTO.IsRead,
                Subject = notificationDTO.Mail.Subject,
                Message = notificationDTO.Mail.Body
            };

            return(notificationResponseModel);
        }
        public IHttpActionResult Next()
        {
            Notification notification = this.notifications.GetNextNotificationForUser(this.User.Identity.GetUserId());

            if (notification == null)
            {
                return(this.StatusCode(HttpStatusCode.NotModified));
            }

            NotificationResponseModel response = Mapper.Map <NotificationResponseModel>(notification);

            return(this.Ok(response));
        }
Beispiel #5
0
        public async Task <NotificationResponseModel> GetNotification(int userId)
        {
            NotificationResponseModel notifications = new NotificationResponseModel();

            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    notifications = JsonConvert.DeserializeObject <NotificationResponseModel>(await(await new HttpClient().GetAsync(new Uri(Constants.baseUrl + ("api/Notifications?Id=" + (object)userId)))).Content.ReadAsStringAsync());
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.StackTrace);
                notifications.Message = ex.StackTrace;
            }
            return(notifications);
        }
Beispiel #6
0
        public async Task ExecuteLoadItemsCommand()
        {
            if (this.IsBusy)
            {
                return;
            }
            this.IsBusy = true;
            try
            {
                aiNotification.IsRunning = true;

                NotificationResponseModel notification = await new Utilities().GetNotification(App.Database.GetLoggedUser().Id);
                if (notification.Data != null)
                {
                    foreach (NotificationModel notificationModel in (Collection <NotificationModel>)notification.Data)
                    {
                        DateTime dateTime = Convert.ToDateTime(notificationModel.DateTime, (IFormatProvider) new CultureInfo("en-US"));
                        notificationModel.DateLabel = dateTime.ToString("MMM dd") + " at " + dateTime.ToString("HH:mm");
                    }
                    NotificationList = notification.Data;
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert("", notification.Message, "Ok");
                }

                aiNotification.IsRunning = false;
            }
            catch (Exception ex)
            {
                Console.Write(ex.StackTrace);
                aiNotification.IsRunning = false;
            }
            finally
            {
                this.IsBusy = false;
            }
        }