Exemplo n.º 1
0
        /// <summary>
        /// Scans for differences in the specified databases.
        /// </summary>
        /// <param name="databases">The source and destination databases to compare.</param>
        internal DatabaseComparison CompareDatabases(DatabasePair databases)
        {
            // Start web service session
            InitializeServices(databases);

            DatabaseComparison comparison = new DatabaseComparison(databases);

            // Retrieve source tables and notify client
            DataTable sourceTables = _sourceDbService.GetTables().Tables[0];
            foreach(DataRow row in sourceTables.Rows) {
                EventManager.OnSourceTableFound((string)row["TABLE_NAME"]);
            }

            // Retrieve destination tables and perform comparison
            DataTable destinationTables = _destinationDbService.GetTables().Tables[0];
            CompareAllTables(sourceTables, destinationTables, comparison);

            ShutdownServices();

            return comparison;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Verifies the database
        /// </summary>
        private void VerifyDatabase()
        {
            try {
                if(!HasConfiguredDatabases) {
                    MessageBox.Show(this, "No databases have been configured.", "Configuration missing", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return;
                }

                // Just pick the first pair (GUI has no support for multiple database pairs yet...)
                DatabasePair databases = _currentProject.ActiveDeployConfig.DatabaseSettings.Databases[0];

                SetStatusText("Verifying databases...");
                _tabcontrol.SelectedTab = _databasetab;

                ShowProgressDialog("Verifying databases", 0);
                _progressdialog.ItemText = "Scanning tables...";

                LockUI();
                _databaselist.Items.Clear();

                // **** TEST
                //DatabasePair databases = new DatabasePair();
                //databases.Source = new DatabaseDescriptor("Internal", "http://ecdev.stendahls.net/Custom/Admin/DatabaseInfo.asmx");
                //databases.Destination = new DatabaseDescriptor("Internal", "http://localhost/webservices/ServerDatabase/DatabaseInfo.asmx");
                // *********

                _databaseComparison = DeploymentManager.Instance.CompareDatabases(databases);

                //PopulateFileList(_scannedStructure);
                if(_databaseComparison != null)
                    SetStatusText("Verification completed.");
            }
            catch (Exception ex) {
                ShowNonFatalException(ex);
            }
            CloseProgressDialog();
            UnlockUI();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Compares all the supplied table definitions.
        /// </summary>
        /// <param name="sourceTables"></param>
        /// <param name="destinationTables"></param>
        private void CompareAllTables(DataTable sourceTables, DataTable destinationTables, DatabaseComparison comparison)
        {
            // Verify source tables
            foreach(DataRow row in sourceTables.Rows) {
                // Fetch information about source table
                string tabname = (string)row["TABLE_NAME"];
                Debug.WriteLine("Retrieving table information for " + tabname);
                DataSet ds = _sourceDbService.GetTableInfo(tabname);
                TableDescriptor sourceTable = new TableDescriptor(ds);

                // Lookup destination table
                TableComparison tablecomparison;
                DataRow[] desttabs = destinationTables.Select(string.Format("TABLE_NAME='{0}'", tabname));
                if(desttabs.Length > 0) {
                    // Table exists in destination, retrieve more info and compare them
                    ds = _destinationDbService.GetTableInfo(tabname);
                    TableDescriptor destinationTable = new TableDescriptor(ds);
                    FilterMatches(sourceTable, destinationTable);

                    // Create comparison result
                    tablecomparison = new TableComparison(tabname, sourceTable, destinationTable);
                }
                else {
                    // Create comparison result (destination table is missing)
                    tablecomparison = new TableComparison(tabname, sourceTable, null);
                }

                // Add comparison result and fire event
                comparison.TableComparisons.Add(tablecomparison);
                EventManager.OnTableComparisonComplete(tablecomparison);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Resets variables and UI when a project is loaded or created.
 /// </summary>
 private void ResetProjectState()
 {
     _filelist.Items.Clear();
     _fileQueueList.Items.Clear();
     _databaselist.Items.Clear();
     _folderTree.Nodes.Clear();
     _lastUploadTime = DateTime.MinValue;
     _deployStructure = null;
     _scannedDbStructure = null;
     _databaseComparison = null;
 }