private void BtnSeleccionarNotaria_Click(object sender, EventArgs e) { try { FichaNotaria pantallaprincipal2 = Owner as FichaNotaria; pantallaprincipal2.nombrenotaria.Enabled = true; pantallaprincipal2.textoipcentralita.Enabled = true; pantallaprincipal2.ipcentralitainput.Enabled = true; pantallaprincipal2.textomascarared.Enabled = true; pantallaprincipal2.mascararedinput.Enabled = true; pantallaprincipal2.textopuertadeenlace.Enabled = true; pantallaprincipal2.puertadeenlaceinput.Enabled = true; pantallaprincipal2.ippublicapretexto.Enabled = true; pantallaprincipal2.ippublicatexto.Enabled = true; pantallaprincipal2.nombrenotaria.Text = listabusquedanotarias.SelectedItems[0].SubItems[0].Text; pantallaprincipal2.ipcentralitainput.Text = listabusquedanotarias.SelectedItems[0].SubItems[1].Text; pantallaprincipal2.mascararedinput.Text = listabusquedanotarias.SelectedItems[0].SubItems[2].Text; pantallaprincipal2.puertadeenlaceinput.Text = listabusquedanotarias.SelectedItems[0].SubItems[3].Text; pantallaprincipal2.cargarextensiones(); pantallaprincipal2.Show(); this.Close(); } catch (System.ArgumentOutOfRangeException) { MessageBox.Show("No has seleccionado ninguna Notaría", "Advertencia"); this.Close(); } }
private void btnGuardarcambios_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("¿Estás seguro de que quieres añadir este teléfono en la base datos?", "Añadir teléfono en la base de datos", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { try { string fechaact = DateTime.Now.ToString("dd/MM/yy"); string MyConnection2 = "server=datostelefonos.ddnsfree.com; database=datostelefonos; Uid=jlozano ; pwd=raper0_legendari0; port=36970"; MySql.Data.MySqlClient.MySqlConnection MyConn2 = new MySql.Data.MySqlClient.MySqlConnection(MyConnection2); MySql.Data.MySqlClient.MySqlCommand MyCommand2 = new MySql.Data.MySqlClient.MySqlCommand("INSERT INTO telefonos(NomNotaria, Extension, Iptelefono, Alias, Modelo, Nserie, UltActualiz) VALUES('" + textonotaria.Text.ToString() + "', '" + textoextension.Text.ToString() + "', '" + textoip.Text.ToString() + "', '" + textoalias.Text.ToString() + "', ' " + listamodelo.SelectedItem.ToString() + "', '" + textonserie.Text.ToString() + "', '" + fechaact.ToString() + "')", MyConn2); MySql.Data.MySqlClient.MySqlDataReader MyReader2; MyConn2.Open(); MyReader2 = MyCommand2.ExecuteReader(); MessageBox.Show("Teléfono añadido correctamente", "Éxito"); while (MyReader2.Read()) { } MyConn2.Close(); FichaNotaria pantallaprincipal2 = Owner as FichaNotaria; pantallaprincipal2.cargarextensiones(); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }