Exemplo n.º 1
0
        public bool RealizePrescription(string prescriptionId, string pharmacistId)
        {
            if (realizedPrescriptions.blockChainClient.GetNumberOfConnectedPeers() >= 2)
            {
                if (realizedPrescriptions.Find(prescriptionId) == null)
                {
                    Block block = prescriptions.Find(prescriptionId);

                    if (block != null)
                    {
                        block.GetPrescription().pharmacistId = pharmacistId;

                        realizedPrescriptions.Add(block.GetPrescription());

                        return(true);
                    }
                    else
                    {
                        // TODO Logger
                        // Prescription not found.
                        return(false);
                    }
                }
                else
                {
                    // TODO Logger
                    // Prescription is already realized.
                    return(false);
                }
            }

            TraceingManager.Message(LogMessages.LessThen2pearsMessage);
            return(false);
        }