public void Delete(object entity) { DeleteCohortPatientViewDataRequest request = (DeleteCohortPatientViewDataRequest)entity; try { using (PatientMongoContext ctx = new PatientMongoContext(_dbName)) { var q = MB.Query <MECohortPatientView> .EQ(b => b.Id, ObjectId.Parse(request.Id)); var ub = new List <MB.UpdateBuilder>(); ub.Add(MB.Update.Set(MECohortPatientView.TTLDateProperty, DateTime.UtcNow.AddDays(_expireDays))); ub.Add(MB.Update.Set(MECohortPatientView.DeleteFlagProperty, true)); ub.Add(MB.Update.Set(MECohortPatientView.LastUpdatedOnProperty, DateTime.UtcNow)); ub.Add(MB.Update.Set(MECohortPatientView.UpdatedByProperty, ObjectId.Parse(this.UserId))); IMongoUpdate update = MB.Update.Combine(ub); ctx.CohortPatientViews.Collection.Update(q, update); AuditHelper.LogDataAudit(this.UserId, MongoCollectionName.CohortPatientView.ToString(), request.Id.ToString(), Common.DataAuditType.Delete, request.ContractNumber); } } catch (Exception) { throw; } }
public DeleteCohortPatientViewDataResponse Delete(DeleteCohortPatientViewDataRequest request) { DeleteCohortPatientViewDataResponse response = new DeleteCohortPatientViewDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientDD:DeleteCohortPatientView()::Unauthorized Access"); } response = PatientManager.DeleteCohortPatientViewByPatientId(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatterUtil.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Helpers.LogException(int.Parse(aseProcessID), ex); } return(response); }
DeleteCohortPatientViewDataResponse IPatientDataManager.DeleteCohortPatientViewByPatientId(DeleteCohortPatientViewDataRequest request) { throw new NotImplementedException(); }
public DeleteCohortPatientViewDataResponse DeleteCohortPatientViewByPatientId(DeleteCohortPatientViewDataRequest request) { DeleteCohortPatientViewDataResponse response = null; try { response = new DeleteCohortPatientViewDataResponse(); IPatientRepository cpvRepo = Factory.GetRepository(request, RepositoryType.CohortPatientView); CohortPatientViewData cpvData = cpvRepo.FindCohortPatientViewByPatientId(request.PatientId); if (cpvData != null) { request.Id = cpvData.Id; cpvRepo.Delete(request); response.DeletedId = request.Id; } response.Success = true; return(response); } catch (Exception ex) { throw ex; } }