예제 #1
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.CursorVisible   = false;


            //Pass your connection string without Initial Catalog/Database
            string ConnectionString = "Your connection string";

            //Chceck if server connected is MSSQL Server or PostgreSQL
            string serverType = "";

            if (ConnectionString.Contains("Data Source") && ConnectionString.Contains("Integrated Security"))
            {
                serverType = "MSSQL Server";
            }
            else if (ConnectionString.Contains("Server") && ConnectionString.Contains("Port") && ConnectionString.Contains("Uid") && ConnectionString.Contains("Pwd"))
            {
                serverType = "PostgreSQL";
            }

            //Create databaseDialog, tableDialog and tableOptions objects
            DatabaseDialog databaseDialog = new DatabaseDialog(ConnectionString, serverType);
            TableDialog    tableDialog    = new TableDialog(ConnectionString, serverType);
            TableOptions   tableOptions   = new TableOptions(ConnectionString, serverType);

            //Start the databaseDialog
            databaseDialog.Start(tableDialog, tableOptions);
        }
예제 #2
0
        public void Start(DatabaseDialog databaseDialog, int whichDatabase, TableDialog tableDialog, int whichTable)
        {
            //Start the Control() method, and set returned value as option
            int option = Control();

            switch (option)
            {
            case 0:
                //If --Print Table-- is selected print the table
                TablePrinter.Print(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 1:
                //If --Search in table-- is selected, print table only with content matching the search
                TableSearcher.Search(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 2:
                //If --Edit table-- is selected let user select the cell to edit
                TableEditor.SelectCell(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 3:
                //If --Add new row-- is selected start adding new row
                RowAdder.Add(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 4:
                //If --Add new column-- is selected start adding new column
                ColumnAdder.Add(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 5:
                //If --Delete column-- is selected let user select the column to delete
                ColumnDeleter.SelectColumn(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 6:
                //If --Delete row-- is selected let user select the row to delete
                RowDeleter.SelectRow(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 7:
                //If --Delete table-- is selected start deleting currently selected table
                TableDeleter.Delete(ConnectionString, ServerType, databaseDialog, whichDatabase, tableDialog, whichTable, this);
                break;

            case 8:
                //If --Return-- is selected return to the tableDialog
                tableDialog.Start(databaseDialog, whichDatabase, this);
                break;
            }
        }
예제 #3
0
        private void editDataClicked(object sender, RoutedEventArgs e)
        {
            TableDialog tableDialog = new TableDialog();

            tableDialog.ShowDialog();

            if (tableDialog.DialogResult == true)
            {
                actualPolylineData = Model.getInstance().getDataset().getData();
                actualBarData      = Model.getInstance().getDataset().getData();

                createPolylineChart();
                createBarChart();
            }
        }