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 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; }