示例#1
0
        public static async Task <LG.Data.Models.Clinical.Allergy> LoadAllergies(LG.Data.Models.Clinical.Allergy entity)
        {
            var client = ClientConnection.GetCDMS_Connection();

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

                client.Close();
                entity.List         = response.Allergies;
                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);
            }
        }
示例#2
0
        public static async Task <LG.Data.Models.Clinical.Allergy> Allergy(LG.Data.Models.Clinical.Allergy entity)
        {
            var client = ClientConnection.GetCDMS_Connection();

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

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

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

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

                case ClinicalAction.ToggleHidden:
                    #region [@  Method     @]
                    var response3 = await client.ToggleIsHiddenAllergyAsync(new ToggleIsHiddenAllergyRequest()
                    {
                        MessageGuid = Guid.NewGuid(),
                        ID          = entity.UpdateInput.AllergyID,
                        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.GetAllergiesAsync(new GetAllergiesRequest()
                    {
                        MessageGuid = Guid.NewGuid(),
                        RID         = entity.RID
                    });

                    client.Close();
                    entity.List         = response4.Allergies;
                    entity.ActionHelper = new ActionHelper {
                        ClincalActionResult = ClinicalActionResult.Success
                    };

                    #endregion
                    break;

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

                    client.Close();
                    entity.AllergyItem  = response5.Allergy;
                    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);
            }
        }