Esempio n. 1
0
        public async Task AddRecord(RecordItem recordItem)
        {
            RequestContext.Set("Level", SecurityLevel.Private);
            var patientInformation = await recordItem.Patient.GetPatientInformation();

            this.items.Add(new DataItem(patientInformation, recordItem));
        }
Esempio n. 2
0
        public async Task <Guid?> NewRecord(RecordItem recordItem)
        {
            if (this.state.State.Info == null)
            {
                return(null);
            }

            var thisPatient = this.AsReference <IPatientGrain>();

            var created  = false;
            var recordId = default(Guid);

            while (!created)
            {
                recordId = Guid.NewGuid();

                created = await this.GrainFactory.GetGrain <IRecordGrain>(recordId)
                          .RegisterRecord(recordItem);

                state.State.records.Add(recordId);
                logger.LogInformation($"\n Record was created {recordId}");
            }
            await state.WriteStateAsync();

            return(recordId);
        }
Esempio n. 3
0
        public async Task <bool> RegisterRecord(RecordItem recordItem)
        {
            if (state.State.item != null)
            {
                return(false);
            }

            // if (recordItem.SecurityLabel < await recordItem.Reporter.GetSecurityLevelAsync()) throw new AccessDeniedException($"No write down!");

            logger.LogInformation($"{recordItem}");

            state.State.item = recordItem;

            await recordItem.Patient.RegisterRecord(GrainKey);

            await GrainFactory.GetGrain <IAggregatorWorker>(0).AddRecord(recordItem);

            await state.WriteStateAsync();

            return(true);
        }
Esempio n. 4
0
 public DataItem(PatientInformation patientInformation, RecordItem recordItem)
 {
     pInfo = patientInformation;
     rItem = recordItem;
 }