Exemple #1
0
        public PutDeleteMedsResponse Put(PutDeleteMedsRequest request)
        {
            var response = new PutDeleteMedsResponse {
                Version = request.Version
            };

            try
            {
                RequireUserId(request);
                response.Success = Manager.DeleteMedDocs(request.MedDocuments);
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
        public bool DeleteMedDocuments(DeleteMedicationMapsRequest request)
        {
            try
            {
                IRestClient client = new JsonServiceClient();
                //[Route("/{Context}/{Version}/{ContractNumber}/Search/MedicationIndex/Medications/Delete", "PUT
                var url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Search/MedicationIndex/Medications/Delete",
                                                               _ddSearchServiceUrl,
                                                               "NG",
                                                               request.Version,
                                                               request.ContractNumber), request.UserId);

                if (!string.IsNullOrEmpty(request.Ids))
                {
                    List <MedNameSearchDocData> dataList = new List <MedNameSearchDocData>();
                    string[] Ids = request.Ids.Split(',');
                    foreach (string id in Ids)
                    {
                        dataList.Add(new MedNameSearchDocData {
                            Id = id.Trim()
                        });
                    }
                    PutDeleteMedsRequest searchRequest = new PutDeleteMedsRequest
                    {
                        Context        = "NG",
                        ContractNumber = request.ContractNumber,
                        UserId         = request.UserId,
                        Version        = request.Version,
                        MedDocuments   = dataList
                    };
                    PutDeleteMedsResponse response = client.Put <PutDeleteMedsResponse>(url, searchRequest as object);
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }