public async Task <ServiceReturn <List <Specialty> > > GetSpecialtiesByIdsAsync(AuthenticationType tipoAuth, List <int> specialitiesIds, List <int> facilitiesIds, int skip, int take, 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.GetSpecialtyError);
            }

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

            List <Specialty> ret = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                //ObservableCollection<Generated.ExternalFilterSpeciality> listFilter = new ObservableCollection<Generated.ExternalFilterSpeciality>();
                //foreach (var item in specialitiesIds)
                //{
                //    Generated.ExternalFilterSpeciality filter = new Generated.ExternalFilterSpeciality()
                //    {
                //        Id = item
                //    };
                //    listFilter.Add(filter);
                //}

                var retTemp = await sc.SpecialitiesAsync(specialitiesIds, facilitiesIds, null, skip, take);

                if (retTemp != null)
                {
                    ret = new List <Specialty>();
                    foreach (var item in retTemp)
                    {
                        ret.Add(TranslateSpecialty2GPToLocal(item));
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <Specialty> >(ret, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <Specialty> >(ex, uiMessages));
            }
        }
Esempio n. 2
0
        public async Task <ServiceReturn <List <MedicalAct> > > GetMedicalActsAsync(AuthenticationType tipoAuth, List <int> facilityIds, int?specialtyId, int?humanResourceID, int?financialEntity, 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.GetMedicalActsError);
            }

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

            List <MedicalAct> ret = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                //var specialtyIdFinal = !string.IsNullOrEmpty(specialtyId) ? specialtyId : "";
                //var humanResourceIdFinal = !string.IsNullOrEmpty(humanResourceId) ? humanResourceId : "";
                //var efrIdFinal = !string.IsNullOrEmpty(efrId) ? efrId : "";
                //var facilityIdsFinal = facilityIds.Select(x => double.Parse(x)).ToList();

                var retTemp = await sc.OfferMedicalActsAsync(facilityIds, specialtyId, humanResourceID, null, financialEntity, "", 0, 10000);

                if (retTemp != null)
                {
                    ret = new List <MedicalAct>();
                    foreach (var item in retTemp)
                    {
                        ret.Add(TranslateMedicalActGPToLocal(item));
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <MedicalAct> >(ret, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <MedicalAct> >(ex, uiMessages));
            }
        }
Esempio n. 3
0
        public async Task <ServiceReturn <List <FacilityInfoContext> > > GetFacilitiesInfoContextDetailAsync(AuthenticationType tipoAuth, int facilityId, int skip, int take, 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.GetFacilitiesError);
            }

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

            List <FacilityInfoContext> facilitiesInfoDetails = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                var retTemp = await sc.FacilitiesIdInfoAsync(skip, take, facilityId);

                if (retTemp != null)
                {
                    facilitiesInfoDetails = new List <FacilityInfoContext>();
                    var groupedByContext = retTemp.GroupBy(x => x.Context);

                    foreach (var sameContextItem in groupedByContext)
                    {
                        var res = TranslateFacilityInfoDetail2GPToLocal(sameContextItem);
                        if (res != null)
                        {
                            facilitiesInfoDetails.Add(res);
                        }
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <FacilityInfoContext> >(facilitiesInfoDetails, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <FacilityInfoContext> >(ex, uiMessages));
            }
        }
        public async Task <ServiceReturn <List <Specialty> > > GetSpecialtiesAsync(AuthenticationType tipoAuth, List <int> facilityIds, int?financialEntity = null, int?humanResourceId = null, 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.GetSpecialtiesError);
            }

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

            List <Specialty> ret = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                //Generated.SpecialityBaseFilter extFilter = new Generated.SpecialityBaseFilter();
                //extFilter.ListFacilityIds = new ObservableCollection<double>(facilityIds.Select(x => double.Parse(x)).ToList());

                var retTemp = await sc.OfferSpecialitiesAsync(facilityIds, humanResourceId, financialEntity, null, 0, 10000);

                if (retTemp != null)
                {
                    ret = new List <Specialty>();
                    foreach (var item in retTemp)
                    {
                        ret.Add(TranslateSpecialty2GPToLocal(item));
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <Specialty> >(ret, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <Specialty> >(ex, uiMessages));
            }
        }
Esempio n. 5
0
        public async Task <ServiceReturn <List <Facility> > > GetFacilitiesAsync(AuthenticationType tipoAuth, int skip, int take, 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.GetFacilitiesError);
            }

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


            List <double>   locationIds = new List <double>(); //Enviar lista vazia
            List <Facility> facilities  = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                var retTemp = await sc.FacilitiesAsync(null, null, null, skip, take);

                if (retTemp != null)
                {
                    facilities = new List <Facility>();
                    foreach (var item in retTemp)
                    {
                        facilities.Add(TranslateFacilityGPToLocal(item));
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <Facility> >(facilities, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <Facility> >(ex, uiMessages));
            }
        }
Esempio n. 6
0
        public async Task <ServiceReturn <List <HumanResource> > > GetHumanResourceAsync(AuthenticationType tipoAuth, List <int> facilityIds, int?speciality = null, int?medicalAct = null, int?financialEntity = null, 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.GetMedicsListError);
            }

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

            List <HumanResource> listRes = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                var ret = await sc.OfferStaffAsync(facilityIds, speciality, medicalAct, financialEntity, "", 0, 10000);

                if (ret != null)
                {
                    listRes = new List <HumanResource>();
                    foreach (var item in ret)
                    {
                        listRes.Add(TranslateHumanResourceGPToLocal(item));
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <HumanResource> >(listRes, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <HumanResource> >(ex, uiMessages));
            }
        }
Esempio n. 7
0
        public async Task <ServiceReturn <List <BusinessLayer.Entities.Warning> > > GetSearchWarningsAync(AuthenticationType tipoAuth, int facilityId, string appointId, string skip, string take, 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.GetMedicalActsError);
            }

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

            List <BusinessLayer.Entities.Warning> ret = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                var retTemp = await sc.AppointmentsIdNotesDescriptionAsync(facilityId, appointId);

                if (retTemp != null)
                {
                    ret = new List <BusinessLayer.Entities.Warning>();
                    var warning = TranslateWarningGPToLocal(retTemp);
                    warning.AppointmentId = appointId;
                    ret.Add(warning);
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <BusinessLayer.Entities.Warning> >(ret, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <BusinessLayer.Entities.Warning> >(ex, uiMessages));
            }
        }
Esempio n. 8
0
        public async Task <ServiceReturn <string> > GetHumanResourceCvAsync(AuthenticationType tipoAuth, int humanResourceID, 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.GetMedicInfoError);
            }

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

            string result = string.Empty;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                var ret = (await sc.StaffIdCvAsync(humanResourceID));

                if (ret != null)
                {
                    result = ret.Data;
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <string>(result, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <string>(ex, uiMessages));
            }
        }
Esempio n. 9
0
        public async Task <ServiceReturn <FinancialEntity> > GetDefaultFinancialEntityByUniquePatientIdAsync(AuthenticationType tipoAuth, string facilityID, string uniqueUserId, 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.GetFinancialEntitiesError);
            }

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

            FinancialEntity efrId = null;

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

                Generated.Mulesoft.GETClient sc = new Generated.Mulesoft.GETClient(baseMuleUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));

                var retTemp = await sc.FinancialEntitiesDefaultAsync(facilityID, uniqueUserId);

                if (retTemp != null)
                {
                    efrId = TranslateDefaultFinancialEntityGPToLocal(retTemp);
                }

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