//Submit-Button-Click Handler private void Submit_btn_Click(object sender, RoutedEventArgs e) { switch (Functionalitie) { case CRUDFunctionalitie.Add: DatabaseInfo = new DatabaseInfo(0, DataSource_txt.Text, Username_txt.Text, Password_txt.Text, DatabasName_txt.Text); GetDbInfo.AddNewDatabase(DatabaseInfo); this.Close(); break; case CRUDFunctionalitie.Update: if (DatabaseInfo != null) { DatabaseInfo = new DatabaseInfo(0, DataSource_txt.Text, Username_txt.Text, Password_txt.Text, DatabasName_txt.Text); GetDbInfo.UpdateDatabase(DatabaseInfo); this.Close(); } break; case CRUDFunctionalitie.Delete: if (DatabaseInfo != null) { GetDbInfo.DeleteDatabase(DatabaseInfo.ID); this.Close(); } break; } }
//Set Databases to CMB public void DatabasesToCombobox(ComboBox comboBox) { //Clear cmb comboBox.Items.Clear(); List <string> temp = GetDbInfo.GetAllDatabases(); if (temp.Count > 0) { temp.Insert(0, "All Databases"); } else { temp.Add("No Db Found"); } //Add all items foreach (string i in temp) { comboBox.Items.Add(i); } //Set selected item comboBox.SelectedIndex = 0; }
//-------------------------Database------------------------------ //Set Database Tables to CMB public void TablesToCombobox(ComboBox comboBox, string DbName) { comboBox.Items.Clear(); comboBox.Items.Add("All Tables"); foreach (string i in GetDbInfo.GetTableNames(DbName)) { comboBox.Items.Add(i); } comboBox.SelectedIndex = 0; }
//Get database Status public static void Status(StackPanel container) { container.Children.Clear(); foreach (string i in GetDbInfo.GetAllDatabases()) { if (GetDbInfo.CreateDBConnection(i) == null) { StatusItem(i, DBStatus.Error, container); } else { StatusItem(i, DBStatus.Oke, container); } } }
public AppInfo GetApplicationInfo() { var getDbInfo = new GetDbInfo(Client.Ticket, Token, Client.AccountDomain, ApplicationId); var xml = getDbInfo.Post().CreateNavigator(); var dbName = xml.SelectSingleNode("/qdbapi/dbname").Value; var lastRecModTime = long.Parse(xml.SelectSingleNode("/qdbapi/lastRecModTime").Value); var lastModifiedTime = long.Parse(xml.SelectSingleNode("/qdbapi/lastModifiedTime").Value); var createTime = long.Parse(xml.SelectSingleNode("/qdbapi/createdTime").Value); var numRecords = int.Parse(xml.SelectSingleNode("/qdbapi/numRecords").Value); var mgrId = xml.SelectSingleNode("/qdbapi/mgrID").Value; var mgrName = xml.SelectSingleNode("/qdbapi/mgrName").Value; var version = xml.SelectSingleNode("/qdbapi/version").Value; return(new AppInfo(dbName, lastRecModTime, lastModifiedTime, createTime, numRecords, mgrId, mgrName, version)); }
public AppInfo GetApplicationInfo() { var getDbInfo = new GetDbInfo(Client.Ticket, Token, Client.AccountDomain, ApplicationId); var xml = getDbInfo.Post(); var dbName = xml.Element("dbname").Value; var lastRecModTime = long.Parse(xml.Element("lastRecModTime").Value); var lastModifiedTime = long.Parse(xml.Element("lastModifiedTime").Value); var createTime = long.Parse(xml.Element("createdTime").Value); var numRecords = int.Parse(xml.Element("numRecords").Value); var mgrId = xml.Element("mgrID").Value; var mgrName = xml.Element("mgrName").Value; var version = xml.Element("version").Value; return(new AppInfo(dbName, lastRecModTime, lastModifiedTime, createTime, numRecords, mgrId, mgrName, version)); }