Esempio n. 1
0
        private void btOK_Click(object sender, EventArgs e)
        {       /*  27ago-2014.
                 *      CONFIRMAR DATOS INGRESADOS EN FORMULARIO PARA INGRESAR/ MODIFICAR EN BASE DATOS */
            objCliente.setAtributos(
//                tbId_tarjeta.Text,
                tbNombre.Text,
                tbDomicilio.Text,
                tbCelular.Text,
                tbTelefono.Text,
                tbEmail.Text,
                tbFbk.Text,
                tbDocNumber.Text,
                tbPatente.Text,
                '0', -1
                ); // clsEjecutor -ln.30
            int jl = (this.blExisteCte) ? objCliente.Modificar() : DarAltaTarjeta();

            if (jl == -1)
            {     // Error al intentar ingresar datos a mysql.
                MessageBox.Show(ALERT_EXIST, "ADVERTENCIA",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;     // algo salió mal!
            }
            DialogResult dr = MessageBox.Show(ALERT_OK, "Nuevo Ejecutor insertado",
                                              MessageBoxButtons.OK, MessageBoxIcon.Information);

            if (dr == DialogResult.OK)
            {
                GotoMain();
            }
        }
Esempio n. 2
0
        public int getEjecutor(clsEjecutor objCliente)     // modif. 14/AGO2014
        {
            // Obtiene datos del cliente desde base datos y
            //  llena atributos del objeto objCliente.
            int fbk = -1;

//            clsEjecutor oEjecutor = null;
            try
            {
                // Abrimos la conexión
                if (MySqlCnn.State == ConnectionState.Closed)
                {
                    MySqlCnn.Open();
                }
                // Establecemos cuál será la conexión
                MySqlCmd.Connection  = MySqlCnn;
                MySqlCmd.CommandText = String.Format("SELECT * FROM `usuario` WHERE `id_tarjeta` LIKE '{0}'", objCliente.Id);
                MySqlDataReader rd = MySqlCmd.ExecuteReader();
                while (rd.Read())
                {
                    fbk += 1;
//                    oEjecutor = new clsEjecutor(username);
                    objCliente.setAtributos(
//                        rd.GetString("id_tarjeta"),
                        rd.GetString("nombre"),
                        rd.GetString("domicilio"),
                        rd.GetString("celular"),
                        rd.GetString("telefono"),
                        rd.GetString("email"),
                        rd.GetString("fbk"),
                        rd.GetString("dni"),
                        rd.GetString("patente"),
                        rd.GetChar("blocked"),
                        rd.GetFloat("saldo_actual")
                        );
                    break;
                }
                MySqlCnn.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            return(fbk);
        }