Beispiel #1
0
 private void btnGuardarConexionR_Click(object sender, EventArgs e)
 {
     if (txtServerR.Text != "" && txtDBR.Text != "" && txtLoginR.Text != "" && txtPasswordR.Text != "")
     {
         {
             SqlConnection conn = new SqlConnection(string.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", txtServerR.Text, txtDBR.Text, txtLoginR.Text, txtPasswordR.Text));
             try
             {
                 MSRegistro RegIn          = new MSRegistro();
                 Crypto     EncriptarTexto = new Crypto();
                 conn.Open();
                 RegIn.SaveSetting("ConexionSQL", "ServerR", EncriptarTexto.Encriptar(txtServerR.Text));
                 RegIn.SaveSetting("ConexionSQL", "DBaseR", EncriptarTexto.Encriptar(txtDBR.Text));
                 RegIn.SaveSetting("ConexionSQL", "UserR", EncriptarTexto.Encriptar(txtLoginR.Text));
                 RegIn.SaveSetting("ConexionSQL", "PasswordR", EncriptarTexto.Encriptar(txtPasswordR.Text));
                 XtraMessageBox.Show("Se Grabaron los Datos Del Servidor Central Con Exito");
                 this.Close();
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show("Error Descripcion: " + ex);
             }
         }
     }
     else
     {
         XtraMessageBox.Show("Faltan Datos para la Conexion Central");
     }
 }
Beispiel #2
0
 private void btnGuardarConexion_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (txtServer.Text != "" && txtDB.Text != "" && txtLogin.Text != "" && txtPassword.Text != "")
     {
         {
             SqlConnection conn = new SqlConnection("Data Source=" + txtServer.Text + ";Initial Catalog=" + txtDB.Text + ";Persist Security Info=True;User ID=" + txtLogin.Text + ";Password="******"ConexionSQL", "Server", EncriptarTexto.Encriptar(txtServer.Text));
                 RegIn.SaveSetting("ConexionSQL", "DBase", EncriptarTexto.Encriptar(txtDB.Text));
                 RegIn.SaveSetting("ConexionSQL", "User", EncriptarTexto.Encriptar(txtLogin.Text));
                 RegIn.SaveSetting("ConexionSQL", "Password", EncriptarTexto.Encriptar(txtPassword.Text));
                 XtraMessageBox.Show("Se Grabaron los Datos Del Servidor Principal Con Exito");
                 this.Close();
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show("Error Descripcion: " + ex);
             }
         }
     }
     else
     {
         XtraMessageBox.Show("Faltan Datos para la Conexion Principal");
     }
 }
Beispiel #3
0
 private void btnProbarConexionR_Click(object sender, EventArgs e)
 {
     if (txtServerR.Text != "" && txtDBR.Text != "" && txtLoginR.Text != "" && txtPasswordR.Text != "")
     {
         using (SqlConnection conn = new SqlConnection(String.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", txtServerR.Text, txtDBR.Text, txtLoginR.Text, txtPasswordR.Text)))
         {
             try
             {
                 conn.Open();
                 XtraMessageBox.Show("Conexion Exitosa DB Central");
                 MSRegistro RegIn          = new MSRegistro();
                 Crypto     EncriptarTexto = new Crypto();
                 RegIn.SaveSetting("ConexionSQL", "ServerC", EncriptarTexto.Encriptar(txtServerR.Text));
                 RegIn.SaveSetting("ConexionSQL", "DBaseC", EncriptarTexto.Encriptar(txtDBR.Text));
                 RegIn.SaveSetting("ConexionSQL", "UserC", EncriptarTexto.Encriptar(txtLoginR.Text));
                 RegIn.SaveSetting("ConexionSQL", "PasswordC", EncriptarTexto.Encriptar(txtPasswordR.Text));
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show("No se pudo Conectar con la Base de Datos Central: " + ex);
             }
         }
     }
 }