private void Replace_btn_Click(object sender, RoutedEventArgs e) { String folderPath = Show_Project_Path.Content.ToString(); if (folderPath.Equals("")) { MessageBox.Show("Please Select The Project"); return; } List <String> file_list = File_Names_To_replace_connectionString(folderPath); if (file_list.Count == 0) { MessageBox.Show("Please Select Atleast one File Extension"); return; } String serverName = Show_Server_Path.Content.ToString(); String databasename = Show_Database_Path.Content.ToString(); if ((serverName.Equals("")) || (databasename.Equals(""))) { MessageBox.Show("Please Select Both Server And Database"); return; } String Username = usernametextbox.Text.Trim(); String Password = passwordtextbox.Password; String serverValue = ServerOperations.Get_server_value(Show_Server_Path.Content.ToString()); String databaseName = DatabaseOperations.Get_connection_string(serverName, databasename); String replaceBy = serverValue + "\\" + databaseName + "\\" + Username + "\\" + Password; foreach (String file_path in file_list) { CommanOperations.replace_connectingStrInXmlConfig_file(file_path, replaceBy); } String message = "Replace Successfully" + "\n"; message = message + "connection string value : " + "\n"; message = message + replaceBy; MessageBox.Show(message); return; }
private void ServerComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { //int selectedIndex = DatabaseComboBox.SelectedIndex; ComboBox cbx = (ComboBox)sender; string serverName = String.Empty; if (cbx.SelectedValue == null) { serverName = cbx.SelectionBoxItem.ToString(); } else { serverName = cboParser(cbx.SelectedValue.ToString()); } Show_Server_Path.Content = serverName; string serverValue = ServerOperations.Get_server_value(Show_Server_Path.Content.ToString()); //connectionStringLabel connectionStringLabel.Text = CommanOperations.DisplayValueChange(connectionStringLabel.Text.ToString(), serverValue, 1); DatabaseComboBox.Items.Clear(); Show_Database_Path.Content = ""; connectionStringLabel.Text = CommanOperations.DisplayValueChange(connectionStringLabel.Text.ToString(), "", 2); //DatabaseNameLabel.Content = "Database Name : ";// + DatabaseOperations.Get_connection_string(Show_Server_Path.Content.ToString(), Show_Database_Path.Content.ToString()); DatabaseOperations.initializeDatabaseInComboBox(serverName, DatabaseComboBox); var countitem = DatabaseComboBox.Items.Count; if (countitem == 0) { DatabaseComboBox.IsEnabled = false; } else { DatabaseComboBox.IsEnabled = true; } return; }
private void server_database_value_btn_Click(object sender, RoutedEventArgs e) { String Username = usernametextbox.Text.Trim(); String Password = passwordtextbox.Password; String serverValue = ServerOperations.Get_server_value(Show_Server_Path.Content.ToString()); String databaseName = DatabaseOperations.Get_connection_string(Show_Server_Path.Content.ToString(), Show_Database_Path.Content.ToString()); String replaceBy = "Server=" + serverValue + ";Database=" + databaseName + ";User Id=" + Username + ";Password="******";"; /* * Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword; * String message = "Server Value :\n"; * message = message + serverValue + "\n"; * message = message + "Connection String :\n"; * message = message + connectionString; */ MessageBox.Show(replaceBy); return; }
//public ComboBox DatabaseComboBox; /* * private void Select_Project_btn_Click(object sender, RoutedEventArgs e) * { * * System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog(); * System.Windows.Forms.DialogResult result = folderDialog.ShowDialog(); * * if (result == System.Windows.Forms.DialogResult.OK) * { * Show_Project_Path.Content = folderDialog.SelectedPath; //project_path * } * return; * * } */ private void DatabaseComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { //int selectedIndex = DatabaseComboBox.SelectedIndex; ComboBox cbx = (ComboBox)sender; string dbname = String.Empty; if (cbx.SelectedValue == null) { dbname = cbx.SelectionBoxItem.ToString(); } else { dbname = cboParser(cbx.SelectedValue.ToString()); } Show_Database_Path.Content = dbname; string dbvalue = DatabaseOperations.Get_connection_string(Show_Server_Path.Content.ToString(), Show_Database_Path.Content.ToString()); connectionStringLabel.Text = CommanOperations.DisplayValueChange(connectionStringLabel.Text.ToString(), dbvalue, 2); //DatabaseNameLabel.Content = "Database Name : " + DatabaseOperations.Get_connection_string(Show_Server_Path.Content.ToString(), Show_Database_Path.Content.ToString()); ; return; }
private void Add_New_Database_btn_Click(object sender, RoutedEventArgs e) { String dbName = Database_Name_TextBox.Text; String value = Database_Value_TextBox.Text; dbName = dbName.Trim(); value = value.Trim(); String serverName = Show_Server_Path.Content.ToString(); if ((dbName.Equals("")) || (value.Equals(""))) { MessageBox.Show("Please enter both Name name and Value "); return; } if (serverName.Equals("")) { MessageBox.Show("Please First Select The Server"); return; } DatabaseOperations.Add_New_Database(dbName, value, serverName, DatabaseComboBox); Database_Name_TextBox.Text = Database_Value_TextBox.Text = ""; return; }