public void Delete(object entity) { DeletePatientAllergyDataRequest request = (DeletePatientAllergyDataRequest)entity; try { using (AllergyMongoContext ctx = new AllergyMongoContext(ContractDBName)) { var q = MB.Query <MEPatientAllergy> .EQ(b => b.Id, ObjectId.Parse(request.Id)); var uv = new List <MB.UpdateBuilder>(); uv.Add(MB.Update.Set(MEPatientAllergy.TTLDateProperty, DateTime.UtcNow.AddDays(_expireDays))); uv.Add(MB.Update.Set(MEPatientAllergy.LastUpdatedOnProperty, DateTime.UtcNow)); uv.Add(MB.Update.Set(MEPatientAllergy.DeleteFlagProperty, true)); uv.Add(MB.Update.Set(MEPatientAllergy.UpdatedByProperty, ObjectId.Parse(this.UserId))); IMongoUpdate update = MB.Update.Combine(uv); ctx.PatientAllergies.Collection.Update(q, update); AuditHelper.LogDataAudit(this.UserId, MongoCollectionName.PatientAllergy.ToString(), request.Id.ToString(), DataAuditType.Delete, request.ContractNumber); } } catch (Exception) { throw; } }
public void DeletePatientAllergy_Test() { DeletePatientAllergyDataRequest request = new DeletePatientAllergyDataRequest { Context = context, ContractNumber = contractNumber, Id = "54ef4da084ac050d0c615d5c", UserId = userId, Version = version }; //[Route("/{Context}/{Version}/{ContractNumber}/PatientAllergy/{Id}", "DELETE")] DeletePatientAllergyDataResponse response = client.Delete <DeletePatientAllergyDataResponse>( string.Format("{0}/{1}/{2}/{3}/PatientAllergy/{4}?UserId={5}", url, context, version, contractNumber, request.Id, request.UserId)); Assert.IsNotNull(response); }
public DeletePatientAllergyDataResponse Delete(DeletePatientAllergyDataRequest request) { DeletePatientAllergyDataResponse response = new DeletePatientAllergyDataResponse { Version = request.Version }; try { RequireUserId(request); response = Manager.Delete(request); } catch (Exception ex) { RaiseException(response, ex); } return(response); }
public DeletePatientAllergyDataResponse Delete(DeletePatientAllergyDataRequest request) { DeletePatientAllergyDataResponse response = null; try { response = new DeletePatientAllergyDataResponse(); var repo = AllergyRepositoryFactory.GetAllergyRepository(request, RepositoryType.PatientAllergy); if (!string.IsNullOrEmpty(request.Id)) { repo.Delete(request); } return(response); } catch (Exception ex) { throw ex; } }
public DeleteAllergiesByPatientIdDataResponse DeletePatientAllergies(DeleteAllergiesByPatientIdDataRequest request) { DeleteAllergiesByPatientIdDataResponse response = null; try { response = new DeleteAllergiesByPatientIdDataResponse(); var repo = AllergyRepositoryFactory.GetAllergyRepository(request, RepositoryType.PatientAllergy); GetPatientAllergiesDataRequest getAllPatientNotesDataRequest = new GetPatientAllergiesDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, PatientId = request.PatientId, UserId = request.UserId, Version = request.Version }; List <PatientAllergyData> patientAllergies = repo.FindByPatientId(getAllPatientNotesDataRequest) as List <PatientAllergyData>; List <string> deletedIds = null; if (patientAllergies != null) { deletedIds = new List <string>(); patientAllergies.ForEach(u => { DeletePatientAllergyDataRequest deletePADataRequest = new DeletePatientAllergyDataRequest { Context = request.Context, ContractNumber = request.ContractNumber, Id = u.Id, UserId = request.UserId, Version = request.Version }; repo.Delete(deletePADataRequest); deletedIds.Add(deletePADataRequest.Id); }); response.DeletedIds = deletedIds; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }
public DeletePatientAllergyDataResponse Delete(DeletePatientAllergyDataRequest request) { throw new NotImplementedException(); }