Example #1
0
        public void Delete(object entity)
        {
            DeletePatientSystemByPatientIdDataRequest request = (DeletePatientSystemByPatientIdDataRequest)entity;

            try
            {
                using (PatientSystemMongoContext ctx = new PatientSystemMongoContext(ContractDBName))
                {
                    var query = MB.Query <MEPatientSystem> .EQ(b => b.Id, ObjectId.Parse(request.Id));

                    var builder = new List <MB.UpdateBuilder>();
                    builder.Add(MB.Update.Set(MEPatientSystem.TTLDateProperty, DateTime.UtcNow.AddDays(_expireDays)));
                    builder.Add(MB.Update.Set(MEPatientSystem.DeleteFlagProperty, true));
                    builder.Add(MB.Update.Set(MEPatientSystem.LastUpdatedOnProperty, DateTime.UtcNow));
                    builder.Add(MB.Update.Set(MEPatientSystem.UpdatedByProperty, ObjectId.Parse(this.UserId)));

                    IMongoUpdate update = MB.Update.Combine(builder);
                    ctx.PatientSystems.Collection.Update(query, update);

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.PatientSystem.ToString(),
                                             request.Id.ToString(),
                                             Common.DataAuditType.Delete,
                                             request.ContractNumber);
                }
            }
            catch (Exception) { throw; }
        }
 public void DeletePatientSystems(DeletePatientSystemsDataRequest request)
 {
     try
     {
         if (!string.IsNullOrEmpty(request.Ids))
         {
             var      repo = Factory.GetRepository(RepositoryType.PatientSystem);
             string[] Ids  = request.Ids.Split(',');
             foreach (string id in Ids)
             {
                 DeletePatientSystemByPatientIdDataRequest deleteReq = new DeletePatientSystemByPatientIdDataRequest
                 {
                     Id             = id.Trim(),
                     PatientId      = request.PatientId,
                     Context        = request.Context,
                     ContractNumber = request.ContractNumber,
                     UserId         = request.UserId,
                     Version        = request.Version
                 };
                 repo.Delete(deleteReq);
             }
         }
     }
     catch (Exception ex) { throw ex; }
 }
Example #3
0
        public void Delete(object entity)
        {
            DeletePatientSystemByPatientIdDataRequest request = (DeletePatientSystemByPatientIdDataRequest)entity;

            if (string.IsNullOrEmpty(request.Id))
            {
                //Update the patientsystem object having _id as request.Id
            }
        }
Example #4
0
        public DeletePatientSystemByPatientIdDataResponse Delete(DeletePatientSystemByPatientIdDataRequest request)
        {
            DeletePatientSystemByPatientIdDataResponse response = new DeletePatientSystemByPatientIdDataResponse();

            try
            {
                RequireUserId(request);
                response         = Manager.DeletePatientSystemByPatientId(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
        public DeletePatientSystemByPatientIdDataResponse DeletePatientSystemByPatientId(DeletePatientSystemByPatientIdDataRequest request)
        {
            DeletePatientSystemByPatientIdDataResponse response = null;

            try
            {
                response = new DeletePatientSystemByPatientIdDataResponse();
                var repo = Factory.GetRepository(RepositoryType.PatientSystem);
                List <PatientSystemData> patientSystems = repo.FindByPatientId(request.PatientId) as List <PatientSystemData>;
                List <string>            deletedIds     = null;
                if (patientSystems != null)
                {
                    deletedIds = new List <string>();
                    patientSystems.ForEach(u =>
                    {
                        request.Id = u.Id;
                        repo.Delete(request);
                        deletedIds.Add(request.Id);
                    });
                    response.DeletedIds = deletedIds;
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
Example #6
0
 public DeletePatientSystemByPatientIdDataResponse DeletePatientSystemByPatientId(DeletePatientSystemByPatientIdDataRequest request)
 {
     throw new NotImplementedException();
 }