public async Task <ServiceReturn <bool> > SetNotificationReadStatusAsync(AuthenticationType tipoAuth, Notification notification, bool markAsRead, string successMessage = "", string errorMessage = "") { var uiMessages = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(errorMessage)) { uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage); } else { uiMessages.Add(ServiceReturnHandling.GenericMessageKey, AppResources.FailGetNotificationsList); } if (!string.IsNullOrEmpty(successMessage)) { uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage); } bool success; try { string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL"); Generated.NotificationsClient sc = new Generated.NotificationsClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient())); success = await sc.SetNotificationReadStatusAsync(notification.IdNotification, markAsRead, GetGPAppVersion()); return(ServiceReturnHandling.BuildSuccessCallReturn <bool>(success, uiMessages)); } catch (Exception ex) { return(ServiceReturnHandling.HandleException <bool>(ex, uiMessages)); } }
public async Task <ServiceReturn <List <Notification> > > NotificationsByUserTypeAsync(AuthenticationType tipoAuth, string userId, string successMessage = "", string errorMessage = "") { var uiMessages = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(errorMessage)) { uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage); } else { uiMessages.Add(ServiceReturnHandling.GenericMessageKey, AppResources.FailGetNotificationsList); } if (!string.IsNullOrEmpty(successMessage)) { uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage); } List <Notification> notifications = null; try { string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL"); Generated.NotificationsClient sc = new Generated.NotificationsClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient())); var retTemp = await sc.NotificationsByUserTypeAsync(null, Generated.UserType4.Patient, userId, 0, 1000, GetGPAppVersion()); if (retTemp != null) { notifications = new List <Notification>(); foreach (var item in retTemp) { notifications.Add(TranslateNotificationsGPToLocal(item)); } } return(ServiceReturnHandling.BuildSuccessCallReturn <List <Notification> >(notifications, uiMessages)); } catch (Exception ex) { return(ServiceReturnHandling.HandleException <List <Notification> >(ex, uiMessages)); } }