Beispiel #1
0
        internal void GenerateTestTransactions()
        {
            var physicianKeys    = EncryptionHandler.GenerateNewKeys();
            var tempTransactions = new TransactionGenerator(physicianKeys.PrivateKey);

            var physicianRegistration = tempTransactions.InitializeAsNewPhysician(physicianKeys.PublicKey, "Austria", "Vienna", "Der Herbert");
            var physicianVoting       = transactionGenerator.GenerateVotingTransaction(physicianRegistration.TransactionId, true);

            var patientRegistration = tempTransactions.GeneratePatientRegistrationTransaction("Austria", "Vienna", "1992");
            var treatment           = tempTransactions.GenerateTreatmentTransaction(physicianRegistration.TransactionId, patientRegistration.TransactionId);
            var symptom             = tempTransactions.GenerateSymptomTransaction(treatment.TransactionId, new List <string>()
            {
                "R05", "R50.80"
            });
            var diagnoses = tempTransactions.GenerateDiagnosesTransaction(treatment.TransactionId, new List <string>()
            {
                "B34.2"
            });

            node.OnReceiveTransaction(physicianRegistration);
            node.OnReceiveTransaction(physicianVoting);
            Thread.Sleep(4000);
            node.OnReceiveTransaction(patientRegistration);
            node.OnReceiveTransaction(treatment);
            Thread.Sleep(1000);
            node.OnReceiveTransaction(symptom);
            node.OnReceiveTransaction(diagnoses);
        }
Beispiel #2
0
        internal void AddDiagnosesForTreatment(Guid treatmentAddress, string diagnoses)
        {
            if (patients.Where(x => x.Treatments.Where(t => t.TreatmentAddress == treatmentAddress).Any()).Any())
            {
                var diagnosesTransaction = transactionGenerator.GenerateDiagnosesTransaction(treatmentAddress, new List <string>()
                {
                    diagnoses
                });

                if (node.SendTransaction(diagnosesTransaction))
                {
                    var treatment = from p in patients
                                    where p.Treatments.Where(t => t.TreatmentAddress == treatmentAddress).Any()
                                    select p.Treatments.Where(t => t.TreatmentAddress == treatmentAddress).First();

                    treatment.First().Diagnoses.Add(diagnoses);
                }
            }
        }