コード例 #1
0
        public async Task <ServiceReturn <bool> > SyncRelatsPacsShareImageAsync(AuthenticationType tipoAuth, List <string> emails, List <string> idDocuments, 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.FailGetResults);
            }

            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            bool res;

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

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

                // Neste momento só permite partilhar 1 doc/img de cada vez
                var idDocument   = idDocuments.FirstOrDefault();
                var emailsConcat = string.Empty;

                foreach (var email in emails)
                {
                    emailsConcat += email + ";";
                }

                if (!string.IsNullOrEmpty(emailsConcat) && emailsConcat.Length > 0)
                {
                    emailsConcat.Remove(emailsConcat.Length - 1);
                }

                var result = await sc.SyncRelatsPacsShareImageAsync(idDocument, emailsConcat, GetGPAppVersion());

                res = true; // checkar return?

                return(ServiceReturnHandling.BuildSuccessCallReturn <bool>(res, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <bool>(ex, uiMessages));
            }
        }
コード例 #2
0
        public async Task <ServiceReturn <bool> > ShareResultDocumentFileAsync(AuthenticationType tipoAuth, List <string> emails, List <string> IdDocumentList, 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.FailGetResults);
            }

            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            bool res;

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

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

                Generated.ShareResultsFilter filter = new Generated.ShareResultsFilter();
                filter.DocumentIds = new System.Collections.ObjectModel.ObservableCollection <string>(IdDocumentList);
                filter.Emails      = new System.Collections.ObjectModel.ObservableCollection <string>(emails);

                var result = await sc.ShareResultsAsync(filter, User.UserId, "Documento", GetGPAppVersion());

                res = true; // checkar return?

                return(ServiceReturnHandling.BuildSuccessCallReturn <bool>(res, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <bool>(ex, uiMessages));
            }
        }