Exemplo n.º 1
0
        public void MultilineErrorMessage()
        {
            if (Directory.Exists("TestLogs"))
            {
                Directory.Delete("TestLogs", true);
            }

            string[] args = new string[]
            {
                @"-i=..\..\AccipioTests\Samples\GallioTestResults1.xml",
                "-o=TestLogs"
            };
            ReportConverter reportConverter = new ReportConverter();

            Assert.AreEqual(0, reportConverter.Execute(args));

            string[] files = Directory.GetFiles("TestLogs");
            Assert.IsTrue(files.Length > 0);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(files[0]);
            XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable);

            xmlNamespaceManager.AddNamespace("a", "http://projectpilot/AccipioTestRunReport.xsd");

            XmlNode node = xmlDoc.SelectSingleNode(
                "/a:report/a:testRun/a:suites/a:suite/a:case[@id='RemoveAllMmsSubsFromSpGui']/a:message",
                xmlNamespaceManager);

            Assert.IsNotNull(node);
            Assert.IsFalse(string.IsNullOrEmpty(node.InnerText));
        }
Exemplo n.º 2
0
        public void Build_TextValue_CorrectCells()
        {
            IReportTable <ReportCell> table = new ReportTable <ReportCell>()
            {
                HeaderRows = new List <IEnumerable <ReportCell> >()
                {
                    new ReportCell[] { new ReportCell <string>("Value"), },
                },
                Rows = new List <IEnumerable <ReportCell> >()
                {
                    new ReportCell[] { new ReportCell <string>("Test"), },
                },
            };

            ReportConverter <HtmlReportCell> converter       = new ReportConverter <HtmlReportCell>(Enumerable.Empty <IPropertyHandler <HtmlReportCell> >());
            IReportTable <HtmlReportCell>    htmlReportTable = converter.Convert(table);

            HtmlReportCell[][] headerCells = this.GetHeaderCellsAsArray(htmlReportTable);
            headerCells.Should().HaveCount(1);
            headerCells[0][0].GetValue <string>().Should().Be("Value");
            headerCells[0][0].ColumnSpan.Should().Be(1);
            headerCells[0][0].RowSpan.Should().Be(1);

            HtmlReportCell[][] cells = this.GetBodyCellsAsArray(htmlReportTable);
            cells.Should().HaveCount(1);
            cells[0][0].GetValue <string>().Should().Be("Test");
            cells[0][0].ColumnSpan.Should().Be(1);
            cells[0][0].RowSpan.Should().Be(1);
        }
        public void GetExcel(DrugBrandViewModel model)
        {
            List <DrugBrand> drugBrands = DrugBrandManager.Getdrugs();

            model.DrugBrands = drugBrands;

            const string fileName    = "DrugBrands";
            var          boundFields = new List <BoundField>
            {
                new BoundField()
                {
                    HeaderText = @"Brand Name", DataField = "Name"
                },
                new BoundField()
                {
                    HeaderText = @"Description", DataField = "Preparation"
                },
                new BoundField()
                {
                    HeaderText = @"Generic Name", DataField = "DrugGeneric.Name"
                }
            };

            ReportConverter.CustomGridView(boundFields, model.DrugBrands, fileName);
        }
Exemplo n.º 4
0
        private IReportTable <ExcelReportCell> ConvertToExcel(IReportTable <ReportCell> reportTable)
        {
            ReportConverter <ExcelReportCell> excelConverter = new ReportConverter <ExcelReportCell>(new IPropertyHandler <ExcelReportCell>[]
            {
            });

            return(excelConverter.Convert(reportTable));
        }
Exemplo n.º 5
0
        private IReportTable <HtmlReportCell> ConvertToHtml(IReportTable <ReportCell> reportTable)
        {
            ReportConverter <HtmlReportCell> htmlConverter = new ReportConverter <HtmlReportCell>(new[]
            {
                new HeatmapPropertyHtmlHandler(),
            });

            return(htmlConverter.Convert(reportTable));
        }
Exemplo n.º 6
0
        private IReportTable <ExcelReportCell> ConvertToExcel(IReportTable <ReportCell> reportTable)
        {
            ReportConverter <ExcelReportCell> excelConverter = new ReportConverter <ExcelReportCell>(new[]
            {
                new HeatmapPropertyExcelHandler(),
            });

            return(excelConverter.Convert(reportTable));
        }
Exemplo n.º 7
0
        public string SaveReport(string name, GrapeCity.ActiveReports.PageReportModel.Report report, bool isTemporary = false)
        {
            var service = _serviceProvider.ResolveRequired <IReportRepository>();
            var data    = ReportConverter.ToXml(report);

            return(service.Create(name, report.IsFixedPageReport ? "FPL" : "CPL", data, new ReportRepositoryOptions()
            {
                IsTemporary = isTemporary
            }));
        }
Exemplo n.º 8
0
        private IReportTable <ExcelReportCell> ConvertToExcel(IReportTable <ReportCell> reportTable)
        {
            ReportConverter <ExcelReportCell> excelConverter = new ReportConverter <ExcelReportCell>(new IPropertyHandler <ExcelReportCell>[]
            {
                new AlignmentPropertyExcelHandler(),
                new ColorPropertyExcelHandler(),
            });

            return(excelConverter.Convert(reportTable));
        }
Exemplo n.º 9
0
        private IReportTable <HtmlReportCell> ConvertToHtml(IReportTable <ReportCell> reportTable)
        {
            ReportConverter <HtmlReportCell> htmlConverter = new ReportConverter <HtmlReportCell>(new IPropertyHandler <HtmlReportCell>[]
            {
                new AlignmentPropertyHtmlHandler(),
                new ColorPropertyHtmlHandler(),
            });

            return(htmlConverter.Convert(reportTable));
        }
Exemplo n.º 10
0
        /// <summary>
        /// This method will set the starting time for the report
        /// Possible exceptions that can be thrown from this method are
        ///
        /// ConverterException
        /// </summary>
        public void StartReporting(ReportConverter converter)
        {
            Logger.EnteredMethod(LogSource.Common);

            try
            {
                m_writer = new StreamWriter(m_fileName);
            }
            catch (Exception e) // catch all
            {
                Logger.WriteException(LogSource.Common, e);
                throw new ConverterException(e.Message, e);
            }

            // Start the time in the summary node here
            m_startDateTime        = DateTime.Now;
            summaryField.StartTime = m_startDateTime.ToString(CultureInfo.CurrentCulture);

            Type  = ReportType.PreMigration;
            Title = CommonResource.AnalysisReportTitle;

            // Setting converter specific properties here
            switch (converter)
            {
            case ReportConverter.VSSConverter:
                Converter    = ReportConverter.VSSConverter;
                SourceSystem = ReportSourceSystem.VSS;
                TargetSystem = ReportTargetSystem.VersionControl;
                break;

            case ReportConverter.SDConverter:
                Converter    = ReportConverter.SDConverter;
                SourceSystem = ReportSourceSystem.SD;
                TargetSystem = ReportTargetSystem.VersionControl;
                break;

            case ReportConverter.PSConverter:
                Converter    = ReportConverter.PSConverter;
                SourceSystem = ReportSourceSystem.PS;
                TargetSystem = ReportTargetSystem.WorkItemTracking;
                break;

            case ReportConverter.CQConverter:
                Converter    = ReportConverter.CQConverter;
                SourceSystem = ReportSourceSystem.ClearQuest;
                TargetSystem = ReportTargetSystem.WorkItemTracking;
                break;

            default:
                Debug.Fail("Invalid ReportConverter type");
                break;
            }

            Logger.ExitingMethod(LogSource.Common);
        }
        public TemplateThumbnail GetTemplateThumbnail(string id)
        {
            var template = _db.GetTemplate(id);

            if (template is null)
            {
                throw new FileNotFoundException();
            }

            return(ExtractThumbnail(ReportConverter.ToXml(template)));
        }
        private ActionResult ChooseOldReport(CathedraReport oldReport, List <Publication> allPublications)
        {
            var viewModel = ReportConverter.ConvertToViewModel(oldReport);

            viewModel.PrintedPublicationBudgetTheme = allPublications
                                                      .Select(x =>
            {
                var option = new PublicationOption()
                {
                    Checked = false,
                    Id      = x.ID,
                    Name    = x.Name
                };
                if (viewModel.PrintedPublicationBudgetTheme.Any(y => y.Id == x.ID))
                {
                    option.Checked = true;
                }
                return(option);
            })
                                                      .ToList();
            viewModel.PrintedPublicationHospDohovirTheme = allPublications
                                                           .Select(x =>
            {
                var option = new PublicationOption()
                {
                    Checked = false,
                    Id      = x.ID,
                    Name    = x.Name
                };
                if (viewModel.PrintedPublicationHospDohovirTheme.Any(y => y.Id == x.ID))
                {
                    option.Checked = true;
                }
                return(option);
            })
                                                           .ToList();
            viewModel.PrintedPublicationThemeInWorkTime = allPublications
                                                          .Select(x =>
            {
                var option = new PublicationOption()
                {
                    Checked = false,
                    Id      = x.ID,
                    Name    = x.Name
                };
                if (viewModel.PrintedPublicationThemeInWorkTime.Any(y => y.Id == x.ID))
                {
                    option.Checked = true;
                }
                return(option);
            })
                                                          .ToList();
            return(View(viewModel));
        }
        private ActionResult ChooseOldReport(Report oldReport, List <Publication> allPublications)
        {
            var viewModel = ReportConverter.ConvertToViewModel(oldReport);

            viewModel.RecomendedPublication = allPublications
                                              .Select(x =>
            {
                var option = new PublicationOption()
                {
                    Checked = false,
                    Id      = x.ID,
                    Name    = x.Name
                };
                if (viewModel.RecomendedPublication.Any(y => y.Id == x.ID))
                {
                    option.Checked = true;
                }
                return(option);
            })
                                              .ToList();
            viewModel.PrintedPublication = allPublications
                                           .Select(x =>
            {
                var option = new PublicationOption()
                {
                    Checked = false,
                    Id      = x.ID,
                    Name    = x.Name
                };
                if (viewModel.PrintedPublication.Any(y => y.Id == x.ID))
                {
                    option.Checked = true;
                }
                return(option);
            })
                                           .ToList();
            viewModel.AcceptedToPrintPublication = allPublications
                                                   .Select(x =>
            {
                var option = new PublicationOption()
                {
                    Checked = false,
                    Id      = x.ID,
                    Name    = x.Name
                };
                if (viewModel.AcceptedToPrintPublication.Any(y => y.Id == x.ID))
                {
                    option.Checked = true;
                }
                return(option);
            })
                                                   .ToList();
            return(View(viewModel));
        }
        private void CreateOrUpdateReport(ReportViewModel reportViewModel, int stepIndex)
        {
            var allPublications = db.Publication.ToList();

            if (reportViewModel.ID == null && !db.Reports.Any(x => x.ID == reportViewModel.ID))
            {
                var reportToCreate = ReportConverter.ConvertToEntity(reportViewModel);
                reportToCreate.User = db.Users.Find(User.Identity.GetUserId());
                reportToCreate.ThemeOfScientificWork      = db.ThemeOfScientificWork.Where(x => x.ID == reportViewModel.ThemeOfScientificWorkId).FirstOrDefault();
                reportToCreate.PrintedPublication         = allPublications.Where(x => reportViewModel.PrintedPublication.Any(y => y.Id == x.ID && y.Checked)).ToList();
                reportToCreate.RecomendedPublication      = allPublications.Where(x => reportViewModel.RecomendedPublication.Any(y => y.Id == x.ID && y.Checked)).ToList();
                reportToCreate.AcceptedToPrintPublication = allPublications.Where(x => reportViewModel.AcceptedToPrintPublication.Any(y => y.Id == x.ID && y.Checked)).ToList();
                db.Reports.Add(reportToCreate);
                db.SaveChanges();
            }
            else
            {
                var report = db.Reports.Find(reportViewModel.ID);
                switch (stepIndex)
                {
                case 0:
                    report.PrintedPublication         = allPublications.Where(x => reportViewModel.PrintedPublication.Any(y => y.Id == x.ID && y.Checked)).ToList();
                    report.RecomendedPublication      = allPublications.Where(x => reportViewModel.RecomendedPublication.Any(y => y.Id == x.ID && y.Checked)).ToList();
                    report.AcceptedToPrintPublication = allPublications.Where(x => reportViewModel.AcceptedToPrintPublication.Any(y => y.Id == x.ID && y.Checked)).ToList();
                    break;

                case 1:
                    report.ThemeOfScientificWork            = db.ThemeOfScientificWork.Where(x => x.ID == reportViewModel.ThemeOfScientificWorkId).FirstOrDefault();
                    report.ThemeOfScientificWorkDescription = reportViewModel.ThemeOfScientificWorkDescription;
                    break;

                case 2:
                    report.MembershipInCouncils = reportViewModel.MembershipInCouncils;
                    report.Other = reportViewModel.Other;
                    report.ParticipationInGrands         = reportViewModel.ParticipationInGrands;
                    report.PatentForInevention           = reportViewModel.PatentForInevention;
                    report.ApplicationForInevention      = reportViewModel.ApplicationForInevention;
                    report.ReviewForTheses               = reportViewModel.ReviewForTheses;
                    report.ScientificControlDoctorsWork  = reportViewModel.ScientificControlDoctorsWork;
                    report.ScientificControlStudentsWork = reportViewModel.ScientificControlStudentsWork;
                    report.ScientificTrainings           = reportViewModel.ScientificTrainings;
                    break;

                case 3:
                    report.Date     = reportViewModel.Date;
                    report.Protocol = reportViewModel.Protocol;
                    break;

                default:
                    return;
                }
                db.SaveChanges();
            }
        }
Exemplo n.º 15
0
        public Report GetTemplate(string templateId)
        {
            var template = _lite.GetCollection <Template>(TEMPLATES)
                           .FindById(templateId);

            if (template is null)
            {
                return(null);
            }

            return(ReportConverter.FromXML(template.Content));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Extract report type from report.
        /// </summary>
        /// <param name="report">Report</param>
        /// <returns>Report type string (FPL/CPL).</returns>
        public static string GetReportType(Report report)
        {
            var reportXml = ReportConverter.ToXml(report);

            using var stream = new MemoryStream(reportXml);
            var root = XElement.Load(stream);

            var path          = "Body/ReportItems/FixedPage";
            var xPath         = string.Join("/", path.Split('/').Select(e => $"*[local-name() = '{e}']"));
            var fixedPageNode = root.XPathSelectElement(xPath);

            return(fixedPageNode != null ? "FPL" : "CPL");
        }
Exemplo n.º 17
0
        public void SaveReport(string reportId, Report report, bool isTemporary = false)
        {
            var reportXml  = ReportConverter.ToXml(report);
            var collection = isTemporary ? Util.TEMP_SUFFIX : REPORTS;

            _lite
            .GetCollection <ReportInfo>(collection)
            .Upsert(new ReportInfo
            {
                Id      = reportId,
                Name    = reportId,
                Content = reportXml,
                Type    = Util.GetReportType(report),
            });
        }
Exemplo n.º 18
0
        public Report GetReport(string reportId)
        {
            var(collection, reportName) = Util.GetCollectionAndName(reportId, REPORTS);
            var reportItem = _lite.GetCollection <ReportInfo>(collection)
                             .FindById(reportName);

            if (reportItem is null)
            {
                return(null);
            }

            var report = ReportConverter.FromXML(reportItem.Content);

            // Define our own resource locator for correct work with report resources (images, themes and so on)
            report.Site = new ReportSite(new CustomStoreResourceLocator(this));
            return(report);
        }
Exemplo n.º 19
0
        public string UpdateReport(string id, GrapeCity.ActiveReports.PageReportModel.Report report)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            if (id.Length > 5 && id.EndsWith(".rdlx", StringComparison.OrdinalIgnoreCase))
            {
                id = id.Substring(0, id.Length - 5);
            }

            var service = _serviceProvider.ResolveRequired <IReportRepository>();
            var data    = ReportConverter.ToXml(report);

            return(service.Update(id, report.IsFixedPageReport ? "FPL" : "CPL", data));
        }
        public byte[] GetTemplate(string id)
        {
            var report = _db.GetTemplate(id);

            if (report is null)
            {
                throw new FileNotFoundException();
            }

            // Cut out thumbnail from embedded images, if it exist
            var thumbnail = report.EmbeddedImages.FirstOrDefault(image => image.Name == THUMBNAIL_NAME);

            if (thumbnail != null)
            {
                report.EmbeddedImages.Remove(thumbnail);
            }

            return(ReportConverter.ToJson(report));
        }
Exemplo n.º 21
0
        public void TransformGallioTestResults()
        {
            string[] args = new string[]
            {
                "-i=..\\..\\..\\Data\\Samples\\AcceptanceTestResults.xml",
                "-o=TestLogs"
            };
            ReportConverter reportConverter = new ReportConverter();

            Assert.AreEqual(0, reportConverter.Execute(args));

            HtmlTestReportGeneratorCommand cmd = new HtmlTestReportGeneratorCommand();

            args = new string[]
            {
                "-i=TestLogs"
            };
            Assert.AreEqual(0, cmd.Execute(args));
        }
Exemplo n.º 22
0
        public void TransformNUnitTestResults()
        {
            string[] args = new string[]
            {
                "-i=..\\..\\..\\Data\\Samples\\Hsl.SsmTest.SystemTest.dll-results.xml",
                "-o=TestLogs",
                "-x=TestReportTransform.NUnit.xslt",
                "-t=NUnit"
            };
            ReportConverter reportConverter = new ReportConverter();

            Assert.AreEqual(0, reportConverter.Execute(args));

            HtmlTestReportGeneratorCommand cmd = new HtmlTestReportGeneratorCommand();

            args = new string[]
            {
                "-i=TestLogs"
            };
            Assert.AreEqual(0, cmd.Execute(args));
        }
Exemplo n.º 23
0
        public void Attachment()
        {
            if (Directory.Exists("TestLogs"))
            {
                Directory.Delete("TestLogs", true);
            }

            string[] args = new string[]
            {
                @"-i=..\..\AccipioTests\Samples\LastTestResults.xml",
                "-o=TestLogs"
            };
            ReportConverter reportConverter = new ReportConverter();

            Assert.AreEqual(0, reportConverter.Execute(args));

            string[] files = Directory.GetFiles("TestLogs");
            Assert.IsTrue(files.Length > 0);

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(files[0]);
            XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable);

            xmlNamespaceManager.AddNamespace("a", "http://projectpilot/AccipioTestRunReport.xsd");

            XmlNode node = xmlDoc.SelectSingleNode(
                "/a:report/a:testRun/a:suites/a:suite/a:case[@id='Failed']/a:attachments/a:attachment",
                xmlNamespaceManager);

            Assert.IsNotNull(node);
            Assert.AreEqual("Failed test", node.Attributes["name"].Value, "Name attribute");

            node = xmlDoc.SelectSingleNode(
                "/a:report/a:testRun/a:suites/a:suite/a:case[@id='Failed1']/a:attachments/a:attachment",
                xmlNamespaceManager);

            Assert.IsNotNull(node);
            Assert.AreEqual(@"LastTestResults\b689dd6e6cc01622\Failed1 test.png", node.Attributes["contentPath"].Value, "cantentPath attribute");
        }
        // Gets template content with thumbnail cut out if it exists
        public byte[] GetTemplate(string id)
        {
            var fullPath = Path.Combine(_rootFolder.FullName, id);

            if (!File.Exists(fullPath))
            {
                throw new FileNotFoundException();
            }

            var templateXml = File.ReadAllBytes(fullPath);
            var template    = ReportConverter.FromXML(templateXml);

            var thumbnail = template.EmbeddedImages.FirstOrDefault(i => i.Name == templateThumbnailName);

            if (thumbnail != null)
            {
                template.EmbeddedImages.Remove(thumbnail);
            }

            var templateJson = ReportConverter.ToJson(template);

            return(templateJson);
        }
Exemplo n.º 25
0
        public void Build_SeveralHandlers_BothApplied()
        {
            ReportTable <ReportCell> table = new ReportTable <ReportCell>()
            {
                HeaderRows = new List <IEnumerable <ReportCell> >()
                {
                    new ReportCell[] { new ReportCell <string>("Value"), },
                },
                Rows = new List <IEnumerable <ReportCell> >()
                {
                    new ReportCell[]
                    {
                        this.CreateReportCell("Test", new BoldProperty()),
                    },
                },
            };

            ReportConverter <HtmlReportCell> converter       = new ReportConverter <HtmlReportCell>(GetCustomPropertyHandlers());
            IReportTable <HtmlReportCell>    htmlReportTable = converter.Convert(table);

            HtmlReportCell[][] cells = this.GetBodyCellsAsArray(htmlReportTable);
            cells.Should().HaveCount(1);
            cells[0][0].GetValue <string>().Should().Be("bold: TEST");
        }
Exemplo n.º 26
0
        // public PatientDTO a;
        // public DoctorDTO b;
        // public SecretaryDTO c;

        public App()
        {
            // HCI

            medicalRoles = new List <string> {
                "Svi", "Opšte Prakse", "Hirurg", "Dermatolog", "Očni lekar", "Stomatolog"
            };
            roomTypes = new List <string> {
                "Bolnička Soba", "Operaciona Sala", "Soba za preglede"
            };
            medicalAppointmentTypes = new List <string> {
                "Pregled", "Operacija", "Ležanje"
            };
            AddressDTO address = new AddressDTO("1", "Bulevar despota Stefan 7A", "Novi Sad", "Srbija", "21000");

            director     = new DirectorDTO(address, "Dusan", "Urosevic", "1231231231231", "021021", "Male", new DateTime(1990, 5, 5), 123, new TimeInterval(new DateTime(2020, 12, 12), new DateTime(2020, 12, 12)), new TimeInterval(new DateTime(2020, 12, 12), new DateTime(2020, 12, 12)), "[email protected]", "pass", "Klinicki Centar Vojvodina");
            SelectedDate = DateTime.Now;


            // Converters
            var addressConverter           = new AddressConverter();
            var patientConverter           = new PatientConverter(addressConverter);
            var medicineConverter          = new MedicineConverter();
            var questionConverter          = new QuestionConverter(patientConverter);
            var prescriptionConverter      = new PrescriptionConverter(patientConverter, medicineConverter);
            var medicalConsumableConverter = new MedicalConsumableConverter();
            var roomConverter                = new RoomConverter();
            var equipmentConverter           = new EquipmentConverter(roomConverter);
            var guestConverter               = new GuestConverter(addressConverter);
            var hospitalConverter            = new HospitalConverter();
            var doctorConverter              = new DoctorConverter(addressConverter);
            var medicalAppointmentConverter  = new MedicalAppointmentConverter(roomConverter, guestConverter, doctorConverter);
            var renovationConverter          = new RenovationConverter(roomConverter);
            var feedbackConverter            = new FeedbackConverter();
            var reviewConverter              = new ReviewConverter(doctorConverter);
            var anamnesisConvertor           = new AnamnesisConvertor();
            var secretaryConverter           = new SecretaryConverter(questionConverter, addressConverter);
            var inventoryManagementConverter = new InventoryManagementConverter(equipmentConverter, roomConverter);
            var orderConverter               = new OrderConverter(medicalConsumableConverter, medicineConverter, equipmentConverter);
            var reportConverter              = new ReportConverter();
            var approvalConverter            = new ApprovalConverter(doctorConverter);
            var propositionConverter         = new PropositionConverter(medicineConverter, approvalConverter, doctorConverter);


            var referralConverter = new ReferralConverter(medicalAppointmentConverter);


            // Repositories
            // Many to Many
            var medicalAppointmentToDoctorRepository = new MedicalAppointmentToDoctorRepository(
                new CSVStream <MedicalAppointmentToDoctor>(
                    MEDICAL_APPOINTMENT_TO_DOCTOR_FILEPATH,
                    new MedicalAppointmentToDoctorCSVConverter(DELIMITER)),
                new LongSequencer()
                );
            var inventoryManagementToEquipmentRepository = new InventoryManagementToEquipmentRepository(
                new CSVStream <InventoryManagementToEquipment>(
                    INVENTORY_EQUIPMENT_FILEPATH,
                    new InventoryManagementToEquipmentCSVConverter(DELIMITER)),
                new LongSequencer()
                );

            var addressRepository = new AddressRepository(new CSVStream <Address>(ADDRESS_FILEPATH, new AddressCSVConverter(DELIMITER)), new LongSequencer());
            var patientRepository = new PatientRepository(
                new CSVStream <Patient>(PATIENT_FILEPATH, new PatientCSVConverter(DELIMITER, DATETIME_FORMAT)),
                new CSVStream <Patient>(PATIENT_FILEPATH, new PatientCSVConverter(DELIMITER, DATETIME_FORMAT)),
                new CSVStream <Doctor>(DOCTOR_FILEPATH, new DoctorCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                new CSVStream <Secretary>(SECRETARY_FILEPATH, new SecretaryCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                addressRepository, new LongSequencer());
            var doctorRepository = new DoctorRepository(
                new CSVStream <Doctor>(DOCTOR_FILEPATH, new DoctorCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                new CSVStream <Patient>(PATIENT_FILEPATH, new PatientCSVConverter(DELIMITER, DATETIME_FORMAT)),
                new CSVStream <Doctor>(DOCTOR_FILEPATH, new DoctorCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                new CSVStream <Secretary>(SECRETARY_FILEPATH, new SecretaryCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                addressRepository,
                new LongSequencer());
            var secretaryRepository = new SecretaryRepository(
                new CSVStream <Secretary>(SECRETARY_FILEPATH, new SecretaryCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                new CSVStream <Patient>(PATIENT_FILEPATH, new PatientCSVConverter(DELIMITER, DATETIME_FORMAT)),
                new CSVStream <Doctor>(DOCTOR_FILEPATH, new DoctorCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                new CSVStream <Secretary>(SECRETARY_FILEPATH, new SecretaryCSVConverter(DELIMITER, DATETIME_FORMAT, TIME_FORMAT)),
                addressRepository,
                new LongSequencer());


            var inventoryManagementRepository = new InventoryManagementRepository(new CSVStream <InventoryManagement>(INVENTORY_FILEPATH, new InventoryManagementCSVConverter(DELIMITER, DATETIME_FORMAT)), inventoryManagementToEquipmentRepository, new LongSequencer());
            var orderDetailsRepository        = new OrderDetailsRepository(new CSVStream <OrderDetails>(ORDER_DETAILS_FILEPATH, new OrderDetailsCSVConverter(DELIMITER)), new LongSequencer());
            var questionRepository            = new QuestionRepository(new CSVStream <Question>(QUESTION_FILEPATH, new QuestionCSVConverter(DELIMITER, DATETIME_FORMAT)), new LongSequencer());


            var medicalConsumableRepository = new MedicalConsumableRepository(
                new CSVStream <MedicalConsumables>(MEDICAL_CONSUMABLE_FILEPATH, new MedicalConsumableCSVConverter(DELIMITER)),
                new CSVStream <Equipment>(EQUIPMENT_FILEPATH, new EquipmentCSVConverter(DELIMITER)),
                new CSVStream <MedicalConsumables>(MEDICAL_CONSUMABLE_FILEPATH, new MedicalConsumableCSVConverter(DELIMITER)),
                new CSVStream <Medicine>(MEDICINE_FILEPATH, new MedicineCSVConverter(DELIMITER)),
                new LongSequencer());

            var equipmentRepository = new EquipmentRepository(
                new CSVStream <Equipment>(EQUIPMENT_FILEPATH, new EquipmentCSVConverter(DELIMITER)),
                new CSVStream <Equipment>(EQUIPMENT_FILEPATH, new EquipmentCSVConverter(DELIMITER)),
                new CSVStream <MedicalConsumables>(MEDICAL_CONSUMABLE_FILEPATH, new MedicalConsumableCSVConverter(DELIMITER)),
                new CSVStream <Medicine>(MEDICINE_FILEPATH, new MedicineCSVConverter(DELIMITER)),
                new LongSequencer());
            var medicineRepository = new MedicineRepository(
                new CSVStream <Medicine>(MEDICINE_FILEPATH, new MedicineCSVConverter(DELIMITER)),
                new CSVStream <Equipment>(EQUIPMENT_FILEPATH, new EquipmentCSVConverter(DELIMITER)),
                new CSVStream <MedicalConsumables>(MEDICAL_CONSUMABLE_FILEPATH, new MedicalConsumableCSVConverter(DELIMITER)),
                new CSVStream <Medicine>(MEDICINE_FILEPATH, new MedicineCSVConverter(DELIMITER)),
                new LongSequencer());

            var prescriptionRepository = new PrescriptionRepository(new CSVStream <Prescription>(PRESCRIPTION_FILEPATH, new PrescriptionCSVConverter(DELIMITER, DATETIME_FORMAT)), medicineRepository, patientRepository, new LongSequencer());


            var medicalAppointmentRepository = new MedicalAppointmentRepository(
                new CSVStream <MedicalAppointment>(MEDICAL_APPOINTMENT_FILEPATH,
                                                   new MedicalAppointmentCSVConverter(DELIMITER, DATETIME_DETAIL_FORMAT)),
                medicalAppointmentToDoctorRepository,
                patientRepository,
                doctorRepository,
                new LongSequencer());
            var roomRepository = new RoomRepository(new CSVStream <Room>(ROOM_FILEPATH, new RoomCSVConverter(DELIMITER)), new LongSequencer(), equipmentRepository);

            var orderRepository = new OrderRepository(new CSVStream <Order>(ORDER_FILEPATH, new OrderCSVConverter(DELIMITER, DATETIME_FORMAT)), medicineRepository, equipmentRepository, medicalConsumableRepository, orderDetailsRepository, new LongSequencer());

            var renovationRepository  = new RenovationRepository(new CSVStream <Renovation>(RENOVATION_FILEPATH, new RenovationCSVConverter(DELIMITER, DATETIME_FORMAT)), new LongSequencer());
            var feedbackRepository    = new FeedbackRepository(new CSVStream <Feedback>(FEEDBACK_FILEPATH, new FeedbackCSVConverter(DELIMITER)), new LongSequencer());
            var reviewRepository      = new ReviewRepository(new CSVStream <Review>(REVIEW_FILEPATH, new ReviewCSVConverter(DELIMITER)), new LongSequencer());
            var anamnesisRepository   = new AnamnesisRepository(new CSVStream <Anamnesis>(ANAMNESIS_FILEPATH, new AnamnesisCSVConverter(DELIMITER)), new LongSequencer());
            var propositionRepository = new PropositionRepository(new CSVStream <Proposition>(PROPOSITION_FILEPATH, new PropositionCSVConverter(DELIMITER, DATETIME_FORMAT)), new LongSequencer(), medicineRepository);

            // Referral
            var admitionReferralRepository = new AdmitionReferralRepository(
                new CSVStream <Referral>(ADMITION_REFERRAL_FILEPATH, new ReferralCSVConventer(DELIMITER, DATETIME_FORMAT)),
                new LongSequencer()
                );
            var operationReferralRepository = new OperationReferralRepository(
                new CSVStream <Referral>(OPERATION_REFERRAL_FILEPATH, new ReferralCSVConventer(DELIMITER, DATETIME_FORMAT)),
                new LongSequencer());

            var examReferralRepository = new ExamReferralRepository(
                new CSVStream <Referral>(EXAM_REFERRAL_FILEPATH, new ReferralCSVConventer(DELIMITER, DATETIME_FORMAT)),
                new LongSequencer());

            var approvalRepository = new ApprovalRepository(new CSVStream <Approval>(APPROVAL_FILEPATH, new ApprovalCSVConverter(DELIMITER)), new LongSequencer());

            // Services

            var patientService            = new PatientService(patientRepository);
            var questionService           = new QuestionService(questionRepository);
            var addressService            = new AddressService(addressRepository);
            var medicineService           = new MedicineService(medicineRepository);
            var medicalConsumableService  = new MedicalConsumableService(medicalConsumableRepository);
            var prescriptionService       = new PrescriptionService(prescriptionRepository, medicineService, patientService);
            var reportService             = new ReportService();
            var guestService              = new GuestService(patientRepository);
            var equipmentService          = new EquipmentService(equipmentRepository);
            var doctorService             = new DoctorService(doctorRepository);
            var medicalAppointmentService = new MedicalAppointmentService(medicalAppointmentRepository, doctorService);
            var roomService                = new RoomService(roomRepository);
            var renovationService          = new RenovationService(renovationRepository, roomRepository);
            var feedbackService            = new FeedbackService(feedbackRepository);
            var reviewService              = new ReviewService(reviewRepository);
            var employeeService            = new EmployeeService(secretaryRepository, doctorRepository);
            var authenticationService      = new AuthenticationService(employeeService, patientService);
            var secretaryService           = new SecretaryService(secretaryRepository);
            var inventoryManagementService = new InventoryManagementService(inventoryManagementRepository);
            var orderService               = new OrderService(orderRepository);
            var anamnesisService           = new AnamnesisService(anamnesisRepository);
            var propositionService         = new PropositionService(propositionRepository);
            var approvalService            = new ApprovalService(approvalRepository);

            // Controllers
            PatientController           = new PatientController(patientService, patientConverter, guestConverter);
            GuestController             = new GuestController(guestService, guestConverter);
            AddressController           = new AddressController(addressService, addressConverter);
            MedicineController          = new MedicineController(medicineService, medicineConverter);
            QuestionController          = new QuestionController(questionService, questionConverter, patientConverter);
            MedicalConsumableController = new MedicalConsumableController(medicalConsumableService, medicalConsumableConverter);
            AuthenticationController    = new AuthenticationController();
            ReportController            = new ReportController(reportConverter);
            PrescriptionController      = new PrescriptionController(prescriptionService, prescriptionConverter);
            EquipmentController         = new EquipmentController(equipmentService, equipmentConverter);

            MedicalAppointmentController = new MedicalAppointmentController(
                medicalAppointmentService,
                medicalAppointmentConverter,
                doctorConverter,
                roomConverter
                );

            RoomController                = new RoomController(roomService, roomConverter);
            RenovationController          = new RenovationController(renovationService, renovationConverter);
            FeedbackController            = new FeedbackController(feedbackService, feedbackConverter);
            ReviewController              = new ReviewController(reviewService, reviewConverter);
            SecretaryController           = new SecretaryController(secretaryService, secretaryConverter);
            InventoryManagementController = new InventoryManagementController(inventoryManagementService, inventoryManagementConverter);
            OrderController               = new OrderController(orderService, orderConverter);
            DoctorController              = new DoctorController(doctorService, doctorConverter);
            AnamnesisController           = new AnamnesisController(anamnesisService, anamnesisConvertor);
            PropositionController         = new PropositionController(propositionService, propositionConverter);

            // Generators
            SecretaryAppointmentReportGenerator = new SecretaryAppointmentReportGenerator(REPORT_APPOINTMENT_FILEPATH);
            PatientAppointmentReportGenerator   = new PatientAppointmentReportGenerator(REPORT_APPOINTMENT_FILEPATH);
            PrescriptionReportGenerator         = new PrescriptionReportGenerator(REPORT_PRESCRIPTION_FILEPATH);
            DoctorsAppointmentReport            = new DirectorReportGenerator(REPORT_DOCTOR_APPOINTMENTS_FILEPATH, doctorRepository, medicalAppointmentRepository);
            MedicineReportGenerator             = new MedicineReportGenerator(REPORT_MEDICINE_FILEPATH, medicineRepository);


            Synchronise(RenovationController);
        }
Exemplo n.º 27
0
        public static int Main(string[] args)
        {
            DateTime st = DateTime.UtcNow;

            Console.WriteLine("Transformation Tool");

            UserSetupManagement        userSetup      = UserSetupManagement.Instance;
            MetadataDocumentManagement metadataDocMgt = MetadataDocumentManagement.Instance;

            if (!GetUserInput(args))
            {
                TransformationLog.CloseXmlFile();
                return(1);
            }

            if (!LoadFiles(metadataDocMgt, userSetup))
            {
                TransformationLog.CloseXmlFile();
                return(1);
            }

            ReportConverter reportConvertor = new ReportConverter(metadataDocMgt.XmlDocument);

            metadataDocMgt.XmlDocument = reportConvertor.ReturnSourceForms();
            TransformationLog.TransformationStarted();

            IgnoreForms.RemoveIgnoredForms();
            IgnoreForms.RemoveFormsWithMatrixControls();
            IgnoreForms.RemoveReplacedForms();

            try
            {
                NestingXmlDocument nestingXml = new NestingXmlDocument();
                nestingXml.SuppressErrors = true;
                nestingXml.StartTransformation();
                if (NestingXmlDocument.ErrorInTransformation)
                {
                    TransformationLog.GenericLogEntry("Transformation tool can't transform this file. Check Transformation log file.", LogCategory.Error);
                }
            }
            catch (Exception e)
            {
                WriteAbortTransformation(e);
                TransformationLog.CloseXmlFile();
                return(1);
            }

            MovePageElements.Start();
            RenumberPages.Start();

            if (!XmlUtility.SaveXmlToFile(reportConvertor.GetDestinationPages(metadataDocMgt.XmlDocument), userSetup.PagesFile))
            {
                TransformationLog.CloseXmlFile();
                return(1);
            }

            Console.WriteLine("The Transformation is completed.");
            TransformationLog.TransformationFinished(System.DateTime.UtcNow.Subtract(st).TotalSeconds);
            TransformationLog.CloseXmlFile();
            return(0);
        }
        private void CreateOrUpdateReport(CathedraReportViewModel reportViewModel, int stepIndex)
        {
            var allPublications = db.Publication.ToList();

            if (reportViewModel.ID == null && !db.Reports.Any(x => x.ID == reportViewModel.ID))
            {
                var reportToCreate = ReportConverter.ConvertToEntity(reportViewModel);
                reportToCreate.User = db.Users.Find(User.Identity.GetUserId());

                reportToCreate.BudgetTheme = db.ThemeOfScientificWork.Where(x => x.ID == reportViewModel.BudgetThemeId).FirstOrDefault();
                if (reportViewModel.PrintedPublicationBudgetTheme != null)
                {
                    reportToCreate.PrintedPublicationBudgetTheme = allPublications
                                                                   .Where(x => reportViewModel.PrintedPublicationBudgetTheme.Any(y => y.Id == x.ID && y.Checked)).ToList();
                }

                db.CathedraReport.Add(reportToCreate);
                db.SaveChanges();
            }
            else
            {
                var report = db.CathedraReport.Find(reportViewModel.ID);
                switch (stepIndex)
                {
                case 0:
                    report.BudgetTheme = db.ThemeOfScientificWork.Where(x => x.ID == reportViewModel.BudgetThemeId).FirstOrDefault();
                    if (reportViewModel.PrintedPublicationBudgetTheme != null)
                    {
                        report.PrintedPublicationBudgetTheme = allPublications
                                                               .Where(x => reportViewModel.PrintedPublicationBudgetTheme.Any(y => y.Id == x.ID && y.Checked)).ToList();
                    }
                    report.AllDescriptionBudgetTheme = reportViewModel.AllDescriptionBudgetTheme;
                    report.CVBudgetTheme             = reportViewModel.CVBudgetTheme;
                    report.ApplicationAndPatentsOnInventionBudgetTheme = reportViewModel.ApplicationAndPatentsOnInventionBudgetTheme;
                    report.OtherBudgetTheme = reportViewModel.OtherBudgetTheme;
                    report.DefensesOfCoworkersBudgetTheme = reportViewModel.DefensesOfCoworkersBudgetTheme;
                    break;

                case 1:
                    report.ThemeInWorkTime = db.ThemeOfScientificWork.Where(x => x.ID == reportViewModel.ThemeInWorkTimeId).FirstOrDefault();
                    if (reportViewModel.PrintedPublicationThemeInWorkTime != null)
                    {
                        report.PrintedPublicationThemeInWorkTime = allPublications
                                                                   .Where(x => reportViewModel.PrintedPublicationThemeInWorkTime.Any(y => y.Id == x.ID && y.Checked)).ToList();
                    }
                    report.AllDescriptionThemeInWorkTime = reportViewModel.AllDescriptionThemeInWorkTime;
                    report.CVThemeInWorkTime             = reportViewModel.CVThemeInWorkTime;
                    report.ApplicationAndPatentsOnInventionThemeInWorkTime = reportViewModel.ApplicationAndPatentsOnInventionThemeInWorkTime;
                    report.OtherThemeInWorkTime = reportViewModel.OtherThemeInWorkTime;
                    report.DefensesOfCoworkersThemeInWorkTime = reportViewModel.DefensesOfCoworkersThemeInWorkTime;
                    break;

                case 2:
                    report.HospDohovirTheme = db.ThemeOfScientificWork.Where(x => x.ID == reportViewModel.HospDohovirThemeId).FirstOrDefault();
                    if (reportViewModel.PrintedPublicationHospDohovirTheme != null)
                    {
                        report.PrintedPublicationHospDohovirTheme = allPublications
                                                                    .Where(x => reportViewModel.PrintedPublicationHospDohovirTheme.Any(y => y.Id == x.ID && y.Checked)).ToList();
                    }
                    report.AllDescriptionHospDohovirTheme = reportViewModel.AllDescriptionHospDohovirTheme;
                    report.CVHospDohovirTheme             = reportViewModel.CVHospDohovirTheme;
                    report.ApplicationAndPatentsOnInventionHospDohovirTheme = reportViewModel.ApplicationAndPatentsOnInventionHospDohovirTheme;
                    report.OtherHospDohovirTheme = reportViewModel.OtherHospDohovirTheme;
                    report.DefensesOfCoworkersHospDohovirTheme = reportViewModel.DefensesOfCoworkersHospDohovirTheme;
                    break;

                case 3:
                    report.AchivementSchool                            = reportViewModel.AchivementSchool;
                    report.OtherFormsOfScientificWork                  = reportViewModel.OtherFormsOfScientificWork;
                    report.CooperationWithAcadamyOfScience             = reportViewModel.CooperationWithAcadamyOfScience;
                    report.CooperationWithForeignScientificInstitution = reportViewModel.CooperationWithForeignScientificInstitution;
                    report.StudentsWorks           = reportViewModel.StudentsWorks;
                    report.ConferencesInUniversity = reportViewModel.ConferencesInUniversity;
                    report.ApplicationOnInvention  = reportViewModel.ApplicationOnInvention;
                    report.Patents   = reportViewModel.Patents;
                    report.Materials = reportViewModel.Materials;
                    report.PropositionForNewForms = reportViewModel.PropositionForNewForms;
                    break;

                case 4:
                    report.Date     = reportViewModel.Date;
                    report.Protocol = reportViewModel.Protocol;
                    break;

                default:
                    return;
                }
                db.SaveChanges();
            }
        }
Exemplo n.º 29
0
        public static void Main(String[] args)
        {
            ConverterNativeMethods.HandlerRoutine handlerRoutine = null;
            try
            {
                Display.InitDisplay(ConverterMain.GetErrorsCount);
                ThreadManager.AddThreadToManagerList(Thread.CurrentThread);

                handlerRoutine = InitializeHandlers();

                Logger.WritePerf(LogSource.Common, "Beginning Converter");

                Debug.Assert(!string.IsNullOrEmpty(CurrentConverterSourceName));
                CommandLineParser.DisplayCopyRightMessage();

                CommandLineParser.AddArgumentDetails(new ArgumentDetails[]
                {
                    new ArgumentDetails("migrationsettings", "m", HandleConfig, true, false),
                    //new ArgumentDetails("schemamap", "s", HandleSchemaMap, false, false),
                    //new ArgumentDetails("command", "c", HandleMode, true, false),
                    new ArgumentDetails("?", "?", DisplayHelp, false, true),
                    new ArgumentDetails("help", "h", DisplayHelp, false, true),
                }
                                                     );

                if (!CommandLineParser.Parse(args) || !ValidateArgumentsDependency())
                {
                    return;
                }

                // Read the configuration schema from the resources
                XmlDocument xmldoc = UtilityMethods.ValidateXmlFile(convParams.ConfigFile, CommonConstants.WorkItemConfigXsdFile);

                bool   exitOnError = false;
                string value       = GetValueForNode(xmldoc, "ExitOnError");
                if (value != null)
                {
                    if (!Boolean.TryParse(value, out exitOnError))
                    {
                        string errMsg = UtilityMethods.Format(CommonResource.InvalidBoolean, value, "ExitOnError", convParams.ConfigFile);
                        throw new ConverterException(errMsg);
                    }
                }

                EditSourceItemOption editSourceItem = EditSourceItemOption.NoChange; // default
                value = GetValueForNode(xmldoc, "EditSourceItem");
                if (value != null)
                {
                    editSourceItem = (EditSourceItemOption)Enum.Parse(typeof(EditSourceItemOption), value);
                }

                string outputDir = GetValueForNode(xmldoc, "OutputDirectory");

                // Get the configuration for PS and make a connection
                XmlNodeList xmlNodes   = xmldoc.GetElementsByTagName("Source");
                XmlNode     sourceNode = xmlNodes[0];

                // Get the configuration for VSTS and make a connection
                XmlNodeList targetNode = xmldoc.GetElementsByTagName("VSTS");

                //LADYBUG RELATED......
                // Get the configuration for VSTS and make a connection
                XmlNodeList ladyBugProcessingNode = xmldoc.GetElementsByTagName("LadyBugProcessing");
                XmlNodeList summaryMailNode       = xmldoc.GetElementsByTagName("SendSummaryEmail");

                // Get the handler class for this [work item] source
                XmlAttribute attr        = sourceNode.Attributes["id"];
                string       productType = (string)SourceIdToTypeMaps[attr.Value];
                Type         handlerType = null;
                if (productType != null)
                {
                    handlerType = Type.GetType(productType);
                }

                // If productType is null, handlerType will also be null.
                if (handlerType == null)
                {
                    Logger.Write(LogSource.Common, TraceLevel.Error, "Product Id {0} not registered", attr.Value);
                    throw new ConverterException(
                              UtilityMethods.Format(CurConResource.InvalidSourceId,
                                                    attr.Value, convParams.ConfigFile));
                }

                // Create the converter/handler for this data source
                converter = (IWorkItemConverter)Activator.CreateInstance(handlerType);

                convParams.SourceConfig    = sourceNode;
                convParams.TargetConfig    = targetNode[0];
                convParams.ExitOnError     = exitOnError;
                convParams.OutputDirectory = outputDir;

                #region before calling initialize, first initialize the report

                MigrationReport = new Report(CommonConstants.CQPreMigrationReportName);
                MigrationReport.UserInput.Options    = new string[2];
                MigrationReport.UserInput.Options[0] = CurConResource.AnalyzeCommand;
                MigrationReport.UserInput.Options[1] =
                    UtilityMethods.Format(CurConResource.ConfigFile, convParams.ConfigFile);

                #endregion


                ReportConverter convType = CurrentConverter == ConverterType.CQ?
                                           ReportConverter.CQConverter : ReportConverter.PSConverter;
                MigrationReport.StartReporting(convType);

                // now the reporting is initialized.. put command line options
                StringBuilder cmdArgs = new StringBuilder(CurrentAssembly.GetName().Name + ".exe ");
                foreach (string arg in args)
                {
                    cmdArgs.Append(arg);
                    cmdArgs.Append(" ");
                }

                MigrationReport.UserInput.CommandLine = cmdArgs.ToString();

                // Begin the conversion operation
                // Initialize the converter handler object
                converter.Initialize(convParams);
                converter.Convert();
            }
            catch (ConverterException cEx)
            {
                HandleTopException(cEx);
            }
            catch (InvalidOperationException cEx)
            {
                HandleTopException(cEx);
            }
            catch (SerializationException cEx)
            {
                HandleTopException(cEx);
            }
            catch (ThreadInterruptedException cEx)
            {
                HandleTopException(cEx);
            }
            catch (COMException cEx)
            {
                HandleTopException(cEx);
            }
            catch (SoapException cEx)
            {
                HandleTopException(cEx);
            }
            catch (ApplicationException ex)
            {
                // add in the migration report
                HandleTopException(ex);
            }
            catch (ThreadAbortException)
            {
                Thread.ResetAbort();
            }
            finally
            {
                EndConverter();
            }
        }
Exemplo n.º 30
0
 public ReportController(ReportConverter reportConverter)
 {
     _reportConverter = reportConverter;
 }