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); }
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); }
private AvrPivotViewModel CreateAvrPivotViewModelInternal(long layoutId, string lang) { LayoutDetailDataSet layoutDataSet = GetLayoutDataSet(layoutId); LayoutDetailDataSet.LayoutRow layoutRow = GetLayoutRow(layoutDataSet); m_SharedPresenter.SharedModel.SelectedQueryId = layoutRow.idflQuery; m_SharedPresenter.SharedModel.SelectedLayoutId = layoutId; m_Trace.Trace(TraceTitle, string.Format("Layout {0} structure read from DB", layoutId)); var validatorWaiter = new LayoutSilentValidatorWaiter(); var filter = layoutRow.blnApplyPivotGridFilter ? layoutRow.strPivotGridSettings : string.Empty; var queryResult = AvrMainFormPresenter.ExecQueryInternal(layoutRow.idflQuery, lang, layoutRow.blnUseArchivedData, filter, validatorWaiter, false, QueryExecutor); //var queryResult = AvrMainFormPresenter.ExecQueryInternal(layoutRow.idflQuery, lang, // layoutRow.blnUseArchivedData, layoutRow.strPivotGridSettings, validatorWaiter, false, QueryExecutor); m_Trace.Trace(TraceTitle, string.Format("Data for layout {0} received from AVR Cashe ", layoutId)); AvrDataTable preparedQueryTable = AvrPivotGridHelper.GetPreparedDataSource(layoutDataSet.LayoutSearchField, layoutRow.idflQuery, layoutId, queryResult.QueryTable, false); m_AvrPivot.SetDataSourceAndCreateFields(preparedQueryTable); RestorePivotSettings(layoutDataSet); using (m_AvrPivot.BeginTransaction()) { List <IAvrPivotGridField> fields = m_AvrPivot.AvrFields.ToList(); var result = new LayoutValidateResult(); if (layoutRow.blnShowMissedValuesInPivotGrid) { result = AvrPivotGridHelper.AddMissedValuesAndValidateComplexity(m_AvrPivot.DataSource, fields, validatorWaiter.Validator); } if (!result.IsCancelOrUserDialogCancel()) { result = AvrPivotGridHelper.FillEmptyValuesAndValidateComplexity(m_AvrPivot.DataSource, fields, validatorWaiter.Validator); } if (result.IsCancelOrUserDialogCancel()) { m_AvrPivot.HideData = true; } m_AvrPivot.RefreshData(); } m_Trace.Trace(TraceTitle, string.Format("Layout {0} builded", layoutId)); PivotGridDataLoadedCommand command = m_AvrPivot.CreatePivotDataLoadedCommand(layoutRow.strLayoutName); m_Trace.Trace(TraceTitle, string.Format("View model for layout {0}, language {1} created", layoutId, lang)); return(command.Model); }
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); } }
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); } }
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); }
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); }