public object Initialize(object newEntity) { PutInitializeInterventionRequest ptr = (PutInitializeInterventionRequest)newEntity; MEPatientIntervention pi = null; try { pi = new MEPatientIntervention(this.UserId) { Id = ObjectId.GenerateNewId(), PatientGoalId = ObjectId.Parse(ptr.PatientGoalId), TTLDate = System.DateTime.UtcNow.AddDays(_initializeDays), StatusDate = DateTime.UtcNow, //LastUpdatedOn = DateTime.UtcNow, //UpdatedBy = ObjectId.Parse(this.UserId), Version = ptr.Version }; using (PatientGoalMongoContext ctx = new PatientGoalMongoContext(_dbName)) { ctx.PatientInterventions.Collection.Insert(pi); AuditHelper.LogDataAudit(this.UserId, MongoCollectionName.PatientIntervention.ToString(), pi.Id.ToString(), Common.DataAuditType.Insert, ptr.ContractNumber); } return(pi.Id.ToString()); } catch (Exception) { throw; } }
public PutInitializeInterventionResponse InsertNewPatientIntervention(PutInitializeInterventionRequest request) { try { PutInitializeInterventionResponse result = new PutInitializeInterventionResponse(); IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientIntervention); result.Id = (string)repo.Initialize(request); return(result); } catch (Exception ex) { throw ex; } }
public PutInitializeInterventionResponse Put(PutInitializeInterventionRequest request) { PutInitializeInterventionResponse response = new PutInitializeInterventionResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientGoalDD:Put()::Unauthorized Access"); } response = Manager.InsertNewPatientIntervention(request); response.Version = request.Version; } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0"; Common.Helper.LogException(int.Parse(aseProcessID), ex); } return(response); }