public String BuildDrillThrough(CellInfo cell) { String result = String.Empty; if (cell != null) { //var tuple = new Dictionary<String, MemberInfo>(); //if (cell.ColumnMember != null && cell.ColumnMember != MemberInfo.Empty) //{ // cell.ColumnMember.CollectAncestors(tuple); //} //if (cell.RowMember != null && cell.RowMember != MemberInfo.Empty) //{ // cell.RowMember.CollectAncestors(tuple); //} //var statement = GetMoveAxesStatement(RefreshQuery()); var statement = this.CreateWrappedStatement(); var tuple = cell.GetTuple(); if (statement != null && tuple != null && tuple.Count > 0) { statement.Axes.Clear(); List<MdxExpression> members = new List<MdxExpression>(); foreach(var member in tuple.Values) { var expr = new MdxObjectReferenceExpression(member.UniqueName, member.Caption); members.Add(expr); } statement.Axes.Add(new MdxAxis("0", new MdxTupleExpression(members))); using (MdxDomProvider provider = MdxDomProvider.CreateProvider()) { StringBuilder sb = new StringBuilder(); provider.GenerateMdxFromDom(statement, sb, new MdxGeneratorOptions()); result = sb.ToString(); } if (!String.IsNullOrEmpty(result)) result = String.Format("DRILLTHROUGH {0}", result); } } return result; }
protected virtual void ShowValueCopyDialog(CellInfo cell) { if (m_CSDescr != null && cell != null && cell.IsUpdateable) { // Если в кэше есть изменения, то нужно спросить об их сохранении if (UseChangesCashe && PivotGrid.LocalChanges.Count > 0) { MessageBox.Show(Localization.PivotGrid_SaveCachedChanges, Localization.MessageBox_Warning, MessageBoxButton.OK); return; } IDictionary<String, MemberWrap> slice = new Dictionary<String, MemberWrap>(); IDictionary<String, MemberInfo> tuple = cell.GetTuple(); foreach (String hierarchyUniqueName in tuple.Keys) { slice.Add(hierarchyUniqueName, new MemberWrap(tuple[hierarchyUniqueName])); } ModalDialog dlg = new ModalDialog(); dlg.MinHeight = 300; dlg.MinWidth = 400; dlg.Height = 500; dlg.Width = 600; dlg.Caption = Localization.ValueCopyDialog_Caption; dlg.DialogOk += new EventHandler<DialogResultArgs>(ValueCopyDialog_OkButtonClick); ValueCopyControl CopyControl = new ValueCopyControl(); CopyControl.CubeName = m_CSDescr.CubeName; CopyControl.ConnectionID = m_CSDescr.Connection.ConnectionID; CopyControl.LoadMetaData += new EventHandler(ValueCopyControl_LoadMetaData); CopyControl.GetOlapDataLoader += new EventHandler<GetIDataLoaderArgs>(CopyControl_GetMetadataLoader); CopyControl.LogManager = this.LogManager; CopyControl.Initialize(slice, cell.Value); dlg.Content = CopyControl; ShowDialog(dlg); } }
public void Initialize(CellInfo cell) { m_Cell = cell; List<TupleItem> list = new List<TupleItem>(); if (m_Cell != null) { IDictionary<String, MemberInfo> tuple = m_Cell.GetTuple(); foreach (MemberInfo member in tuple.Values) { list.Add(new TupleItem(member)); } } m_Grid.ItemsSource = list; if (list.Count > 0) m_Grid.SelectedIndex = 0; else m_Grid.SelectedIndex = -1; }