コード例 #1
0
ファイル: AggregatorWorker.cs プロジェクト: lulzzz/ProtoEHR
        public async Task AddRecord(RecordItem recordItem)
        {
            RequestContext.Set("Level", SecurityLevel.Private);
            var patientInformation = await recordItem.Patient.GetPatientInformation();

            this.items.Add(new DataItem(patientInformation, recordItem));
        }
コード例 #2
0
ファイル: PatientGrain.cs プロジェクト: lulzzz/ProtoEHR
        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);
        }
コード例 #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);
        }
コード例 #4
0
 public DataItem(PatientInformation patientInformation, RecordItem recordItem)
 {
     pInfo = patientInformation;
     rItem = recordItem;
 }