public ADOTabularDatabase(ADOTabularConnection adoTabConn, string databaseName, string databaseId, DateTime lastUpdate)
 {
     _adoTabConn = adoTabConn;
     _databaseName = databaseName;
     _databaseId = databaseId;
     _lastUpdate = lastUpdate;
 }
 public MetadataPaneViewModel(ADOTabularConnection connection, IEventAggregator eventAggregator, DocumentViewModel document)
     : base(connection,eventAggregator)
 {
     _activeDocument = document;
     _activeDocument.PropertyChanged += ActiveDocumentPropertyChanged;
     NotifyOfPropertyChange(() => ActiveDocument);
 }
Example #3
0
 public ADOTabularModel(ADOTabularConnection adoTabConn, DataRow dr)
 {
     _adoTabConn = adoTabConn;
     Name = dr["CUBE_NAME"].ToString();
     Caption = dr["CUBE_CAPTION"].ToString();
     Description = dr["DESCRIPTION"].ToString();
     BaseModelName = dr["BASE_CUBE_NAME"].ToString();
 }
Example #4
0
 public ADOTabularModel(ADOTabularConnection adoTabConn, string name, string caption, string description, string baseModelName)
 {
     _adoTabConn = adoTabConn;
     Name = name;
     Caption = caption;
     Description = description;
     BaseModelName = baseModelName;
 }
Example #5
0
 // todo - implement operations queue
 //private Queue<TraceOperation> operationQueue;
 //private readonly Dictionary<TraceEventClass, TraceEvent> _traceEvents;
 public QueryTrace(ADOTabularConnection connection, DocumentViewModel document)
 {
     _server = new Server();
     _server.Connect(connection.ConnectionString);
     _connection = connection;
     Status = QueryTraceStatus.Stopped;
     // new Dictionary<TraceEventClass, TraceEvent>();
     _currentDocumentReference = new WeakReference(document);
 }
Example #6
0
 public UpdateConnectionEvent(ADOTabular.ADOTabularConnection connection) //, bool isPowerPivotConnection)
 {
     Connection   = connection;
     DatabaseName = string.Empty;
     if (Connection != null)
     {
         DatabaseName = connection.State == System.Data.ConnectionState.Open ?  connection.Database.Name : string.Empty;
         //IsPowerPivotConnection = isPowerPivotConnection;
     }
 }
Example #7
0
 /* public ADOTabularTable(ADOTabularConnection adoTabConn, DataRow dr, ADOTabularModel model)
 {
     Caption = dr["DIMENSION_NAME"].ToString();
     IsVisible = bool.Parse(dr["DIMENSION_IS_VISIBLE"].ToString());
     Description = dr["DESCRIPTION"].ToString();
     _adoTabConn = adoTabConn;
     _model = model;
 }
 */
 public ADOTabularTable(ADOTabularConnection adoTabConn, string internalReference, string name, string caption, string description, bool isVisible)
 {
     _adoTabConn = adoTabConn;
     InternalReference = internalReference;
     Name = name ?? internalReference;
     Caption = caption ?? name ?? internalReference;
     DaxName = GetDaxName();
     Description = description;
     IsVisible = isVisible;
 }
Example #8
0
        public void TestADOTabularCSDLVisitor()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test", "Test Description", "");
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\csdl.xml");
            var tabs = new ADOTabularTableCollection(c,m);

            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(4, tabs.Count);
            Assert.AreEqual(8, tabs["Sales"].Columns.Count());
        }
 public UpdateConnectionEvent(ADOTabular.ADOTabularConnection connection) //, bool isPowerPivotConnection)
 {
     Connection   = connection;
     DatabaseName = string.Empty;
     try
     {
         if (Connection != null)
         {
             DatabaseName = connection.State == System.Data.ConnectionState.Open ? connection.Database.Name : string.Empty;
             //IsPowerPivotConnection = isPowerPivotConnection;
         }
     }
     catch {
         // swallow any exceptions if there is a problem getting the database name
     }
 }
Example #10
0
        public void TestCSDLTablesWithSpaces()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test Caption", "Test Description", "");
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\advwrkscsdl.xml");
            var tabs = new ADOTabularTableCollection(c, m);
            v.GenerateTablesFromXmlReader(tabs, xr);
            var cmpyTab = tabs["Sales Quota"];

            Assert.AreEqual("Sales Quota", cmpyTab.Caption, "Table Name is translated");
        }
 public void Connect()
 {
     try
     {
         var vw = (Window)this.GetView();
         vw.Visibility = Visibility.Hidden;
         using (var c = new ADOTabularConnection(ConnectionString, AdomdType.AnalysisServices))
         {
             c.Open();
         }
         if (ServerModeSelected)
         {
             RegistryHelper.SaveServerMRUListToRegistry(DataSource, RecentServers);
         }
         _eventAggregator.PublishOnUIThread(new ConnectEvent(ConnectionString, PowerPivotModeSelected, WorkbookName, GetApplicationName(ConnectionType)));
     }
     catch (Exception ex)
     {
         _activeDocument.OutputError(String.Format("Could not connect to '{0}': {1}", PowerPivotModeSelected?"Power Pivot model":DataSource, ex.Message));
         _eventAggregator.PublishOnUIThread(new CancelConnectEvent());
     }
     finally
     {
         SelectedServerSetFocus = false;
         TryClose(true);
     }
 }
Example #12
0
 public ADOTabularFunctionGroup(string caption, ADOTabularConnection connection)
 {
     Caption     = caption;
     _connection = connection;
     Functions   = new ADOTabularFunctionCollection(_connection);
 }
 public MetaDataVisitorADOMD(ADOTabularConnection conn)
 {
     _conn = conn;
 }
Example #14
0
 public DmvPaneViewModel(ADOTabularConnection connection, IEventAggregator eventAggregator)
     : base(connection, eventAggregator)
 {
 }
 private SortedSet<string> CopyDatabaseList(ADOTabularConnection cnn)
 {
     var ss = new SortedSet<string>();
     foreach (var dbname in cnn.Databases)
     { ss.Add(dbname); }
     return ss;
 }
 public ADOTabularDatabaseCollection(ADOTabularConnection adoTabConn)
 {
     _adoTabConn = adoTabConn;
 }
Example #17
0
        public void TestADOTabularCSDLVisitorKPI()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\AdvWrks.xml");
            ADOTabularModel m = new ADOTabularModel(c, "Test", "Test Caption","Test Description", "");
            var tabs = new ADOTabularTableCollection(c, m);
            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(15, tabs.Count);
            Assert.AreEqual(24, tabs["Sales Territory"].Columns.Count());
            Assert.AreEqual(1, tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).Count());
            var k = tabs["Sales Territory"].Columns["Total Current Quarter Sales Performance"] as ADOTabularKpi;
            Assert.AreEqual("Total Current Quarter Sales Performance", k.Caption);
            Assert.AreEqual("_Total Current Quarter Sales Performance Goal", k.Goal.Caption);
            Assert.AreEqual("_Total Current Quarter Sales Performance Status", k.Status.Caption);
        }
Example #18
0
 public UpdateConnectionEvent(ADOTabular.ADOTabularConnection connection, string databaseName)//, bool isPowerPivotConnection)
 {
     Connection   = connection;
     DatabaseName = databaseName;
     //    IsPowerPivotConnection = isPowerPivotConnection;
 }
 public ToolPaneBaseViewModel(ADOTabularConnection connection, IEventAggregator eventAggregator)
 {
     PropertyChanged += OnPropertyChanged;
     Connection = connection;
     EventAggregator = eventAggregator;
 }
Example #20
0
 public ADOTabularFunctionCollection(ADOTabularConnection adoTabConn)
 {
     _adoTabConn = adoTabConn;
     _functions  = new SortedDictionary <string, ADOTabularFunction>();
 }
 public UpdateConnectionEvent(ADOTabular.ADOTabularConnection connection) //, bool isPowerPivotConnection)
 {
     Connection = connection;
 }
 public MetaDataVisitorADOMD(ADOTabularConnection conn)
 {
     _conn = conn;
 }
Example #23
0
 public ADOTabularModelCollection(ADOTabularConnection adoTabConn, ADOTabularDatabase database)
 {
     _adoTabConn = adoTabConn;
     _database   = database;
     //_models = _adoTabConn.Visitor.Visit(this);
 }
 public ConnectionChangedEvent(ADOTabularConnection connection)
 {
     Connection = connection;
 }
 public ADOTabularFunctionGroup(string caption, ADOTabularConnection connection)
 {
     Caption = caption;
     _connection = connection;
     Functions = new ADOTabularFunctionCollection(_connection);
 }
Example #26
0
 public UpdateConnectionEvent(ADOTabular.ADOTabularConnection connection) //, bool isPowerPivotConnection)
 {
     Connection   = connection;
     DatabaseName = connection == null?string.Empty:connection.Database.Name;
     //IsPowerPivotConnection = isPowerPivotConnection;
 }
        private void btnConnectClick(object sender, RoutedEventArgs e)
        {
            var conDialog = new wpf_testing.ConnectionDialog();//Application.ActiveWorkbook, _conn.ConnectionString, _xlHelper);
            var vm = new ConnectionViewModel(_conn, "No Workbook Selected");
            conDialog.DataContext = vm;
            var dialogRes = conDialog.ShowDialog();
            if (!(conDialog.DialogResult.HasValue && conDialog.DialogResult.Value)) return;

                    RegistryHelper.SaveServerListToRegistry(vm.DataSource,vm.RecentServers);
                    _conn = vm.Connection;
            _conn.ShowHiddenObjects = true;
            RefreshDatabaseList();
        }
Example #28
0
 public void TestColumnRenaming()
 {
     ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
     var dt = new DataTable();
     dt.Columns.Add("table1[Column1]");
     dt.Columns.Add("table2[Column1]");
     dt.Columns.Add("table1[Column2]");
     dt.Columns.Add("table2[Column3]");
     ADOTabularConnection.FixColumnNaming(dt);
     Assert.AreEqual("table1[Column1]", dt.Columns[0].ColumnName );
     Assert.AreEqual("table2[Column1]",dt.Columns[1].ColumnName );
     Assert.AreEqual("Column2", dt.Columns[2].ColumnName);
     Assert.AreEqual("Column3", dt.Columns[3].ColumnName);
 }
 ///////////////////////////////////////////////
 private void DaxStudioWindowLoaded(object sender, RoutedEventArgs e)
 {
     var wb = _app.ActiveWorkbook;
     if (_xlHelper.HasPowerPivotData())
     {
         // if current workbook has PowerPivot data ensure it is loaded into memory
         _xlHelper.EnsurePowerPivotDataIsLoaded();
         _conn = new ADOTabularConnection(BuildPowerPivotConnection(), AdomdType.Excel, true);
         RefreshDatabaseList();
         //RefreshTabularMetadata();
     }
     else
     {
         var connDialog = new ConnectionDialog(wb, "", _xlHelper);
         if (connDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             _conn = new ADOTabularConnection(connDialog.ConnectionString, AdomdType.AnalysisServices, true);
             RefreshDatabaseList();
             //cboDatabase.SelectedIndex = 0;
             //RefreshTabularMetadata();
         }
     }
 }
Example #30
0
 public void TestDatabaseParser()
 {
     ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
     var dd = c.Databases.GetDatabaseDictionary(c.SPID);
     Assert.AreEqual(c.Databases.Count, dd.Count, "has 2 databases");
 }
 public FunctionPaneViewModel(ADOTabularConnection connection, IEventAggregator eventAggregator)
     : base(connection, eventAggregator)
 {
     Connection = connection;
     EventAggregator = eventAggregator;
 }
Example #32
0
        public void TestADOTabularCSDLVisitorHierarchies()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\AdvWrks.xml");
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test", "Test Description", "");
            var tabs = new ADOTabularTableCollection(c,m);
            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(15, tabs.Count);
            Assert.AreEqual(24, tabs["Sales Territory"].Columns.Count());
            Assert.AreEqual(1, tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).Count());
            var h = (ADOTabularHierarchy) (tabs["Sales Territory"].Columns.Where((t) => t.ColumnType == ADOTabularColumnType.Hierarchy).First());
            Assert.AreEqual(3, h.Levels.Count);
            Assert.AreEqual("Group", h.Levels[0].LevelName);
            Assert.AreEqual("Country", h.Levels[1].LevelName);
            Assert.AreEqual("Region", h.Levels[2].LevelName);
        }
Example #33
0
 public ADOTabularTableCollection(ADOTabularConnection adoTabConn, ADOTabularModel model)
 {
     _adoTabConn = adoTabConn;
     _model      = model;
 }