Exemple #1
0
        public async Task <ServiceReturn <bool> > CreateDescendantAsync(AuthenticationType tipoAuth, string idParent, MobileApps.Core.BusinessLayer.Entities.Patient desc, string colorHex, 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.Error);
            }
            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_MULE_URL");

                PatientsPatientClient sc = new PatientsPatientClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                var descBody = TranslatePatientLocaltoDescendantGP(desc, colorHex);

                await sc.IdDescendantsAsync(descBody, idParent);

                return(ServiceReturnHandling.BuildSuccessCallReturn <bool>(true, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <bool>(ex, uiMessages));
            }
        }
Exemple #2
0
        public async Task <ServiceReturn <List <DescendantCollectionItem> > > GetUserDescendants(AuthenticationType tipoAuth, string idUser, 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.Error);
            }
            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            List <DescendantCollectionItem> listFinal = new List <DescendantCollectionItem>();

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_MULE_URL");

                PatientsPatientClient sc = new PatientsPatientClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                var resDesc = await sc.IdDescendantsAsync(0, 100, idUser);

                if (resDesc != null)
                {
                    listFinal = resDesc.ToList();
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <DescendantCollectionItem> >(listFinal, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <DescendantCollectionItem> >(ex, uiMessages));
            }
        }