Exemple #1
0
        public static async Task <LG.Data.Models.Clinical.Condition> LoadConditions(
            LG.Data.Models.Clinical.Condition entity)
        {
            var client = ClientConnection.GetCDMS_Connection();

            try
            {
                client.Open();
                var response = await client.GetMedicalConditionsAsync(
                    new GetMedicalConditionsRequest()
                {
                    MessageGuid = Guid.NewGuid(),
                    RID         = entity.RID
                });

                client.Close();
                entity.List         = response.MedicalConditions;
                entity.ActionHelper = new ActionHelper {
                    ClincalActionResult = ClinicalActionResult.Success
                };
                return(entity);
            }
            catch (Exception ex)
            {
                client.Close();
                entity.IsError = true;
                entity.Message = ex.ToString();

                entity.ActionHelper = new ActionHelper {
                    ClincalActionResult = ClinicalActionResult.Failed
                };;
                return(entity);
            }
        }
Exemple #2
0
        public static async Task <LG.Data.Models.Clinical.Condition> Condition(LG.Data.Models.Clinical.Condition entity)
        {
            var client = ClientConnection.GetCDMS_Connection();

            try
            {
                client.Open();
                switch (entity.ActionHelper.ClincalAction)
                {
                case ClinicalAction.Add:
                    #region [@  Method     @]
                    var response = await client.AddMedicalConditionAsync(new AddMedicalConditionRequest()
                    {
                        MessageGuid      = Guid.NewGuid(),
                        MedicalCondition = entity.InsertInput,
                        PropBag          = Propbag
                    });

                    client.Close();
                    entity.NewMedicalConditionID = response.NewMedicalConditionID;
                    entity.ActionHelper          = new ActionHelper {
                        ClincalActionResult = ClinicalActionResult.Success
                    };;
                    #endregion
                    break;

                case ClinicalAction.Update:
                    #region [@  Method     @]
                    var response2 = await client.UpdateMedicalConditionAsync(
                        new UpdateMedicalConditionRequest()
                    {
                        MessageGuid      = Guid.NewGuid(),
                        MedicalCondition = entity.UpdateInput,
                        PropBag          = Propbag
                    });

                    client.Close();
                    entity.ActionHelper = new ActionHelper
                    {
                        ClincalActionResult = ClinicalActionResult.Success
                    };;
                    entity.Message = response2.ExitCode.ToString();
                    #endregion
                    break;

                case ClinicalAction.ToggleHidden:
                    #region [@  Method     @]
                    var response3 = await client.ToggleIsHiddenMedicalConditionAsync(
                        new ToggleIsHiddenMedicalConditionRequest()
                    {
                        MessageGuid = Guid.NewGuid(),
                        ID          = entity.UpdateInput.ID,
                        IsHidden    = entity.UpdateInput.IsHidden,
                        PropBag     = Propbag
                    });

                    client.Close();
                    entity.ActionHelper = new ActionHelper {
                        ClincalActionResult = ClinicalActionResult.Success
                    };;
                    #endregion
                    break;

                case ClinicalAction.LoadAll:
                    #region [@  Method     @]
                    var response4 = await client.GetMedicalConditionsAsync(new GetMedicalConditionsRequest()
                    {
                        MessageGuid = Guid.NewGuid(),
                        RID         = entity.RID
                    });

                    client.Close();
                    entity.List         = response4.MedicalConditions;
                    entity.ActionHelper = new ActionHelper {
                        ClincalActionResult = ClinicalActionResult.Success
                    };;
                    #endregion
                    break;

                case ClinicalAction.LoadDetail:
                    #region [@  Method     @]
                    var response5 = await client.GetMedicalConditionAsync(new GetMedicalConditionRequest()
                    {
                        MessageGuid = Guid.NewGuid(),
                        ID          = entity.UpdateInput.ID
                    });

                    client.Close();
                    entity.MedicalConditionItem = response5.MedicalCondition;
                    entity.ActionHelper         = new ActionHelper {
                        ClincalActionResult = ClinicalActionResult.Success
                    };;
                    #endregion
                    break;
                }
                return(entity);
            }
            catch (Exception ex)
            {
                client.Close();
                entity.IsError      = true;
                entity.Message      = ex.ToString();
                entity.ActionHelper = new ActionHelper {
                    ClincalActionResult = ClinicalActionResult.Failed
                };;
                return(entity);
            }
        }