Example #1
0
        public static async Task <LG.Data.Models.Doctors.Schedule.DoctorsAvailablePerState> ListOfDoctorsPerState(string state)
        {
            var client = ClientConnection.GetMpmsConnection();
            var entity = new LG.Data.Models.Doctors.Schedule.DoctorsAvailablePerState()
            {
                StateCode = state
            };

            try
            {
                client.Open();
                var response = await client.GetMedicalPractitionersAsync(new GetMedicalPractitionersRequest()
                {
                    MessageGuid = Guid.NewGuid(),
                    IsActiveMedicalPractitionerFilter = IsActiveFilterEnum.ActiveOnly,
                    IsExpiredLicenseFilter            = IsExpiredFilterEnum.NonExpired,
                    IsVoidLicenseFilter = IsVoidFilterEnum.NonVoid,
                    IsTestingMedicalPractitionerFilter = IsTestingFilterEnum.All,
                    MSPRID = 100
                });

                client.Close();
                var list = response.ListOfMedicalPractitionerInfo.ToList();
                foreach (var doctor in list)
                {
                    foreach (
                        var license in
                        doctor.ListOfMedicalLicenses.Where(license => license.StateCode == entity.StateCode))
                    {
                        entity.ListOfPractitionerInfo.Add(doctor);
                        entity.ListOfPractitionerAvailablePerState.Add(
                            new MedicalPractitionerAvailabilityOneState()
                        {
                            StateCode              = entity.StateCode,
                            FName                  = doctor.MedicalPractitioner.PersonInfo.FName,
                            LName                  = doctor.MedicalPractitioner.PersonInfo.LName,
                            PrintedName            = doctor.MedicalPractitioner.PrintedName,
                            MedicalPractitionerRID = doctor.MedicalPractitioner.RID,
                            IsPrimary              = license.IsPrimaryState,
                            IsTesting              = doctor.MedicalPractitioner.IsTesting
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                client.Close();
                entity.IsError = true;
                entity.Message = ex.ToString();
            }
            finally
            {
                client.Close();
            }
            return(entity);
        }
        public static async Task<LG.Data.Models.Doctors.Schedule.DoctorsAvailablePerState> ListOfDoctorsPerState(string state)
        {
            var client = ClientConnection.GetMpmsConnection();
            var entity = new LG.Data.Models.Doctors.Schedule.DoctorsAvailablePerState()
            {
                StateCode = state
            };
            try
            {
                client.Open();
                var response = await client.GetMedicalPractitionersAsync(new GetMedicalPractitionersRequest()
                {
                    MessageGuid = Guid.NewGuid(),
                    IsActiveMedicalPractitionerFilter = IsActiveFilterEnum.ActiveOnly,
                    IsExpiredLicenseFilter = IsExpiredFilterEnum.NonExpired,
                    IsVoidLicenseFilter = IsVoidFilterEnum.NonVoid,
                    IsTestingMedicalPractitionerFilter = IsTestingFilterEnum.All,
                    MSPRID = 100
                });
                client.Close();
                var list = response.ListOfMedicalPractitionerInfo.ToList();
                foreach (var doctor in list)
                {
                    foreach (
                        var license in
                            doctor.ListOfMedicalLicenses.Where(license => license.StateCode == entity.StateCode))
                    {
                        entity.ListOfPractitionerInfo.Add(doctor);
                        entity.ListOfPractitionerAvailablePerState.Add(
                            new MedicalPractitionerAvailabilityOneState()
                            {
                                StateCode = entity.StateCode,
                                FName = doctor.MedicalPractitioner.PersonInfo.FName,
                                LName = doctor.MedicalPractitioner.PersonInfo.LName,
                                PrintedName = doctor.MedicalPractitioner.PrintedName,
                                MedicalPractitionerRID = doctor.MedicalPractitioner.RID,
                                IsPrimary = license.IsPrimaryState,
                                IsTesting = doctor.MedicalPractitioner.IsTesting
                            });
                    }
                }
            }
            catch (Exception ex)
            {
                client.Close();
                entity.IsError = true;
                entity.Message = ex.ToString();

            }
            finally
            {
                client.Close();
            }
            return entity;
        }