private void RestorePivotSettings(LayoutDetailDataSet layoutDataSet) { try { LayoutDetailDataSet.LayoutRow layoutRow = GetLayoutRow(layoutDataSet); List <IAvrPivotGridField> avrFields = m_AvrPivot.AvrFields.ToList(); AvrPivotGridHelper.LoadSearchFieldsVersionSixFromDB(avrFields, layoutDataSet.LayoutSearchField, layoutRow.idfsDefaultGroupDate); using (m_AvrPivot.BeginTransaction()) { AvrPivotGridHelper.LoadExstraSearchFieldsProperties(avrFields, layoutDataSet.LayoutSearchField); AvrPivotGridHelper.SwapOriginalAndCopiedFieldsIfReversed(avrFields); m_AvrPivot.PivotGridPresenter.UpdatePivotCaptions(); RestoreTotals(layoutRow); } } catch (XmlException ex) { Trace.WriteLine(ex); ErrorForm.ShowError("errCantParseLayout", "Cannot parse Layout retrived from Database", ex); } }
private void Init(WebPivotGridField webField, LayoutDetailDataSet ds) { if (webField == null || ds == null) { IsEmpty = true; return; } BasicCountFunctionId = webField.BasicCountFunctionId; AggregateFunctionId = webField.AggregateFunctionId; Precision = webField.Precision; UnitLayoutSearchFieldId = webField.UnitLayoutSearchFieldId; DateLayoutSearchFieldId = webField.DateLayoutSearchFieldId; if (webField.PrivateGroupInterval.HasValue) { PrivateGroupInterval = (long)GroupIntervalHelper.GetDBGroupInterval(webField.PrivateGroupInterval.Value); } else { PrivateGroupInterval = null; } DiapasonStartDate = webField.DiapasonStartDate; DiapasonEndDate = webField.DiapasonEndDate; AddMissedValues = webField.AddMissedValues; LayoutDetailDataSet.LayoutSearchFieldRow row = GetLayoutSearchFieldRowByField(ds, webField); CaptionEn = string.IsNullOrEmpty(row.strNewFieldENCaption) ? row.strOriginalFieldENCaption : row.strNewFieldENCaption; OriginalCaptionEn = row.strOriginalFieldENCaption; Caption = string.IsNullOrEmpty(row.strNewFieldCaption) ? row.strOriginalFieldCaption : row.strNewFieldCaption; OriginalCaption = row.strOriginalFieldCaption; IsEmpty = false; IsDataArea = webField.Area == PivotArea.DataArea; }
/// <summary> /// returns cloned field to original state before editing /// </summary> public void CancelChanges(LayoutDetailDataSet ds) { if (m_ClonedField != null) { m_ClonedField.CancelChanges(this, ds); } }
/// <summary> /// flushes changes made in cloned field and set flag HasChanges /// </summary> public void FlashChanges(LayoutDetailDataSet ds) { if (m_ClonedField != null) { m_ClonedField.SaveChanges(this, ds); } }
private LayoutDetailDataSet.LayoutRow GetLayoutRow(LayoutDetailDataSet layoutDataSet) { if (layoutDataSet.Layout.Rows.Count == 0) { throw new ArgumentException("Couldn't get Layout from dataset "); } return((LayoutDetailDataSet.LayoutRow)layoutDataSet.Layout.Rows[0]); }
public static AvrDataTable GetPivotData(LayoutDetailDataSet ds, long queryId, long layoutId, bool useArchiveData, string filter, out bool isNewObject, out string errorMessage) { CachedQueryResult queryResult = ServiceClientHelper.ExecQuery(queryId, useArchiveData, filter); isNewObject = ds.LayoutSearchField.Count == 0; errorMessage = queryResult.ErrorMessage; return(AvrPivotGridHelper.GetPreparedDataSource(ds.LayoutSearchField, queryId, layoutId, queryResult.QueryTable, isNewObject)); }
public WebPivotGridFieldClone GetClonedField(LayoutDetailDataSet ds, bool createNew) { if (m_ClonedField == null || createNew) { m_ClonedField = new WebPivotGridFieldClone(this, ds); } return(m_ClonedField); }
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); }
private static DataSet GetPivotDataSet() { var dataSet = new LayoutDetailDataSet { EnforceConstraints = false }; LayoutDetailDataSet.LayoutRow row = dataSet.Layout.NewLayoutRow(); row.idflLayout = 1; row.idflQuery = 1; row.idfPerson = 1; row.strPivotGridSettings = "xxx"; row.blbPivotGridSettings = BinaryCompressor.ZipString(row.strPivotGridSettings); row.strLayoutName = Guid.NewGuid().ToString(); row.strDefaultLayoutName = Guid.NewGuid().ToString(); dataSet.Layout.AddLayoutRow(row); dataSet.AcceptChanges(); return(dataSet); }
public void SaveChanges(WebPivotGridField webField, LayoutDetailDataSet ds) { if (!Equals(BasicCountFunctionId, webField.BasicCountFunctionId)) { webField.BasicCountFunctionId = BasicCountFunctionId; webField.HasChanges = true; } if (!Equals(AggregateFunctionId, webField.AggregateFunctionId)) { webField.AggregateFunctionId = AggregateFunctionId; webField.HasChanges = true; } if (!Equals(Precision, webField.Precision)) { webField.Precision = Precision; webField.HasChanges = true; } if (!Equals(UnitLayoutSearchFieldId, webField.UnitLayoutSearchFieldId)) { webField.UnitLayoutSearchFieldId = UnitLayoutSearchFieldId; if (UnitLayoutSearchFieldId != -1) { var unitRow = ds.LayoutSearchField.Rows.Find(UnitLayoutSearchFieldId) as LayoutDetailDataSet.LayoutSearchFieldRow; webField.UnitSearchFieldAlias = unitRow == null ? string.Empty : unitRow.strSearchFieldAlias; } webField.HasChanges = true; } if (!Equals(DateLayoutSearchFieldId, webField.DateLayoutSearchFieldId)) { webField.DateLayoutSearchFieldId = DateLayoutSearchFieldId; webField.HasChanges = true; } PivotGroupInterval?interval = null; if (PrivateGroupInterval.HasValue) { interval = GroupIntervalHelper.GetGroupInterval(PrivateGroupInterval.Value); } if (!Equals(interval, webField.PrivateGroupInterval)) { webField.PrivateGroupInterval = interval; webField.HasChanges = true; } if (!Equals(DiapasonStartDate, webField.DiapasonStartDate)) { webField.DiapasonStartDate = DiapasonStartDate; webField.HasChanges = true; } if (!Equals(DiapasonEndDate, webField.DiapasonEndDate)) { webField.DiapasonEndDate = DiapasonEndDate; webField.HasChanges = true; } if (!Equals(AddMissedValues, webField.AddMissedValues)) { webField.AddMissedValues = AddMissedValues; webField.UpdateImageIndex(); webField.HasChanges = true; } LayoutDetailDataSet.LayoutSearchFieldRow row = GetLayoutSearchFieldRowByField(ds, webField); webField.Caption = (ModelUserContext.CurrentLanguage == Localizer.lngEn) ? CaptionEn : Caption; if ( !Equals(string.IsNullOrEmpty(row.strNewFieldENCaption) ? row.strOriginalFieldENCaption : row.strNewFieldENCaption, CaptionEn)) { row.strNewFieldENCaption = CaptionEn; webField.HasChanges = true; } if (ModelUserContext.CurrentLanguage != Localizer.lngEn) { if (!Equals(string.IsNullOrEmpty(row.strNewFieldCaption) ? row.strOriginalFieldCaption : row.strNewFieldCaption, Caption)) { row.strNewFieldCaption = Caption; webField.HasChanges = true; } } }
public void CancelChanges(WebPivotGridField webField, LayoutDetailDataSet ds) { Init(webField, ds); }
private LayoutDetailDataSet.LayoutSearchFieldRow GetLayoutSearchFieldRowByField(LayoutDetailDataSet ds, WebPivotGridField webField) { return(AvrPivotGridHelper.GetLayoutSearchFieldRowByField(webField, ds)); }
public WebPivotGridFieldClone(WebPivotGridField webField, LayoutDetailDataSet ds) { Caption = webField.Caption; Init(webField, ds); }
public LayoutHelper(LayoutDetailDataSet dataSet) { m_DataSet = dataSet; }