private void btnGuardarConexion_Click(object sender, EventArgs 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="******"B_Elegance", "ConexionSQL", "Server", EncriptarTexto.Encriptar(txtServer.Text));
                 RegIn.SaveSetting("B_Elegance", "ConexionSQL", "DBase", EncriptarTexto.Encriptar(txtDB.Text));
                 RegIn.SaveSetting("B_Elegance", "ConexionSQL", "User", EncriptarTexto.Encriptar(txtLogin.Text));
                 RegIn.SaveSetting("B_Elegance", "ConexionSQL", "Password", EncriptarTexto.Encriptar(txtPassword.Text));
                 RegIn.SaveSetting("B_Elegance", "ConexionSQL", "Sucursal", EncriptarTexto.Encriptar(Convert.ToString(cmbSucursal.SelectedValue)));
                 RegIn.SaveSetting("B_Elegance", "ConexionSQL", "Caja", EncriptarTexto.Encriptar(Convert.ToString(cbCajas.SelectedValue)));
                 MessageBox.Show("Se Grabaron los Datos Del Servidor Principal Con Exito");
                 Application.Restart();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Error Descripcion: " + ex);
             }
         }
     }
     else
     {
         MessageBox.Show("Faltan Datos para la Conexion Principal");
     }
 }
        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();
                        MessageBox.Show("Conexion Exitosa DB Principal");
                        MSRegistro RegIn = new MSRegistro();
                        Crypto EncriptarTexto = new Crypto();
                        RegIn.SaveSetting("AvoTrace", "ConexionSQL", "Server", EncriptarTexto.Encriptar(txtServer.Text));
                        RegIn.SaveSetting("AvoTrace", "ConexionSQL", "DBase", EncriptarTexto.Encriptar(txtDB.Text));
                        RegIn.SaveSetting("AvoTrace", "ConexionSQL", "User", EncriptarTexto.Encriptar(txtLogin.Text));
                        RegIn.SaveSetting("AvoTrace", "ConexionSQL", "Password", EncriptarTexto.Encriptar(txtPassword.Text));
                        Cargar_Sucursales();
                        Cargar_Cajas();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("No se pudo Conectar con la Base de Datos Principal: " + ex);
                    }
                }

            }
        }