Exemple #1
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");
     }
 }
Exemple #2
0
        private void Frm_Principal_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult = XtraMessageBox.Show("¿Desea salir de la aplicación?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            if (DialogResult == DialogResult.No)
            {
                e.Cancel = true;
            }
            MSRegistro RegIn          = new MSRegistro();
            Crypto     EncriptarTexto = new Crypto();

            RegIn.SaveSetting("ConexionSQL", "Sking", SkinForm.LookAndFeel.SkinName);
        }
Exemple #3
0
 private void btnProbarConexion_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (txtServer.Text != "" && txtDB.Text != "" && txtLogin.Text != "" && txtPassword.Text != "")
     {
         using (SqlConnection conn = new SqlConnection(String.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", txtServer.Text, txtDB.Text, txtLogin.Text, txtPassword.Text)))
         {
             try
             {
                 conn.Open();
                 XtraMessageBox.Show("Conexion Exitosa DB Principal");
                 MSRegistro RegIn          = new MSRegistro();
                 Crypto     EncriptarTexto = new Crypto();
                 RegIn.SaveSetting("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));
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show("No se pudo Conectar con la Base de Datos Principal: " + ex);
             }
         }
     }
 }