public static void LoadDatabase(TreeView projectView, ref DataBaseObjectClass aDataObject, ListView lstVwDatabaseTables)
        {
            DataBaseSelection openDatabase = new DataBaseSelection();

            openDatabase.IntitialFolderPath = Application.StartupPath;
            if (openDatabase.ShowDialog() == DialogResult.OK)
            {
                projectView.Nodes[0].Nodes[0].Nodes.Clear();
                DataLogin dataLogin = openDatabase.Connection;
                aDataObject = new DataBaseObjectClass(dataLogin.FromDatabase.DataBaseType);
                aDataObject.Connection(dataLogin.FromDatabase.ServerFile, dataLogin.FromDatabase.DatabaseName, dataLogin.FromDatabase.UserID, dataLogin.FromDatabase.Password, dataLogin.FromDatabase.Integrated);
                DataTable dt = aDataObject.GetSchemaData(SchemaRestrictions.Tables, null);
                lstVwDatabaseTables.Items.Clear();
                if (dt != null)
                {
                    foreach (DataRow aRow in dt.Rows)
                    {
                        lstVwDatabaseTables.Items.Add(aRow["TABLE_NAME"].ToString());
                    }
                    projectView.Nodes[0].Nodes[0].Nodes.Add("Server: " + dataLogin.FromDatabase.ServerFile);
                    projectView.Nodes[0].Nodes[0].Nodes.Add("Database Name: " + dataLogin.FromDatabase.DatabaseName);
                }
                else
                {
                    MessageBox.Show("Restriction not valid");
                }
            }
        }
Exemple #2
0
 public void ApplyDataObject(DataBaseObjectClass aDataObject)
 {
     if (_aDataObject == null || !_aDataObject.Equals(aDataObject))
     {
         _aDataObject   = aDataObject;
         lblDB.Text     = _aDataObject.DatabaseName;
         lblServer.Text = _aDataObject.ServerOrFile;
         TablesAndViewsUI.DataInitialization(_aDataObject);
         ProceduresAndFunctions.DataInitialization(_aDataObject);
         SQLView.DataInitialization(_aDataObject);
     }
 }
        public static void DataInitialization(DataBaseObjectClass aDataObject)
        {
            _aDataObject = aDataObject;
            DataTable dt = singleTon.schemaLoader.LoadSchema(SchemaRestrictions.Tables, null, _aDataObject);

            singleTon.schemaLoader.LoadToSQLEditor(singleTon.chkListTables, dt, SchemaRestrictions.Tables, "TABLE_NAME", "BASE TABLE");
            singleTon.schemaLoader.LoadToSQLEditor(singleTon.chkViews, dt, SchemaRestrictions.Tables, "TABLE_NAME", "VIEW");
            SelectedTables                        = new TableCollection(_aDataObject.GetDatabaseType);
            AllTables                             = new TableCollection(_aDataObject.GetDatabaseType);
            AllTables.UsePrefixes                 = true;
            SelectedTables.UsePrefixes            = true;
            singleTon.searchBar2.SearchableObject = singleTon.chkViews;
            singleTon.searchBar1.SearchableObject = singleTon.chkListTables;
            LoadAllTables();
        }
Exemple #4
0
        private void tsbDbConnect_Click(object sender, EventArgs e)
        {
            DataBaseSelection openDatabase = new DataBaseSelection();

            openDatabase.IntitialFolderPath = Application.StartupPath;

            if (openDatabase.ShowDialog() == DialogResult.OK)
            {
                DataLogin dataLogin = openDatabase.Connection;
                _aDataObject = new DataBaseObjectClass(dataLogin.FromDatabase.DataBaseType);
                _aDataObject.Connection(dataLogin.FromDatabase.ServerFile, dataLogin.FromDatabase.DatabaseName, dataLogin.FromDatabase.UserID, dataLogin.FromDatabase.Password, dataLogin.FromDatabase.Integrated);
                lblDB.Text     = _aDataObject.DatabaseName;
                lblServer.Text = _aDataObject.ServerOrFile;
                TablesAndViewsUI.DataInitialization(_aDataObject);
                ProceduresAndFunctions.DataInitialization(_aDataObject);
                SQLView.DataInitialization(_aDataObject);
            }
        }
        public static List <String> LoadToList(String strSql, String extractField, DataBaseObjectClass aDataObject)
        {
            List <String> result = new List <string>();
            DataTable     dt     = aDataObject.DoSelect(strSql);

            if (dt != null)
            {
                foreach (DataRow aRow in dt.Rows)
                {
                    result.Add(aRow[extractField].ToString());
                }
            }
            else
            {
                MessageBox.Show("Restriction not valid");
            }

            return(result);
        }
        public static List <ForeignKey> LoadToList(String strSql, DataBaseObjectClass aDataObject)
        {
            string[]          fields = new string[] { "Referencing Column", "Referenced Column", "Referenced Table" };
            List <ForeignKey> result = new List <ForeignKey>();
            DataTable         dt     = aDataObject.DoSelect(strSql);

            if (dt != null)
            {
                foreach (DataRow aRow in dt.Rows)
                {
                    result.Add(new ForeignKey(aRow[fields[0]].ToString(), aRow[fields[1]].ToString(), aRow[fields[2]].ToString()));
                }
            }
            else
            {
                MessageBox.Show("Restriction not valid");
            }

            return(result);
        }
Exemple #7
0
 public static void DataInitialization(DataBaseObjectClass aDataObject)
 {
     _aDataObject = aDataObject;
 }
        public static void LoadToSQLEditor(CheckedListBox chckList, SchemaRestrictions restriction, String tableName, String extractField, DataBaseObjectClass aDataObject)
        {
            DataTable dt = aDataObject.GetSchemaData(restriction, tableName);

            chckList.Items.Clear();
            if (dt != null)
            {
                foreach (DataRow aRow in dt.Rows)
                {
                    chckList.Items.Add(aRow[extractField].ToString());
                }
            }
            else
            {
                MessageBox.Show("Restriction not valid");
            }
        }
Exemple #9
0
 public void LoadToSQLEditor(CheckedListBox chckList, SchemaRestrictions restriction, String tableName, String extractField, string tableType, DataBaseObjectClass aDataObject)
 {
     LoadToSQLEditor(chckList, LoadSchema(restriction, tableName, aDataObject), restriction, extractField, tableType);
 }
Exemple #10
0
 public DataTable LoadSchema(SchemaRestrictions restriction, String tableName, DataBaseObjectClass aDataObject)
 {
     return(aDataObject.GetSchemaData(restriction, tableName));
 }
 public static void DataInitialization(DataBaseObjectClass aDataObject)
 {
     _aDataObject = aDataObject;
     singleTon.schemaLoader.LoadToSQLEditor(singleTon.cboProcedures, SchemaRestrictions.Procedures, "ROUTINE_NAME", aDataObject);
     //singleTon.schemaLoader.LoadToSQLEditor(singleTon.cboFunctions, SchemaRestrictions.Functions, "FUNCTION_NAME", aDataObject);
 }
Exemple #12
0
 public static void StartThyme(DataBaseObjectClass aDataObject)
 {
     InsureSingleInstance.DataObject = aDataObject;
     RunApp();
 }
Exemple #13
0
 public UI(DataBaseObjectClass aDataObject) :
     this()
 {
     ApplyDataObject(aDataObject);
 }