Пример #1
0
        public GenerateCSV(ReportType reportType, BlockchainData blockchainData, int personID, DateTime begin, DateTime end)
        {
            this.reportType     = reportType;
            this.blockchainData = blockchainData;
            this.personID       = personID;
            this.begin          = begin;
            this.end            = end;
            switch (reportType)
            {
            case ReportType.PrescriptionsReport:
                GeneratePrescriptionReport();
                break;

            case ReportType.SoldMedicamentsReport:
                GenerateSoldMedicamentsReport();
                break;

            default:
                throw new NotImplementedException();
            }
        }
Пример #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();
            }
        }