Exemplo n.º 1
0
 public UIData(ReportExt fileFormat, DateTime begin, DateTime end, int personID, ReportType reportType)
 {
     this.fileFormat = fileFormat;
     this.begin      = begin;
     this.end        = end;
     this.personID   = personID;
     this.reportType = reportType;
 }
Exemplo n.º 2
0
        public static void Generate(ReportType reportType, ReportExt reportExt, DateTime begin, DateTime end, int personID, ref BlockChainHandler blockChainHandler)
        {
            WrongDataHandler dataHandler = new WrongDataHandler();

            uIData         = new UIData(reportExt, begin, end, personID, reportType);
            blockchainData = new BlockchainData(ref blockChainHandler);
            switch (uIData.ReportType)
            {
            case ReportType.PrescriptionsReport:
                if (dataHandler.WrongDataNotification(blockchainData.GetPrescriptionListForPatient(uIData.PersonID)))
                {
                    throw new WrongDataHandler("Patient does not have any prescriptions");
                }
                break;

            case ReportType.SoldMedicamentsReport:
                if (dataHandler.WrongDataNotification(blockchainData.GetPrescriptionListForPharmacist(uIData.PersonID)))
                {
                    throw new WrongDataHandler("Pharmacist does not have any sold medicaments");
                }
                break;

            default:
                throw new NotImplementedException();
            }
            switch (uIData.FileFormat)
            {
            case ReportExt.PDF:
                GenerateFile generatePDF = new GeneratePDF(uIData.ReportType, blockchainData, uIData.PersonID, uIData.Begin, uIData.End);
                break;

            case ReportExt.CSV:
                GenerateFile generateCSV = new GenerateCSV(uIData.ReportType, blockchainData, uIData.PersonID, uIData.Begin, uIData.End);
                break;

            default:
                throw new NotImplementedException();
            }
        }