Exemplo n.º 1
0
        public virtual ReportPart Report(T objectToReport)
        {
            var reportPart = new ReportPart();

            FillUpReport(objectToReport, reportPart);
            return(reportPart);
        }
        public void Test_GetRelatedProcedureSteps()
        {
            Procedure  procedure  = new Procedure();
            Report     report     = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 1);

            // Testing that procedure steps with tied report will be related steps
            ConcreteReportingProcedureStep p1 = new ConcreteReportingProcedureStep(procedure, reportPart);
            ConcreteReportingProcedureStep p2 = new ConcreteReportingProcedureStep(procedure, reportPart);

            // expect that each ps is tied by common report
            Assert.AreEqual(report, p1.Report);
            Assert.AreEqual(report, p2.Report);
            Assert.Contains(p2, p1.GetRelatedProcedureSteps());
            Assert.Contains(p1, p2.GetRelatedProcedureSteps());

            // testing that proedure steps with null report will have no relatives
            p1 = new ConcreteReportingProcedureStep(procedure, null);
            p2 = new ConcreteReportingProcedureStep(procedure, null);

            // expect the each ps has no relatives
            Assert.IsEmpty(p1.GetRelatedProcedureSteps());
            Assert.IsEmpty(p2.GetRelatedProcedureSteps());

            // Testing that the relative has to be a report step
            GenericProtocolProcedureStep p3 = new GenericProtocolProcedureStep(new Protocol(procedure));

            procedure.AddProcedureStep(p3);

            // expect that the related psteps are not related to the different step
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p1));
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p2));
            Assert.IsFalse(p1.GetRelatedProcedureSteps().Contains(p3));
            Assert.IsFalse(p2.GetRelatedProcedureSteps().Contains(p3));
        }
Exemplo n.º 3
0
        public ReportPart BuildDifferenceBetween(Simulation sourceSimulation, Simulation targetSimulation)
        {
            //compare building blocks
            var reportPart   = new ReportPart();
            var sourceReport = BuildFor(sourceSimulation).ToStringReport().Split('\n').ToList();
            var targetReport = BuildFor(targetSimulation).ToStringReport().Split('\n').ToList();

            var tempSourceReport = new List <string>(sourceReport);

            foreach (var line in tempSourceReport)
            {
                if (!targetReport.Contains(line))
                {
                    continue;
                }

                targetReport.Remove(line);
                sourceReport.Remove(line);
            }

            var beforePart = new ReportPart().WithTitle("Before");

            beforePart.AddToContent(sourceReport.ToString("\n"));
            var afterPart = new ReportPart().WithTitle("After");

            afterPart.AddToContent(targetReport.ToString("\n"));

            reportPart.AddPart(beforePart);
            reportPart.AddPart(afterPart);
            return(reportPart);
        }
        protected override void FillUpReport(RandomPopulationSettings populationSettings, ReportPart reportPart)
        {
            var baseOnIndividualPart = new ReportPart().WithTitle(PKSimConstants.UI.BasedOnIndividual);

            baseOnIndividualPart.AddToContent(populationSettings.BaseIndividual.Name);

            var numberOfIndividualPart = new ReportPart().WithTitle(PKSimConstants.UI.NumberOfIndividuals);

            numberOfIndividualPart.AddToContent(populationSettings.NumberOfIndividuals.ToString(CultureInfo.InvariantCulture));

            var genderRatioPart = new ReportPart().WithTitle(PKSimConstants.UI.GenderRatio);

            foreach (var genderRatio in populationSettings.GenderRatios)
            {
                genderRatioPart.AddToContent(_reportGenerator.ReportFor(genderRatio).Content);
            }

            var parameterRangePart = new ReportPart().WithTitle(PKSimConstants.UI.PopulationParameterRanges);

            foreach (var parameterRange in populationSettings.ParameterRanges)
            {
                parameterRangePart.AddToContent(_reportGenerator.ReportFor(parameterRange).Content);
            }

            reportPart.AddPart(baseOnIndividualPart);
            reportPart.AddPart(numberOfIndividualPart);
            reportPart.AddPart(genderRatioPart);
            reportPart.AddPart(parameterRangePart);
        }
 protected override void FillUpReport(ExtendedProperties extendedProperties, ReportPart reportPart)
 {
     foreach (var ep in extendedProperties)
     {
         reportPart.AddToContent(PKSimConstants.UI.ReportIs(ep.Name, ep.ValueAsObject));
     }
 }
Exemplo n.º 6
0
        public void Test_MultipleAddenda()
        {
            Report report = CreateReport();

            report.ActivePart.Complete();

            ReportPart addendum1 = report.AddAddendum();

            addendum1.Complete();

            Assert.AreEqual(ReportStatus.C, report.Status);             // report is Corrected
            Assert.IsNotNull(report.CorrectedTime);
            Assert.AreEqual(2, report.Parts.Count);
            Assert.AreEqual(ReportPartStatus.F, report.Parts[0].Status);
            Assert.AreEqual(ReportPartStatus.F, report.Parts[1].Status);

            DateTime?correctedTime = report.CorrectedTime;

            ReportPart addendum2 = report.AddAddendum();

            addendum2.Complete();

            // check basics
            Assert.AreEqual(ReportStatus.C, report.Status);             // report is Corrected
            Assert.AreEqual(correctedTime, report.CorrectedTime);       // corrected time was not affected by the additonal addendum
            Assert.AreEqual(3, report.Parts.Count);
            Assert.AreEqual(ReportPartStatus.F, report.Parts[0].Status);
            Assert.AreEqual(ReportPartStatus.F, report.Parts[1].Status);
            Assert.AreEqual(ReportPartStatus.F, report.Parts[2].Status);
        }
        public IList <ToolTipPart> MapFrom(ReportPart reportPart)
        {
            var toolTipParts = new List <ToolTipPart>();

            addToolTipPart(toolTipParts, reportPart);
            return(toolTipParts);
        }
        public override void Build(SimulationProperties simulationProperties, OSPSuiteTracker buildTracker)
        {
            var objectsToReport = new List <object>();

            objectsToReport.Add(new SubSection(PKSimConstants.UI.ModelStructure));

            var part = new ReportPart {
                Title = PKSimConstants.UI.AllowAging
            };

            part.AddToContent(simulationProperties.AllowAging ? PKSimConstants.UI.Yes : PKSimConstants.UI.No);
            objectsToReport.Add(part);
            objectsToReport.Add(_reportGenerator.ReportFor(simulationProperties.ModelProperties));

            objectsToReport.Add(new SubSection(PKSimConstants.UI.SimulationCompoundsConfiguration));
            objectsToReport.AddRange(getObjectsToReport(simulationProperties, buildTracker, cp => cp));

            if (anyProcessesDefined(simulationProperties))
            {
                objectsToReport.Add(new SubSection(PKSimConstants.UI.Processes));
                objectsToReport.AddRange(getObjectsToReport(simulationProperties, buildTracker, cp => cp.Processes.Any() ? cp.Processes : null));
            }

            objectsToReport.Add(new SubSection(PKSimConstants.UI.Administration));
            objectsToReport.AddRange(getObjectsToReport(simulationProperties, buildTracker, cp => cp.ProtocolProperties.Protocol == null ? null : cp.ProtocolProperties));

            if (anyEventsDefined(simulationProperties))
            {
                objectsToReport.Add(new SubSection(PKSimConstants.UI.SimulationEventsConfiguration));
                objectsToReport.Add(simulationProperties.EventProperties);
            }

            _texBuilderRepository.Report(objectsToReport, buildTracker);
        }
Exemplo n.º 9
0
 protected override void FillUpReport(ObserverSet observerSet, ReportPart reportPart)
 {
     reportPart.Title = observerSet.Name;
     observerSet.Observers.Each(x =>
     {
         reportPart.AddToContent(x.Name);
     });
 }
Exemplo n.º 10
0
        public void Visit(Simulation simulation)
        {
            var report = new ReportPart();

            report.AddPart(_reportGenerator.ReportFor(simulation.UsedBuildingBlocks));
            report.AddPart(_reportGenerator.ReportFor(simulation.Creation));
            _report = report.ToStringReport();
        }
Exemplo n.º 11
0
        private static void EnqueueWorkItem(ReportPart reportPart, ExtensionInfo publicationAction)
        {
            var workQueueItem = new WorkQueueItem("Publication Action");

            workQueueItem.ExtendedProperties.Add("ReportPartRef", reportPart.GetRef().Serialize());
            workQueueItem.ExtendedProperties.Add("ActionType", publicationAction.ExtensionClass.FullName);
            PersistenceScope.CurrentContext.Lock(workQueueItem, DirtyState.New);
        }
Exemplo n.º 12
0
 protected override void FillUpReport(Schema schema, ReportPart reportPart)
 {
     reportPart.Title = schema.Name;
     reportPart.AddToContent(_reportGenerator.ReportFor(schema.StartTime));
     reportPart.AddToContent(_reportGenerator.ReportFor(schema.TimeBetweenRepetitions));
     reportPart.AddToContent(_reportGenerator.ReportFor(schema.NumberOfRepetitions));
     schema.SchemaItems.Each(x => reportPart.AddPart(_reportGenerator.ReportFor(x)));
 }
 protected override void FillUpReport(T comparison, ReportPart reportPart)
 {
     reportPart.Title = PKSimConstants.UI.SimulationsUsedInComparison;
     foreach (var simulation in comparison.AllSimulations)
     {
         reportPart.AddToContent(simulation.Name);
     }
 }
Exemplo n.º 14
0
        protected override void FillUpReport(Simulation simulation, ReportPart reportPart)
        {
            var title = string.Format("{0} '{1}'", PKSimConstants.ObjectTypes.Simulation, simulation.Name);

            reportPart.AddPart(_reportGenerator.ReportFor(simulation.UsedBuildingBlocks).WithTitle(title));
            reportPart.AddPart(_reportGenerator.ReportFor(simulation.Creation).WithTitle(PKSimConstants.UI.Origin));
            reportPart.AddPart(_reportGenerator.ReportFor(simulation.Properties));
        }
Exemplo n.º 15
0
 protected override void FillUpReport(DataColumn column, ReportPart reportPart)
 {
     if (column.DataInfo == null)
     {
         return;
     }
     reportPart.AddPart(_reportGenerator.ReportFor(column.DataInfo.ExtendedProperties).WithTitle(column.Name));
 }
Exemplo n.º 16
0
        void loadParts()
        {
            int warehouse = Convert.ToInt32(cbWarehouse.SelectedValue);


            var data = Global.db.Parts.Select(x => new
            {
                x.Name,
                current  = (Decimal)(Global.db.OrderItems.Where(a => a.PartID == x.ID && a.Order.DestinationWarehouseID == warehouse).Sum(a => (Decimal?)a.Amount)) - (Global.db.OrderItems.Where(a => a.PartID == x.ID && a.Order.SourceWarehouseID == warehouse).Sum(a => (Decimal?)a.Amount) == null ? 0 : Global.db.OrderItems.Where(a => a.PartID == x.ID && a.Order.SourceWarehouseID == warehouse).Sum(a => (Decimal?)a.Amount)),
                received = (Decimal)Global.db.OrderItems.Where(a => a.PartID == x.ID && a.Order.DestinationWarehouseID == warehouse).Sum(a => (Decimal?)a.Amount)
            }).ToArray();

            List <Entity.ReportPart> reportParts = new List <Entity.ReportPart>();

            foreach (var item in data)
            {
                if (rbCurrent.Checked == true)
                {
                    if (item.current > 0)
                    {
                        ReportPart part = new ReportPart
                        {
                            Name     = item.Name,
                            Current  = item.current.Value,
                            Received = item.received
                        };
                        reportParts.Add(part);
                    }
                }
                else if (rbOut.Checked == true)
                {
                    if (item.current < 1)
                    {
                        ReportPart part = new ReportPart
                        {
                            Name     = item.Name,
                            Current  = item.current.Value,
                            Received = item.received
                        };
                        reportParts.Add(part);
                    }
                }
                else if (rbReceived.Checked == true)
                {
                    if (item.received > 0)
                    {
                        ReportPart part = new ReportPart
                        {
                            Name     = item.Name,
                            Current  = item.current.Value,
                            Received = item.received
                        };
                        reportParts.Add(part);
                    }
                }
            }
            dgv.DataSource = reportParts;
        }
        public IList <ToolTipPart> MapFrom(string input)
        {
            var report = new ReportPart {
                Title = PKSimConstants.UI.Description
            };

            report.AddToContent(input);
            return(MapFrom(report));
        }
Exemplo n.º 18
0
        public void Execute(ReportPart reportPart, IPersistenceContext context)
        {
            if (_enabled == false)
            {
                return;
            }

            LogicalHL7Event.ReportPublished.EnqueueEvents(reportPart.Report);
        }
Exemplo n.º 19
0
        public void Test_IsPreStep()
        {
            Procedure procedure = new Procedure();
            ReportPart reportPart = new ReportPart();

            ConcreteReportingProcedureStep procedureStep = new ConcreteReportingProcedureStep(procedure, reportPart);

            Assert.IsFalse(procedureStep.IsPreStep);
        }
Exemplo n.º 20
0
        protected override void FillUpReport(SimpleProtocol simpleProtocol, ReportPart reportPart)
        {
            reportPart.Title = PKSimConstants.UI.SimpleProtocolMode;
            reportPart.AddToContent(simpleProtocol.ApplicationType?.DisplayName);
            reportPart.AddToContent(PKSimConstants.UI.ReportIs(PKSimConstants.UI.DosingInterval, simpleProtocol.DosingInterval?.DisplayName));

            simpleProtocol.AllParameters().Where(simpleProtocol.ParameterShouldBeExported)
            .Each(x => reportPart.AddToContent(_reportGenerator.ReportFor(x)));
        }
Exemplo n.º 21
0
 protected override void Context()
 {
     base.Context();
     _report        = new ReportPart();
     _entity        = new PKSimParameter();
     _reportBuilder = A.Fake <IReportBuilder <IEntity> >();
     A.CallTo(() => _reportBuilderRepository.BuilderFor(_entity)).Returns(_reportBuilder);
     A.CallTo(() => _reportBuilder.Report(_entity)).Returns(_report);
 }
        public void Test_IsPreStep()
        {
            Procedure  procedure  = new Procedure();
            ReportPart reportPart = new ReportPart();

            ConcreteReportingProcedureStep procedureStep = new ConcreteReportingProcedureStep(procedure, reportPart);

            Assert.IsFalse(procedureStep.IsPreStep);
        }
        public void Test_Report()
        {
            Procedure  procedure  = new Procedure();
            ReportPart reportPart = new ReportPart();

            ConcreteReportingProcedureStep procedureStep = new ConcreteReportingProcedureStep(procedure, reportPart);

            Assert.IsNotNull(procedureStep.ReportPart);
            Assert.AreEqual(reportPart.Report, procedureStep.Report);
        }
Exemplo n.º 24
0
        public void Test_Report()
        {
            Procedure procedure = new Procedure();
            ReportPart reportPart = new ReportPart();

            ConcreteReportingProcedureStep procedureStep = new ConcreteReportingProcedureStep(procedure, reportPart);

            Assert.IsNotNull(procedureStep.ReportPart);
            Assert.AreEqual(reportPart.Report, procedureStep.Report);
        }
Exemplo n.º 25
0
        protected override void FillUpReport(Formulation formulation, ReportPart reportPart)
        {
            reportPart.Title = _infoRepository.DisplayNameFor(RepresentationObjectType.CONTAINER, formulation.FormulationType);
            string parameterTableCaption = PKSimConstants.UI.ParametersDefinedIn(formulation.Name);

            if (formulation.IsDissolved)
            {
                reportPart.AddToContent(PKSimConstants.UI.NoParameter);
                return;
            }

            TablePart tablePart;

            if (!formulation.IsParticleDissolution)
            {
                var parameterList = new ParameterList(parameterTableCaption, formulation.AllVisibleParameters());
                tablePart = parameterList.ToTable(_infoRepository);
            }
            else
            {
                var particleDisperseSystem      = formulation.Parameter(Constants.Parameters.PARTICLE_DISPERSE_SYSTEM);
                var particleDistribution        = formulation.Parameter(Constants.Parameters.PARTICLE_SIZE_DISTRIBUTION);
                var displayParticleDistribution = _infoRepository.DisplayNameFor(particleDistribution);
                tablePart = new TablePart(PKSimConstants.UI.Parameter)
                {
                    Caption = parameterTableCaption
                };

                if (particleDisperseSystem.Value == CoreConstants.Parameters.MONODISPERSE)
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Monodisperse);
                    tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                }
                else
                {
                    tablePart.AddIs(_infoRepository.DisplayNameFor(particleDisperseSystem), PKSimConstants.UI.Polydisperse);
                    if (particleDistribution.Value == CoreConstants.Parameters.PARTICLE_SIZE_DISTRIBUTION_NORMAL)
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.Normal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_RADIUS_STD_DEVIATION), _infoRepository);
                    }
                    else
                    {
                        tablePart.AddIs(displayParticleDistribution, PKSimConstants.UI.LogNormal);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_DISTRIBUTION_MEAN), _infoRepository);
                        tablePart.AddIs(formulation.Parameter(CoreConstants.Parameters.PARTICLE_LOG_VARIATION_COEFF), _infoRepository);
                    }
                }
            }

            tablePart.Title = reportPart.Title;
            reportPart.AddPart(tablePart);
        }
Exemplo n.º 26
0
        protected override void FillUpReport(IEventMapping eventMapping, ReportPart reportPart)
        {
            var templateEvent = _buildingBlockRepository.FindById(eventMapping.TemplateEventId);

            if (templateEvent == null)
            {
                return;
            }

            reportPart.AddToContent(string.Format("{0}, {1}", PKSimConstants.UI.ReportIs("Event", templateEvent.Name), _reportGenerator.StringReportFor(eventMapping.StartTime)));
        }
Exemplo n.º 27
0
        protected override void FillUpReport(SimulationProperties simulationProperties, ReportPart reportPart)
        {
            var part = new ReportPart {
                Title = PKSimConstants.UI.AllowAging
            };

            part.AddToContent(simulationProperties.AllowAging ? PKSimConstants.UI.Yes : PKSimConstants.UI.No);
            reportPart.AddPart(part);
            reportPart.AddPart(_reportGenerator.ReportFor(simulationProperties.ModelProperties));
            reportPart.AddPart(_reportGenerator.ReportFor(simulationProperties.EventProperties));
        }
        public void ReportPart_Type_Table_GeneratedXMLReportShouldHaveNumberOfReportParts_Equals_To_The_Objects_Test()
        {
            const int PROPERTY_COUNT = 2;

            // Prepare the test data
            var employeesCollection = this.GetReportTestDataCollection();

            // form the report
            var rptPartTable = new ReportPart(ReportSectionDisplayType.Table, "All employees", "Footer info");

            AddCollectionToReportPart(employeesCollection, rptPartTable);
            IList <IReportPart> parts = new List <IReportPart>()
            {
                rptPartTable
            };
            IReport rpt = new Report("This is my title", "All employees:", "these are all our employees", parts);

            // get the xml representation of the report object
            IReportXmlConverter objtoXmlConverter = new ReportXmlConverter(factory);
            var result = objtoXmlConverter.ConvertToReportXml(rpt);

            //create xml document from string
            XDocument xdoc = XDocument.Parse(result);

            // Verification starts
            // verify the root node count
            var reportNode = xdoc.Descendants("ReviewReport");

            Assert.AreEqual(reportNode.Count(), 1);

            // verify the report part (table) count
            var tableElement = reportNode.Descendants("table");

            Assert.AreEqual(tableElement.Count(), 1);

            // verify the report header count
            Assert.AreEqual(reportNode.Descendants("Header").Count(), 1);

            /* verify the report footer count. There is a
             * default header (report generated on) and the report header mentioned in the Report object.
             * */
            Assert.AreEqual(reportNode.Descendants("Footer").Count(), 2);

            // Verify the row count that must be equals to the no.of employees
            var rows = tableElement.Descendants("row");

            Assert.AreEqual(rows.Count(), employeesCollection.Count);

            foreach (var row in rows)
            {
                // There are 2 properties with ReportDisplay attribute. Hence there should be 2 columns.
                Assert.AreEqual(row.Descendants("col").Count(), PROPERTY_COUNT);
            }
        }
Exemplo n.º 29
0
        protected override void FillUpReport(UsedBuildingBlock usedBuildingBlock, ReportPart reportPart)
        {
            var status = _buildingBlockInProjectManager.StatusFor(usedBuildingBlock);

            if (status == BuildingBlockStatus.Green)
            {
                return;
            }
            reportPart.Title = PKSimConstants.UI.Warning;
            reportPart.AddToContent(PKSimConstants.Information.BuildingBlockSettingsDoNotMatchWithTemplate(usedBuildingBlock.BuildingBlockType.ToString()));
        }
Exemplo n.º 30
0
        private ReportPart defaultReportFor <TObject>(TObject objectToReport)
        {
            var report     = new ReportPart();
            var objectBase = objectToReport as IObjectBase;

            if (objectBase != null)
            {
                report.AddToContent(_representationInfoRepository.DescriptionFor(objectBase));
            }

            return(report);
        }
Exemplo n.º 31
0
        protected override void FillUpReport(ISchemaItem schemaItem, ReportPart reportPart)
        {
            reportPart.Title = schemaItem.Name;
            reportPart.AddToContent(schemaItem.ApplicationType.DisplayName);

            if (schemaItem.ApplicationType.NeedsFormulation)
            {
                reportPart.AddToContent(PKSimConstants.UI.ReportIs(PKSimConstants.UI.PlaceholderFormulation, schemaItem.FormulationKey));
            }

            schemaItem.AllParameters().Each(x => reportPart.AddToContent(_reportGenerator.ReportFor(x)));
        }
Exemplo n.º 32
0
 public void Test_Complete_NullReportPart()
 {
     Procedure procedure = new Procedure();
     Report report = new Report(procedure);
     ReportPart reportPart = new ReportPart(report, 0);
     Staff performer = new Staff();
     InterpretationStep previousStep = new InterpretationStep(procedure);
     TranscriptionStep procedureStep = new TranscriptionStep(previousStep);
     procedureStep.Start(performer);
     
     procedureStep.Complete();
 }
Exemplo n.º 33
0
        public void Test_Complete_NullReportPart()
        {
            Procedure          procedure     = new Procedure();
            Report             report        = new Report(procedure);
            ReportPart         reportPart    = new ReportPart(report, 0);
            Staff              performer     = new Staff();
            InterpretationStep previousStep  = new InterpretationStep(procedure);
            TranscriptionStep  procedureStep = new TranscriptionStep(previousStep);

            procedureStep.Start(performer);

            procedureStep.Complete();
        }
Exemplo n.º 34
0
        public void Test_Complete()
        {
            Procedure procedure = new Procedure();
            Report report = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 0);
            Staff performer = new Staff();
            InterpretationStep previousStep = new InterpretationStep(procedure);
            previousStep.ReportPart = reportPart;
            TranscriptionStep procedureStep = new TranscriptionStep(previousStep);
            procedureStep.Start(performer);
            
            procedureStep.Complete();

            Assert.AreEqual(performer, procedureStep.ReportPart.Transcriber);
        }
Exemplo n.º 35
0
        public void Test_Reassign()
        {
            Procedure procedure = new Procedure();
            Report report = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 0);
            Staff performer = new Staff();
            reportPart.Supervisor = new Staff();
            VerificationStep procedureStep = new VerificationStep();
            procedureStep.Procedure = procedure;
            procedureStep.ReportPart = reportPart;
            Assert.IsNotNull(procedureStep.ReportPart);

            VerificationStep newStep = (VerificationStep)procedureStep.Reassign(performer);

            Assert.AreEqual(performer, newStep.ReportPart.Supervisor);
            Assert.AreEqual(procedureStep, newStep);
            Assert.IsInstanceOf(typeof(VerificationStep), newStep);
        }
Exemplo n.º 36
0
        // ������� ����� �� ��������
        private void UpdateSummary(ReportPart part, ref int row, params BookColumns[] Book�olumnsArray)
        {
            BookColumns columns = BookColumns.Merge(Book�olumnsArray);
              int MaxRowOffset = 0;
              bool ContainsSummary = false;
              bool ContainsMinMaxAvg = false;
              foreach (BookColumn column in columns)
            if (column.formulatype != FormulaType.None && column.column1 == column.column2 && !column.isgroup)
              switch (column.formulatype)
              {
            case FormulaType.Summary:
              DataResult = GetResultForColumn(part, cMass);
              if (DataResult == null)
                break;
              FM.DrawCell(row, cMass.column1 - 1, "�����", AlignmentEnum.RightCenter);
              FM.DrawCell(row, cMass.column1, DataResult.Calculate(DataResult.Columns[0].ColumnName, new SummaryCalculation()), AlignmentEnum.RightCenter);
              MaxRowOffset = Math.Max(MaxRowOffset, 1);
              ContainsSummary = true;
              break;
            case FormulaType.MinMaxAvg:
              DataResult = GetResultForColumn(part, cMass, column);
              if (DataResult == null)
                break;
              part.RowMin = row;
              part.RowMax = row + 1;
              part.RowAvg = row + 2;
              FM.DrawCell(part.RowMin, StaticColumns.LastColumn, "�������", AlignmentEnum.RightCenter);
              FM.DrawCell(part.RowMax, StaticColumns.LastColumn, "��������", AlignmentEnum.RightCenter);
              FM.DrawCell(part.RowAvg, StaticColumns.LastColumn, "��.�����.", AlignmentEnum.RightCenter);

              FM.DrawCell(part.RowMin, column.column1, DataResult.Calculate(DataResult.Columns[1].ColumnName, new MininumCalculation()), AlignmentEnum.RightCenter);
              FM.DrawCell(part.RowMax, column.column1, DataResult.Calculate(DataResult.Columns[1].ColumnName, new MaximumCalculation()), AlignmentEnum.RightCenter);

              object avg = DataResult.Calculate(new string[] { DataResult.Columns[0].ColumnName, DataResult.Columns[1].ColumnName }, new AverageWeightCalculation());
              if (Functions.IsNull(avg))
                avg = DataResult.Calculate(new string[] { DataResult.Columns[1].ColumnName }, new AverageCalculation());
              FM.DrawCell(part.RowAvg, column.column1, avg, AlignmentEnum.RightCenter);

              MaxRowOffset = Math.Max(MaxRowOffset, 3);
              ContainsMinMaxAvg = true;
              break;
            default:
              throw new Exception("Unknown formula type for column "+column.header);
              }
              if (ContainsSummary)
            FM.SetBorder(row, cMass.column1 - 1, row, cMass.column1, LineStyleEnum.Thin).BackColor = Color.LightGray;
              if (ContainsMinMaxAvg)
            FM.SetBorder(row, StaticColumns.LastColumn, row + 2, columns.LastColumn, LineStyleEnum.Thin).BackColor = Color.LightGray;

              part.SummaryRow1 = row;
              part.SummaryRow2 = row + MaxRowOffset - 1;
              row = row + MaxRowOffset;
        }
Exemplo n.º 37
0
        void UpdatePart(ReportPart part, ref int row)
        {
            CreateDynamicColumns(part);

              part.HeaderRow1 = row;
              StaticColumns.Draw(FM, row);
              part.DynamicColumns.Draw(FM, row);
              row = row + Math.Max(StaticColumns.MaxRowOffset, part.DynamicColumns.MaxRowOffset) + 1;
              part.HeaderRow2 = row;
              if (part == Parts[0])
            FM.Book.FrozenRows = row - 1;

              part.NormRow = row - 1;
              UpdateNorms(part);
              FM.SetRowAutoHeight(part.HeaderRow1, part.HeaderRow2);

              // ������� ����
              part.Row1 = row;
              foreach (DataRow dr in part.Data.Rows)
              {
            dr["RowNumber"] = row;

            FM.DrawCell(row, cOrderID.column1, dr["qaonr"], AlignmentEnum.CenterCenter);
            FM.DrawCell(row, cDateTime.column1, ((DateTime)dr["QAODecisionTime"]).ToString("dd.MM.yyyy HH:mm:ss"), AlignmentEnum.LeftCenter);
            FM.DrawCell(row, cCertificate.column1, dr["batchno"], AlignmentEnum.RightCenter);
            FM.DrawCell(row, cTank.column1, dr["Tank"], AlignmentEnum.RightCenter);
            FM.DrawCell(row, cLevel.column1, dr["TankLevel"].ToString(), AlignmentEnum.RightCenter);
            FM.DrawCell(row, cMass.column1, dr["TankMass"].ToString(), AlignmentEnum.RightCenter);

            for (int j = 0; j < part.Columns.Rows.Count; j++)
            {
              /*int index = part.Columns.Search(new object[] { part.Columns[j, "TestGroup"], part.Columns[j, "TextModule"], part.Columns[j, "modulenorm"], part.Columns[j, "precisionid"] });
              if (index < 0)
            continue;*/
              BookColumn column = part.DynamicColumns.Search(part.Columns[j, "TestGroup"].ToString(), part.Columns[j, "TextModule"].ToString());
              //BookColumn column = part.DynamicColumns[index];
              if (column == null)
            continue;
              string FieldName = "Result*" + j.ToString();
              if (dr.Table.Columns.Contains(FieldName) && !Functions.IsNull(dr[FieldName]))
            FM.DrawCell(row, column.column1, dr[FieldName], column.align);
              if (!part.DataFields.ContainsKey(column.column1))
            part.DataFields.Add(column.column1, FieldName);
            }
            row++;
              }
              row--;
              part.Row2 = row;
              FM.SetBorder(part.Row1, StaticColumns.FirstColumn, part.Row2, part.DynamicColumns.LastColumn, LineStyleEnum.Thin);
              MergeColumns(StaticColumns, part.Row1, part.Row2);
              row++;
              UpdateSummary(part, ref row, StaticColumns, part.DynamicColumns);
              row++;

              SetColumnFormat(part, StaticColumns);
              SetColumnFormat(part, part.DynamicColumns);
        }
Exemplo n.º 38
0
 // ������ �����
 private void UpdateNorms(ReportPart part)
 {
     foreach (DataRow topcolumn in part.Columns.Rows)
       {
     BookColumn normcolumn = part.DynamicColumns.Search(topcolumn["TestGroup"].ToString(), topcolumn["TextModule"].ToString());
     /*int index = part.Columns.Search(new object[] { topcolumn["TestGroup"], topcolumn["TextModule"], topcolumn["modulenorm"], topcolumn["precisionid"] });
     if (index < 0) continue;
     BookColumn normcolumn = part.DynamicColumns[index];*/
     if (normcolumn == null) continue;
     FM.DrawCell(part.NormRow, normcolumn.column1, topcolumn["ModuleNorm"].ToString(), AlignmentEnum.CenterCenter, true, true);
       }
       FM.Book.Row(part.NormRow).AutoFit();
       FM.SetBorder(part.NormRow, StaticColumns.FirstColumn, part.NormRow, part.DynamicColumns.LastColumn, LineStyleEnum.Thick);
 }
Exemplo n.º 39
0
        private void UpdateData(ref int row)
        {
            int startrow = row;

              StatusSplash.Message("��������� ������...");
              DataCommand = OracleProc.Execute(DataConnection, "DataAccessPKG.GetCertTankData",
            new object[] { (PlantCombo.SelectedItem as DataRowView)["PlantID"], (ControlTypeCombo.SelectedItem as DataRowView)["OsgID"], (ProductCombo.SelectedItem as DataRowView)["ProductID"],Date1.Value, Date2.Value, null });
              DataResult = new QueryResult(DataCommand.Parameters["rc"].Value);
              foreach (DataRow dr in DataResult.Rows)
              {
            dr["TestGroup"] = StartForm.DictionaryReplace(dr["TestGroup"].ToString());
            dr["TextModule"] = StartForm.DictionaryReplace(dr["TextModule"].ToString());
              }
              QueryResult UniqueSplit;
              QueryResult[] SplittedData = DataResult.Split("plantid, productid, certproductdescription", out UniqueSplit);
              Parts = new ReportPart[SplittedData.Length];
              StatusSplash.Message("������������ ������...");
              // ����� ���� ������ ������ �� ����� - ������ �� ����������� ��������
              StatusSplash.ProgressInit(SplittedData.Length);
              for (int i = 0; i < SplittedData.Length; i++)
              {
            Parts[i] = new ReportPart();
            Parts[i].Data = SplittedData[i].Transpose(
              "plantid, productid, qaonr, qaodecisiontime, tank, tanklevel, tankmass, batchno, certnr",
              "testgroup, textmodule, modulenorm, precisionid",
              "result, upperlimit, lowerlimit",
              out Parts[i].Rows, out Parts[i].Columns);
            Parts[i].Data.Columns.Add(new DataColumn("RowNumber", typeof(int)));
            Parts[i].DataFields = new Dictionary<int, string>();

            // ������� ���������� � ����� - �����, �������
            int inforow = row;
            row += 1;//row += 2;

            Parts[i].TitleInfoRow = inforow;
            UpdatePart(Parts[i], ref row);

            /*FM.DrawCell(inforow, 1, inforow, Parts[i].DynamicColumns.LastColumn,
              plants.FindPlant(Convert.ToInt32(UniqueSplit[i, "plantid"])).ShortPlantName, AlignmentEnum.LeftCenter, true, true).FontSize = 10;*/
            FM.DrawCell(inforow/*+1*/, 1, inforow/*+1*/, Parts[i].DynamicColumns.LastColumn,
              UniqueSplit[i, "certproductdescription"], AlignmentEnum.LeftCenter, true, true).FontSize = 10;
            FM.SetRowAutoHeight(inforow, inforow + 1);

            StatusSplash.ProgressAdd();
              }
              row++;
        }
Exemplo n.º 40
0
        public void Test_GetRelatedProcedureSteps()
        {
            Procedure procedure = new Procedure();
            Report report = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 1);

            // Testing that procedure steps with tied report will be related steps
            ConcreteReportingProcedureStep p1 = new ConcreteReportingProcedureStep(procedure, reportPart);
            ConcreteReportingProcedureStep p2 = new ConcreteReportingProcedureStep(procedure, reportPart);

            // expect that each ps is tied by common report
            Assert.AreEqual(report, p1.Report);
            Assert.AreEqual(report, p2.Report);
            Assert.Contains(p2, p1.GetRelatedProcedureSteps());
            Assert.Contains(p1, p2.GetRelatedProcedureSteps());

            // testing that proedure steps with null report will have no relatives
            p1 = new ConcreteReportingProcedureStep(procedure, null);
            p2 = new ConcreteReportingProcedureStep(procedure, null);

            // expect the each ps has no relatives
            Assert.IsEmpty(p1.GetRelatedProcedureSteps());
            Assert.IsEmpty(p2.GetRelatedProcedureSteps());

            // Testing that the relative has to be a report step
            GenericProtocolProcedureStep p3 = new GenericProtocolProcedureStep(new Protocol(procedure));
            procedure.AddProcedureStep(p3);

            // expect that the related psteps are not related to the different step
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p1));
            Assert.IsFalse(p3.GetRelatedProcedureSteps().Contains(p2));
            Assert.IsFalse(p1.GetRelatedProcedureSteps().Contains(p3));
            Assert.IsFalse(p2.GetRelatedProcedureSteps().Contains(p3));
        }
Exemplo n.º 41
0
 // ��������� QueryResult ��� ������ ��� ���������� �������� ������
 private QueryResult GetResultForColumn(ReportPart part, params BookColumn[] columns)
 {
     QueryResult result = new QueryResult();
       string[] FieldNames = new string[columns.Length];
       for (int i = 0; i < FieldNames.Length; i++)
       {
     FieldNames[i] = part.FieldName(columns[i].column1, StaticColumns, part.DynamicColumns);
     if (FieldNames[i] == "")
       return null;
     result.Columns.Add(FieldNames[i]);
       }
       /*for (int i = 0; i < part.Data.Rows.Count; i++)
     //if (!HasNullValues(part.Data.Rows[i], FieldNames))
       result.Rows.Add(part.Data[i, FieldNames]);*/
       for (int r = part.Row1; r <= part.Row2; r++)
       {
     object[] values = new object[columns.Length];
     for (int j = 0; j < columns.Length; j++)
       values[j] = FM[r, columns[j].column1];
     result.Rows.Add(values);
       }
       return result;
 }
Exemplo n.º 42
0
        // ��� ������� ������ ������������: �����, ��� �����, ������ � ������� � ������� ������
        private void GetCurrentCellInfo(out Plant CurrentPlant, out ReportPart CurrentPart, out DataRow CurrentRow, out BookColumn CurrentBookColumn)
        {
            // ���� �����, ������ ������� ��������
              CurrentPlant = null;
              CurrentPart = null;
              CurrentBookColumn = null;

              CurrentRow = null;
              foreach (ReportPart part in Parts)
              {
            CurrentRow = part.GetDataRow(FM.CurrentRow);
            if (CurrentRow != null)
            {
              CurrentPart = part;
              if (CurrentPart.Data != null && CurrentPart.Data.Rows.Count > 0)
            CurrentPlant = plants.FindPlant(Convert.ToInt32(CurrentPart.Data[0, "plantid"]));
              break;
            }
              }

              // ���� ���������� �������
              if (CurrentPart != null)
            CurrentBookColumn = CurrentPart.DynamicColumns.Search(FM.CurrentColumn);
        }
Exemplo n.º 43
0
        private void CreateDynamicColumns(ReportPart part)
        {
            // ��������� ������������ ������� - ��� ���������� top crosstab � ����
              part.DynamicColumns.Clear();

              BookColumn TextColumn, GroupColumn;
              int lastcolumn = StaticColumns.LastColumn+1;
              foreach (DataRow Module in part.Columns.Rows)
              {
            if (Module["TestGroup"].ToString() == "")
            {
              TextColumn = new BookColumn(lastcolumn, lastcolumn, 0, 1,
            "", Module["TextModule"].ToString(), 100, true, false,
            FormulaType.MinMaxAvg, AlignmentEnum.RightCenter, MaskEnum.Numeric);
              TextColumn.fontsize = 8;
              part.DynamicColumns.Add(TextColumn);
              lastcolumn++;
            }
            else
            {
              GroupColumn = part.DynamicColumns.Search("", Module["TestGroup"].ToString());
              // ���������� �����, ����� ������� � ���������� ������� ������������ � ������������ � ������ ����� - � ����� ������ �������
              if (GroupColumn == null || (GroupColumn != null && GroupColumn.column2 + 1 != lastcolumn))
              { // ����� ������
            GroupColumn = new BookColumn(lastcolumn, lastcolumn, 0, 0,
              "", Module["TestGroup"].ToString(), 100, true, false,
              FormulaType.None, AlignmentEnum.CenterCenter, MaskEnum.Numeric);
            GroupColumn.isgroup = true;
            GroupColumn.fontsize = 8;
            part.DynamicColumns.Add(GroupColumn);
              }
              else
              { // ������������ ������� ������ ������
            GroupColumn.column2 = lastcolumn;
              }

              TextColumn = new BookColumn(lastcolumn, lastcolumn, 1, 1,
            "", Module["TextModule"].ToString(), 100, true, false,
            FormulaType.MinMaxAvg, AlignmentEnum.RightCenter, MaskEnum.Numeric);
              part.DynamicColumns.Add(TextColumn);
              TextColumn.fontsize = 8;
              lastcolumn++;
            }
              }
        }
Exemplo n.º 44
0
			internal ReportPartFacade(ReportPart part)
			{
				_part = part;
				_status = PersistenceScope.CurrentContext.GetBroker<IEnumBroker>().Find<ReportPartStatusEnum>(_part.Status.ToString());
			}
Exemplo n.º 45
0
        public void Test_Complete()
        {
            Procedure procedure = new Procedure();
            Report report = new Report(procedure);
            ReportPart reportPart = new ReportPart(report, 0);

            // This modality procedure step is created such that when the procedure tries to update its status
            // the detection of no ModalityProcedureSteps makes any procedure trying to update its status set itself
            // to discontinued, which for this test, is undesirable, this situation will probably never happen
            // in practice.
            ModalityProcedureStep modalityStep = new ModalityProcedureStep(procedure, "New modality.", new Modality());

            InterpretationStep previousStep = new InterpretationStep(procedure);
            previousStep.ReportPart = reportPart;
            PublicationStep procedureStep = new PublicationStep(previousStep);
            
            procedureStep.Start(new Staff());

            Assert.AreEqual(ActivityStatus.IP, procedureStep.State);
            Assert.AreEqual(0, procedureStep.ReportPart.Index);
            Assert.AreEqual(ReportPartStatus.D, procedureStep.ReportPart.Status);
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                delegate(Procedure p)
                {
                    return p.Status == ProcedureStatus.IP;
                }));

            procedureStep.Complete();

            Assert.AreEqual(ActivityStatus.CM, procedureStep.State);
            Assert.AreEqual(ReportPartStatus.F, procedureStep.ReportPart.Status);
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                delegate(Procedure p)
                {
                    return p.Status == ProcedureStatus.CM;
                }));
            Assert.IsTrue(procedureStep.AllProcedures.TrueForAll(
                delegate(Procedure p)
                {
                    return p.EndTime == procedureStep.EndTime;
                }));
        }
Exemplo n.º 46
0
 public ConcreteReportingProcedureStep(Procedure procedure, ReportPart reportPart)
     :base(procedure, reportPart)
 {
     
 }
Exemplo n.º 47
0
 // ����������� �������� ���� � �������� - ����� flex �� ����� ������������ ������ ��� ������ ������.
 // ������ ������� ������ ��� ������� �������. ����� ��� ������ � ������� ��������� ������������, �����
 // ������ ������� ��������� �� ����������� ��������� ���������� ������ ����� �������
 private void SetColumnFormat(ReportPart part, BookColumns columns)
 {
     int[] Decimals = new int[columns.Count];
       for (int i = 0; i < Decimals.Length; i++) // prepare...
     Decimals[i] = -1;
       for (int i = 0; i < part.Columns.Rows.Count; i++)
       {
     int cindex = columns.IndexOf(part.Columns[i, "TestGroup"].ToString(), part.Columns[i, "TextModule"].ToString());
     //int cindex = part.Columns.Search(new object[] { part.Columns[i, "TestGroup"], part.Columns[i, "TextModule"], part.Columns[i, "modulenorm"], part.Columns[i, "precisionid"] });
     if (cindex < 0 || cindex > columns.Count-1)
       continue;
     BookColumn column = columns[cindex];
     if (column.column1 == column.column2 && FM.Book.Column(column.column1).Mask == MaskEnum.Numeric)
       Decimals[cindex] = Math.Max(Decimals[cindex], Precision2Decimal(part.Columns[i, "PrecisionID"]));
       }
       /* �������� �����, ����� ��� ������� ���� ��� ������ ������ ��������� ������ � ������ ��������� */
       for (int i = 0; i < Decimals.Length; i++)
       {
     columns[i].Decimal = Decimals[i];
                         // ��������� ��� �������� �����, ���������� ����
     if (Decimals[i] >= 0 && Decimals[i] > FM.Book.Column(columns[i].column1).DecimalLength)
       FM.Book.Column(columns[i].column1).DecimalLength = Decimals[i];
       }
       // ��� �� ������ � �������� �������� � ������������ � ��������� ��� ����������� ���������� � Excel
       foreach (BookColumn c in columns)
     if (c.Decimal >= 0 && c.column1 == c.column2 && !c.isgroup)
       for (int r = part.SummaryRow1; r <= part.SummaryRow2; r++)
     FM[r, c.column1] = MainForm.FormatValue(FM[r, c.column1], c.Decimal);
 }
Exemplo n.º 48
0
        public void Test_Constructor()
        {
            Procedure procedure = new Procedure();
            ReportPart reportPart = new ReportPart();

            ConcreteReportingProcedureStep procedureStep = new ConcreteReportingProcedureStep(procedure, reportPart);

            Assert.AreEqual(reportPart, procedureStep.ReportPart);

            // Passing in last procedure step into a new one
            ConcreteReportingProcedureStep nextStep = new ConcreteReportingProcedureStep(procedureStep);

            Assert.AreEqual(procedure, nextStep.Procedure);
            Assert.AreEqual(reportPart, nextStep.ReportPart);
        }
Exemplo n.º 49
0
        public void Test_GetLinkedProcedures()
        {
            Procedure procedure = new Procedure();
            Procedure procedure2 = new Procedure();
            Report report = new Report(procedure);
            report.Procedures.Add(procedure2);
            ReportPart reportPart = new ReportPart(report, 1);

            ConcreteReportingProcedureStep procedureStep = new ConcreteReportingProcedureStep(procedure, reportPart);

            Assert.IsNotNull(procedureStep.ReportPart);
            Assert.IsNotNull(procedureStep.ReportPart.Report);
            Assert.AreEqual(2, procedureStep.ReportPart.Report.Procedures.Count);
            Assert.AreEqual(1, procedureStep.GetLinkedProcedures().Count);
            Assert.Contains(procedure2, procedureStep.GetLinkedProcedures());
        }