Ejemplo n.º 1
0
 public List <MedicationMapData> GetMedicationMap(GetMedicationMapDataRequest request)
 {
     try
     {
         List <MedicationMapData> result = null;
         var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.MedicationMapping);
         result = repo.Search(request) as List <MedicationMapData>;
         return(result);
     }
     catch (Exception ex) { throw ex; }
 }
Ejemplo n.º 2
0
        public void GetMedicationMap_Test()
        {
            GetMedicationMapDataRequest request = new GetMedicationMapDataRequest
            {
                Name           = "ADVIL",
                Context        = context,
                ContractNumber = contractNumber,
                UserId         = userId,
                Version        = version
            };
            //[Route("/{Context}/{Version}/{ContractNumber}/MedicationMap/{Name}", "POST")]
            GetMedicationMapDataResponse response = client.Get <GetMedicationMapDataResponse>(string.Format("{0}/{1}/{2}/{3}/MedicationMap/{4}", url, context, version, contractNumber, request.Name));

            Assert.IsNotNull(response);
        }
Ejemplo n.º 3
0
        public GetMedicationMapDataResponse Post(GetMedicationMapDataRequest request)
        {
            var response = new GetMedicationMapDataResponse {
                Version = request.Version
            };

            try
            {
                RequireUserId(request);
                response.MedicationMapsData = Manager.GetMedicationMap(request);
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
 public List <MedicationMapData> GetMedicationMap(GetMedicationMapDataRequest request)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
        public object Search(object request)
        {
            List <MedicationMapData>    list        = null;
            GetMedicationMapDataRequest dataRequest = (GetMedicationMapDataRequest)request;

            try
            {
                using (MedicationMongoContext ctx = new MedicationMongoContext(ContractDBName))
                {
                    List <IMongoQuery> queries = new List <IMongoQuery>();
                    if (!string.IsNullOrEmpty(dataRequest.Name))
                    {
                        queries.Add(Query.EQ(MEMedicationMapping.FullNameProperty, dataRequest.Name.ToUpper()));
                    }
                    if (!string.IsNullOrEmpty(dataRequest.Route))
                    {
                        queries.Add(Query.EQ(MEMedicationMapping.RouteProperty, dataRequest.Route));
                    }
                    if (!string.IsNullOrEmpty(dataRequest.Form))
                    {
                        queries.Add(Query.EQ(MEMedicationMapping.FormProperty, dataRequest.Form));
                    }
                    if (!string.IsNullOrEmpty(dataRequest.Strength))
                    {
                        queries.Add(Query.EQ(MEMedicationMapping.StrengthProperty, dataRequest.Strength));
                    }
                    if (dataRequest.Type != 0)
                    {
                        if (dataRequest.Type == 1)
                        {
                            queries.Add(Query.EQ(MEMedicationMapping.CustomProperty, false));
                        }
                        else if (dataRequest.Type == 2)
                        {
                            queries.Add(Query.EQ(MEMedicationMapping.CustomProperty, true));
                        }
                    }
                    queries.Add(Query.EQ(MEMedicationMapping.DeleteFlagProperty, false));
                    queries.Add(Query.EQ(MEMedicationMapping.TTLDateProperty, BsonNull.Value));
                    IMongoQuery mQuery = Query.And(queries);
                    string[]    fields = { MEMedicationMapping.IdProperty, MEMedicationMapping.FullNameProperty, MEMedicationMapping.RouteProperty, MEMedicationMapping.StrengthProperty, MEMedicationMapping.FormProperty, MEMedicationMapping.CustomProperty };
                    List <MEMedicationMapping> meMMs = null;
                    if (dataRequest.Skip == 0 && dataRequest.Take == 0)
                    {
                        meMMs = ctx.MedicationMaps.Collection.Find(mQuery).SetFields(fields).ToList();
                    }
                    else
                    {
                        meMMs = ctx.MedicationMaps.Collection.Find(mQuery).SetFields(fields).SetSkip(dataRequest.Skip).SetLimit(dataRequest.Take).ToList();
                    }

                    if (meMMs != null && meMMs.Count > 0)
                    {
                        list = new List <MedicationMapData>();
                        meMMs.ForEach(p =>
                        {
                            MedicationMapData data = AutoMapper.Mapper.Map <MedicationMapData>(p);
                            list.Add(data);
                        });
                    }
                }
                return(list);
            }
            catch (Exception) { throw; }
        }