Ejemplo n.º 1
0
        private static IEnumerable <PivotGridFieldBase> CreateDiagnosisField()
        {
            var result = new List <PivotGridFieldBase>();

            var grid      = new AvrPivotGrid();
            var dataTable = new AvrDataTable(CreateTestDataSource());

            grid.SetDataSourceAndCreateFields(dataTable);
            Assert.AreEqual(8 * 2, grid.BaseFields.Count);

            PivotGridFieldBase diagnosisField = grid.BaseFields[6 * 2];

            Assert.AreEqual("sflHC_Diagnosis_idfLayoutSearchField_51530730000000", diagnosisField.FieldName);
            var diagnosis = new List <object> {
                "Botulism", "Anthrax - Pulmonary"
            };

            diagnosisField.FilterValues.SetValues(diagnosis, PivotFilterType.Included, false);
            result.Add(diagnosisField);

            PivotGridFieldBase ageField = grid.BaseFields[1 * 2];

            Assert.AreEqual("sflHC_PatientAge_idfLayoutSearchField_51536690000000", ageField.FieldName);
            var age = new List <object> {
                66, 20
            };

            ageField.FilterValues.SetValues(age, PivotFilterType.Excluded, true);
            result.Add(ageField);

            return(result);
        }
Ejemplo n.º 2
0
        public void PivotReportFormFieldsReflectionTest()
        {
            PivotGridField field1;
            PivotGridField field2;
            PivotGridField field3;

            using (var pivotGridControl = new AvrPivotGrid())
            {
                var dataTable = new AvrDataTable(DataHelper.GenerateTestTable());

                pivotGridControl.SetDataSourceAndCreateFields(dataTable);

                pivotGridControl.Fields[0].Width   = 1000;
                pivotGridControl.Fields[0].Visible = false;
                field1 = ReflectionHelper.CreateAndCopyProperties(pivotGridControl.Fields[0]);
                field2 = ReflectionHelper.CreateAndCopyProperties(pivotGridControl.Fields[2]);
                field3 = ReflectionHelper.CreateAndCopyProperties(pivotGridControl.Fields[4]);
            }

            Assert.AreEqual("sflHC_PatientAge_Caption", field1.Caption);
            Assert.AreEqual("sflHC_PatientDOB_Caption", field2.Caption);
            Assert.AreEqual("sflHC_CaseID_Caption", field3.Caption);
            Assert.AreEqual(1000, field1.Width);
            Assert.AreEqual(false, field1.Visible);
        }
Ejemplo n.º 3
0
 public void FilterFormPivotConstructorTest()
 {
     using (var ramPivotGrid = new AvrPivotGrid())
     {
         using (new FilterDialog(ramPivotGrid, null, HACode.None))
         {
         }
     }
 }
Ejemplo n.º 4
0
        public void UpdatePivotCaptionTest()
        {
            using (var pivotGridControl = new AvrPivotGrid())
            {
                var dataTable = new AvrDataTable(DataHelper.GenerateTestTable());

                pivotGridControl.SetDataSourceAndCreateFields(dataTable);
                Assert.AreEqual("sflHC_PatientAge_Caption", pivotGridControl.Fields[0].Caption);
                Assert.AreEqual("sflHC_PatientDOB_Caption", pivotGridControl.Fields[2].Caption);
                Assert.AreEqual("sflHC_CaseID_Caption", pivotGridControl.Fields[4].Caption);
            }
        }
Ejemplo n.º 5
0
        public void UpdatePivotDataTest()
        {
            using (var pivotGridControl = new AvrPivotGrid())
            {
                var dataTable = new AvrDataTable(DataHelper.GenerateTestTable());
                Assert.AreEqual(6, dataTable.Columns.Count);


                pivotGridControl.SetDataSourceAndCreateFields(dataTable);

                Assert.AreEqual(dataTable.Columns.Count, pivotGridControl.Fields.Count);
            }
        }
Ejemplo n.º 6
0
        public VirtualPivot(IContainer container)
        {
            DevXLocalizer.Init();
            m_Container        = container;
            m_PivotPlaceHolder = new VirtualPivotPlaceHolder();

            using (PresenterFactory.BeginSharedPresenterTransaction(m_Container, m_PivotPlaceHolder))
            {
                m_SharedPresenter = PresenterFactory.SharedPresenter;
                m_DBService       = new WinLayout_DB(m_SharedPresenter.SharedModel);
                m_AvrPivot        = new AvrPivotGrid();
                m_PivotPlaceHolder.Controls.Add(m_AvrPivot);
            }
        }
Ejemplo n.º 7
0
        internal static string GetLayoutXml(AvrPivotGrid pivotGrid)
        {
            string streamXml;

            using (var stream = new MemoryStream())
            {
                pivotGrid.SaveLayoutToStream(stream);
                stream.Position = 0;
                using (var streamReader = new StreamReader(stream))
                {
                    streamXml = streamReader.ReadToEnd();
                    Console.WriteLine(@"in memory xml length={0}", streamXml.Length);
                }
            }
            return(streamXml);
        }
Ejemplo n.º 8
0
        public void PivotReportFormPivotReflectionTest()
        {
            XRPivotGrid xrPivotGrid;

            using (var pivotGrid = new AvrPivotGrid())
            {
                var dataTable = new AvrDataTable(DataHelper.GenerateTestTable());

                pivotGrid.SetDataSourceAndCreateFields(dataTable);

                xrPivotGrid = new XRPivotGrid();
                ReflectionHelper.CopyCommonProperties(pivotGrid, xrPivotGrid);

                Assert.AreEqual(pivotGrid.DataSource.RealPivotData, xrPivotGrid.DataSource);
                Assert.AreNotEqual(pivotGrid.Fields.Count, xrPivotGrid.Fields.Count);
            }
            Assert.AreEqual(0, xrPivotGrid.Fields.Count);
        }
Ejemplo n.º 9
0
        public void ZlibLayoutTest()
        {
            string streamXml;

            using (PresenterFactory.BeginSharedPresenterTransaction(m_Container, new BaseForm()))
            {
                using (var pivotGrid = new AvrPivotGrid())
                {
                    var dataTable = new AvrDataTable(DataHelper.GenerateTestTable());
                    pivotGrid.SetDataSourceAndCreateFields(dataTable);

                    streamXml = ViewReportTests.GetLayoutXml(pivotGrid);
                }
            }

            byte[] bytes = BinaryCompressor.ZipString(streamXml);

            string uncompressed = BinaryCompressor.UnzipString(bytes);

            Assert.AreEqual(streamXml, uncompressed);
        }
Ejemplo n.º 10
0
 public void Dispose()
 {
     if (m_AvrPivot != null)
     {
         AvrPivotGridData oldDataSource = m_AvrPivot.DataSource;
         if (oldDataSource != null)
         {
             m_AvrPivot.DataSource = null;
             oldDataSource.Dispose();
         }
         if (m_SharedPresenter != null)
         {
             m_SharedPresenter.UnregisterView(m_AvrPivot);
             m_SharedPresenter.Dispose();
         }
         m_AvrPivot = null;
     }
     if (m_PivotPlaceHolder != null)
     {
         m_PivotPlaceHolder.Dispose();
         m_PivotPlaceHolder = null;
     }
 }