Exemple #1
0
        private void btnProtegeCNX_Click(object sender, EventArgs e)
        {
            if (txtCadenaConexion.TextLength > 0)
            {
                CLS.Utilities objCnx = new CLS.Utilities();
                objCnx.ProtectConnectionString();
            }

            /*
             * try
             * {
             *  //Se abre el app.config para recuperar la seccion ConnectionStrings
             *  Configuration MiAppConfig = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
             *  //Se recupera la seccion ConnectionStrings
             *  ConnectionStringsSection MiSeccion = (ConnectionStringsSection)(MiAppConfig.GetSection("connectionStrings"));
             *  //Se protege la seccion, caso contrario se desprotege
             *  if (MiSeccion.SectionInformation.IsProtected)
             *      MiSeccion.SectionInformation.UnprotectSection();
             *  else
             *      MiSeccion.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
             *  //Se guarda los cambios
             *  MiAppConfig.Save();
             *  if (MiSeccion.SectionInformation.IsProtected)
             *      MessageBox.Show("Cadena de Conexion Protegida");
             *  else
             *      MessageBox.Show("No esta protegida");
             *
             * }catch (Exception ex){
             *  MessageBox.Show(ex.Message);
             * }
             */
        }
Exemple #2
0
        private void btnRestaurar_Click(object sender, EventArgs e)
        {
            CLS.Utilities objConx          = new CLS.Utilities();
            string        ConnectionString = objConx.GetConnectionString();

            ConnectionString += ";convertzerodatetime=true;";

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter = "SQL Script|*.sql";
            openFileDialog1.Title  = "Open Script File";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                dumpFile = openFileDialog1.FileName;

                // Reset variables
                curBytes   = 0;
                totalBytes = 0;
                cancel     = false;
                // Initialize MySqlConnection and MySqlCommand components
                conn           = new MySqlConnection(ConnectionString);
                cmd            = new MySqlCommand();
                cmd.Connection = conn;
                conn.Open();
                // Start the Timer here
                timer1.Start();
                mb.ImportInfo.IntervalForProgressReport = (int)nmImInterval.Value;
                mb.Command = cmd;
                bwImport.RunWorkerAsync();
            }
        }
Exemple #3
0
        private void btnBackup_Click(object sender, EventArgs e)
        {
            //Sin Usarse porque estan por separados los módulos de respaldo y restauración.
            DateTime       Hoy             = DateTime.Now; //antes DateTime Hoy = DateTime.today;
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter = "SQL Script|*.sql";
            saveFileDialog1.Title  = "Save as Script File";
            DBM.CLS.Utilities config = new CLS.Utilities();

            saveFileDialog1.FileName = config.GetMySQL_DatabaseName() + " Date " + Hoy.ToString("dd-MM-yyyy HH.mm") + ".sql";

            CLS.Utilities objConx          = new CLS.Utilities();
            string        ConnectionString = objConx.GetConnectionString();

            ConnectionString += ";charset=utf8;convertzerodatetime=true;";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                dumpFile = saveFileDialog1.FileName;
                // Reset variables
                curTable    = 0;
                totalTables = 0;
                cancel      = false;
                // Initialize MySqlConnection and MySqlCommand components
                conn           = new MySqlConnection(ConnectionString);
                cmd            = new MySqlCommand();
                cmd.Connection = conn;
                conn.Open();
                // Start the Timer here
                timer2.Start();
                mb.ExportInfo.IntervalForProgressReport = (int)nmImInterval.Value;
                mb.Command = cmd;
                bwExport.RunWorkerAsync();
            }
        }
Exemple #4
0
 private void btnDesProtegeCNX_Click(object sender, EventArgs e)
 {
     if (txtCadenaConexion.TextLength > 0)
     {
         CLS.Utilities objCnx = new CLS.Utilities();
         objCnx.UnprotectConnectionString();
     }
 }
Exemple #5
0
 private void btnCambiaCNX_Click(object sender, EventArgs e)
 {
     if (txtCadenaConexion.TextLength > 0)
     {
         CLS.Utilities objCnx = new CLS.Utilities();
         objCnx.SaveConnectionString(txtCadenaConexion.Text);
     }
 }
 private void ConnectionSettings_Load(object sender, EventArgs e)
 {
     CLS.Utilities objCnx = new CLS.Utilities();
     txtServer.Text = objCnx.GetMySQL_ServerName();
     txtPort.Text   = objCnx.GetMySQL_Port().ToString();
     txtBD.Text     = objCnx.GetMySQL_DatabaseName();
     txtUser.Text   = objCnx.GetMySQL_UserName();
     txtPass.Text   = objCnx.GetMySQL_Password();
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            CLS.Connection cnxValidate = new CLS.Connection();

            CLS.Utilities objConx   = new CLS.Utilities();
            string        newString = null;

            newString = objConx.SetConnectionStringComplete(txtServer.Text, uint.Parse(txtPort.Text), txtBD.Text, txtUser.Text, txtPass.Text);
            if (chkVerify.Checked)
            {
                if (cnxValidate.ValidarConexion(newString))
                {
                    MessageBox.Show("Conexión exitosa", "ConnectionSettings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (newString != null)
                    {
                        objConx.SaveConnectionString(newString);
                        objConx.ProtectConnectionString();

                        DBM.CLS.QUERY Query_ = new DBM.CLS.QUERY();
                        Query_.GetColumnWidth("pedido", "listo");
                        if (Query_.GetColumnWidth("pedido", "listo")["COLUMN_TYPE"].ToString().Trim() == "tinyint(1)")
                        {
                            DBM.CLS.Transaccion Trans = new DBM.CLS.Transaccion();
                            string query = "";
                            query = "ALTER TABLE `pedido` CHANGE `listo` `listo` TINYINT(2) NULL DEFAULT NULL;";

                            if (Trans.CreateTransaction(query))
                            {
                                MessageBox.Show("El campo LISTO ahora tiene un ancho de 2 ", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("No se pudo establecer la conexión con el servidor." + saltoLinea + "Para guardar los datos sin comprobar la conexión desactive la casilla de verificación", "ConnectionSettings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                if (newString != null)
                {
                    objConx.SaveConnectionString(newString);
                    objConx.ProtectConnectionString();
                }
            }
        }
Exemple #8
0
 private void btnObtieneCNX_Click(object sender, EventArgs e)
 {
     CLS.Utilities objCnx = new CLS.Utilities();
     txtCadenaConexion.Text = objCnx.GetConnectionString();
 }