Esempio n. 1
0
        internal static void GetLayoutDetailControls
            (LayoutDetailPanel layoutDetail, out PivotDetailPanel pivotForm,
            out MapDetailPanel mapForm, out ChartDetailPanel chartForm)
        {
            pivotForm = null;
            mapForm   = null;
            chartForm = null;

            foreach (IRelatedObject child in layoutDetail.Children)
            {
                if (child is PivotDetailPanel)
                {
                    pivotForm = child as PivotDetailPanel;
                }
                if (child is MapDetailPanel)
                {
                    mapForm = child as MapDetailPanel;
                }
                if (child is ChartDetailPanel)
                {
                    chartForm = child as ChartDetailPanel;
                }
            }
            Assert.IsNotNull(pivotForm);
            Assert.IsNotNull(mapForm);
            Assert.IsNotNull(chartForm);
        }
Esempio n. 2
0
        public void GetPivotSummaryTypeTest()
        {
            using (var pivot = new PivotDetailPanel())
            {
                AvrDataTable dataTable = new AvrDataTable(DataHelper.GenerateTestTable());

                List <WinPivotGridField> list = AvrPivotGridHelper.CreateFields <WinPivotGridField>(dataTable);
                pivot.PivotGrid.Fields.AddRange(list.ToArray());

                pivot.PivotGrid.SetDataSourceAndCreateFields(dataTable);
                Assert.IsTrue(Configuration.SummaryTypeDictionary.ContainsKey(typeof(string)));
                CustomSummaryType type = Configuration.SummaryTypeDictionary[typeof(string)];
                Assert.AreEqual(CustomSummaryType.Count, type);

                Assert.IsTrue(Configuration.SummaryTypeDictionary.ContainsKey(typeof(DateTime)));
                type = Configuration.SummaryTypeDictionary[typeof(DateTime)];
                Assert.AreEqual(CustomSummaryType.Max, type);

                Assert.IsFalse(Configuration.SummaryTypeDictionary.ContainsKey(typeof(bool)));
                type = Configuration.DefaltSummaryType;
                Assert.AreEqual(CustomSummaryType.Count, type);

                Assert.IsTrue(Configuration.SummaryTypeDictionary.ContainsKey(typeof(int)));
                type = Configuration.SummaryTypeDictionary[typeof(int)];
                Assert.AreEqual(CustomSummaryType.Sum, type);

                Assert.IsTrue(Configuration.SummaryTypeDictionary.ContainsKey(typeof(long)));
                type = Configuration.SummaryTypeDictionary[typeof(long)];
                Assert.AreEqual(CustomSummaryType.Sum, type);
            }
        }
Esempio n. 3
0
 public void PivotDataTransactionTest()
 {
     using (var pivot = new PivotDetailPanel())
     {
         AvrDataTable dataTable = new AvrDataTable(DataHelper.GenerateTestTable());
         pivot.PivotGrid.SetDataSourceAndCreateFields(dataTable);
         for (int i = 0; i < 2; i++)
         {
             using (var transaction = (DataTransaction)pivot.PivotGrid.BeginTransaction())
             {
                 Assert.IsTrue(transaction.HasData);
                 using (var innerTransaction = (DataTransaction)pivot.PivotGrid.BeginTransaction())
                 {
                     Assert.IsFalse(innerTransaction.HasData);
                 }
                 Assert.IsTrue(transaction.HasData);
             }
         }
     }
 }
Esempio n. 4
0
        public void PivotLayoutTest()
        {
            using (var pivot = new PivotDetailPanel())
            {
                AvrDataTable dataTable = new AvrDataTable(DataHelper.GenerateTestTable());
                pivot.PivotGrid.SetDataSourceAndCreateFields(dataTable);
                string fileXml;
                pivot.PivotGrid.SaveLayoutToXml("1.xml");
                using (var reader = new StreamReader("1.xml"))
                {
                    fileXml = reader.ReadToEnd();
                    Console.WriteLine(@"file xml length={0}", fileXml.Length);
                }

                string streamXml = GetLayoutXml(pivot.PivotGrid);

                Assert.AreEqual(streamXml, fileXml);

                SetLayoutXml(pivot.PivotGrid, streamXml);
            }
        }