Esempio n. 1
0
 public void ExecuteQuery( )
 {
     try
     {
         var             dataReader = _provider.Accessor.ExecuteQuery(Query);
         ReportViewModel report     = new ReportViewModel(dataReader);
         _manager.ShowDialog(report);
         if (RequireUpdate != null)
         {
             RequireUpdate( );
         }
     }
     catch (OracleException e)
     {
         _provider.ReportError(e.Message);
     }
     catch (InvalidOperationException)
     {
         _provider.ReportError("Invalid query text");
     }
     catch (NullReferenceException)
     {
         _provider.ReportError("Connection error");
     }
 }
Esempio n. 2
0
 public void CommitChanges( )
 {
     try
     {
         _provider.Accessor.UpdateTableContent(_tableName, _table);
     }
     catch (OracleException e)
     {
         _provider.ReportError(e.Message);
     }
 }
Esempio n. 3
0
        public void CommitChanges( )
        {
            List <string> queryList = _created ? CreateTable( ) : AlterTable( );

            try
            {
                foreach (string query in queryList)
                {
                    _provider.Accessor.ExecuteQuery(query).Dispose( );
                }

                TableName = _tableName.ToUpper( );

                MessageBox.Show("Table successfully " + (_created ? "created" : "edited"), "Report", MessageBoxButton.OK, MessageBoxImage.Information);

                _created = false;

                if (TableEdited != null)
                {
                    TableEdited( );
                }
            }
            catch (Exception e)
            {
                _provider.ReportError(e.Message);
            }
        }
Esempio n. 4
0
        public void DeleteTable( )
        {
            if (SelectedItem == null)
            {
                return;
            }

            if (MessageBox.Show("Are you sure you want to delete table " + SelectedItem + '?', "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                try
                {
                    _provider.Accessor.ExecuteQuery("DROP TABLE " + SelectedItem);
                    MessageBox.Show("Table " + SelectedItem + " has been successfully deleted", "Report", MessageBoxButton.OK, MessageBoxImage.Information);
                    SelectedItem = null;
                    Update( );
                }
                catch (OracleException e)
                {
                    _provider.ReportError(e.Message);
                }
            }
        }