Ejemplo n.º 1
0
        public void InitializePatientGoal()
        {
            PutInitializeGoalDataRequest request = new PutInitializeGoalDataRequest {
                PatientId = "531f2dcd072ef727c4d29fb0"
            };

            PutInitializeGoalDataResponse response = m.InitializeGoal(request);

            Assert.IsNotNull(response.Goal);
        }
Ejemplo n.º 2
0
        public PutInitializeGoalDataResponse InitializeGoal(PutInitializeGoalDataRequest request)
        {
            PutInitializeGoalDataResponse response = null;

            try
            {
                response = new PutInitializeGoalDataResponse();
                IGoalRepository repo = Factory.GetRepository(request, RepositoryType.PatientGoal);

                response.Goal    = (PatientGoalData)repo.Initialize(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(response);
        }
Ejemplo n.º 3
0
        public PutInitializeGoalDataResponse Put(PutInitializeGoalDataRequest request)
        {
            PutInitializeGoalDataResponse response = new PutInitializeGoalDataResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("PatientGoalDD:Put()::Unauthorized Access");
                }

                response         = Manager.InitializeGoal(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);
        }
Ejemplo n.º 4
0
        public object Initialize(object newEntity)
        {
            PutInitializeGoalDataRequest request = (PutInitializeGoalDataRequest)newEntity;
            PatientGoalData patientGoalData      = null;
            MEPatientGoal   mePg = null;

            try
            {
                mePg = new MEPatientGoal(this.UserId)
                {
                    Id        = ObjectId.GenerateNewId(),
                    PatientId = ObjectId.Parse(request.PatientId),
                    TTLDate   = System.DateTime.UtcNow.AddDays(_initializeDays)
                                //,
                                //LastUpdatedOn = DateTime.UtcNow,
                                //UpdatedBy = ObjectId.Parse(this.UserId)
                };

                using (PatientGoalMongoContext ctx = new PatientGoalMongoContext(_dbName))
                {
                    ctx.PatientGoals.Collection.Insert(mePg);

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.PatientGoal.ToString(),
                                             mePg.Id.ToString(),
                                             Common.DataAuditType.Insert,
                                             request.ContractNumber);

                    patientGoalData = new PatientGoalData
                    {
                        Id = mePg.Id.ToString()
                    };
                }
                return(patientGoalData);
            }
            catch (Exception) { throw; }
        }