コード例 #1
0
        public static async Task <LG.Data.Models.BaseModel> Batch(LG.Data.Models.Doctors.Schedule.Entity entity)
        {
            var client = ClientConnection.GetMpmsSMConnection();

            try
            {
                client.Open();
                entity.InstanceGuid = Guid.NewGuid();
                var response = await client.StorePractitionerAvailabilityBatchAsync(new StorePractitionerAvailabilityBatchRequest()
                {
                    MessageGuid = entity.InstanceGuid,
                    MedicalPractitionerAvailabilityBatch = GetDBatch(entity),
                    PropBag = "<PropBag></PropBag>"
                });

                client.Close();
                return(new LG.Data.Models.BaseModel()
                {
                    IsError = false,
                    Message = "Test"
                });
            }
            catch (Exception ex)
            {
                client.Close();
                entity.IsError = true;
                entity.Message = ex.ToString();
                return(new LG.Data.Models.BaseModel()
                {
                    IsError = true,
                    Message = ex.ToString()
                });
            }
            return(null);
        }
コード例 #2
0
        internal static MedicalPractitionerAvailabilityBatch GetDBatch(LG.Data.Models.Doctors.Schedule.Entity entity)
        {
            var result = new MedicalPractitionerAvailabilityBatch()
            {
                MSPRID = entity.AvailabilityBatch.MSPRID,
                MedicalPractitionerAvailabilities = GetAvailabilities(entity)
            };

            return(result);
        }
コード例 #3
0
        public static async Task <LG.Data.Models.BaseModel> SingleBlock(LG.Data.Models.Doctors.Schedule.Entity entity)
        {
            var client = ClientConnection.GetMpmsSMConnection();

            try
            {
                client.Open();
                var response = await client.StorePractitionerAvailabilitySingleBlockAsync(new StorePractitionerAvailabilitySingleBlockRequest()
                {
                    MessageGuid            = entity.InstanceGuid,
                    MedicalPractitionerRID = entity.MedicalPractitionerRID,
                    MSPRID            = entity.MSPRID,
                    DTDST_ShiftEnds   = entity.D_To,
                    DTDST_ShiftStarts = entity.D_From,
                    PropBag           = "<PropBag></PropBag>"
                });

                client.Close();
                return(new LG.Data.Models.BaseModel()
                {
                    IsError = false,
                    Message = String.Format("{0},{1}", response.ExitCode, response.ReturnStatus.GeneralMessage)
                });
            }
            catch (Exception ex)
            {
                client.Close();
                entity.IsError = true;
                entity.Message = ex.ToString();
                return(new LG.Data.Models.BaseModel()
                {
                    IsError = true,
                    Message = ex.ToString()
                });
            }
            return(null);
        }
コード例 #4
0
        public static async Task <LG.Data.Models.Doctors.Schedule.Entity> PractitionerSchedule(LG.Data.Models.Doctors.Schedule.Entity entity)
        {
            var client = ClientConnection.GetMpmsSMConnection();

            try
            {
                client.Open();
                var response = await client.GetPractitionerScheduleAsync(new GetPractitionerScheduleRequest()
                {
                    MSPRID                 = entity.MSPRID,
                    MessageGuid            = entity.InstanceGuid,
                    MedicalPractitionerRID = entity.MedicalPractitionerRID,
                    D_From                 = entity.D_From,
                    D_To = entity.D_To
                });

                client.Close();
                entity.AvailabilityBlocks = response.AvailabilityList;
                return(entity);
            }
            catch (Exception ex)
            {
                client.Close();
                entity.IsError = true;
                entity.Message = ex.ToString();
            }
            return(null);
        }
コード例 #5
0
        internal static List <LG.Services.MPMS.SM.MedicalPractitionerAvailability> GetAvailabilities(LG.Data.Models.Doctors.Schedule.Entity entity)
        {
            var result = new List <LG.Services.MPMS.SM.MedicalPractitionerAvailability>();

            foreach (var availibility in entity.AvailabilityBatch.MedicalPractitionerAvailabilities)
            {
                var item = new MedicalPractitionerAvailability
                {
                    MedicalPractitionerRID = availibility.MedicalPractitionerRID,
                    AvalibilityBlocks      = new List <AvailabilityBlockInput>()
                };
                foreach (var time in availibility.AvalibilityBlocks)
                {
                    item.AvalibilityBlocks.Add(
                        new AvailabilityBlockInput()
                    {
                        DTDST_ShiftEnds  = time.DTDST_ShiftEnds,
                        DTDST_ShiftStart = time.DTDST_ShiftStart,
                    });
                }
                result.Add(item);
            }
            return(result);
        }