コード例 #1
0
 private void btnActualizar_Click(object sender, EventArgs e)
 {
     if (actualizarveh == true)
     {
         if ((cmbUbicacion.Text != vUbicacion) || cmbTipoVeh.Text != vTipoVeh || txtPlaca.Text != PlacaVeh || cmbMarca.Text != vMarca || cmbAnio.Text != vAnio || Convert.ToInt32(txtKm.Text) != vKM || txtVersion.Text != vVersion || cmbTipoCombustible.Text != vTpCombustible || Convert.ToInt32(txtPuertas.Text) != vPuertas || cmbTipoTransmision.Text != vTpTransmision || cmbColor.Text != vColorVeh || cmbTipoDireccion.Text != vTipoDireccion || cmbTraccion.Text != vTipoTraccion || Convert.ToInt32(txtCilindraje.Text) != vCilindraje || cmbTipoCarroceria.Text != vTipoCarroceria || txtPrecio.Text != "")
         {
             string    varConsulta  = "UPDATE VEHICULO SET" + " UBICACIONVEH = " + "'" + cmbUbicacion.Text + "', TIPOVEH = '" + cmbTipoVeh.Text + "', PLACAVEH = '" + txtPlaca.Text + "', MARCAVEH = '" + cmbMarca.Text + "', ANIOVEH = '" + cmbAnio.Text + "', KMVEH = " + Convert.ToInt32(txtKm.Text) + ", VERSIONVEH = '" + txtVersion.Text + "', TPCOMBUSTIBLE = '" + cmbTipoCombustible.Text + "', PUERTASVEH = " + Convert.ToInt32(txtPuertas.Text) + ", TPTRANSMISION = '" + cmbTipoTransmision.Text + "', COLORVEH = '" + cmbColor.Text + "', TPDIRECCION = '" + cmbTipoDireccion.Text + "', TRACCION = '" + cmbTraccion.Text + "', CILINDRAJE = " + Convert.ToInt32(txtCilindraje.Text) + ", TPCARROCERIA = '" + cmbTipoCarroceria.Text + "' WHERE DUENIO = '" + CorreoUsuario + "' AND PLACAVEH = '" + PlacaVeh + "'";
             UserModel obUser       = new UserModel();
             int       validUptade  = obUser.Actualizar(varConsulta);
             string    varConsulta2 = "UPDATE PUBLICACION SET" + " PLACAVEH = '" + txtPlaca.Text + "', MARCAVEH = '" + cmbMarca.Text + "', SUBMARCAVEH = '" + txtVersion.Text + "', PRECIO = " + Convert.ToInt32(txtPrecio.Text) + " WHERE UCORREO = '" + CorreoUsuario + "' AND PLACAVEH = '" + PlacaVeh + "'";
             int       validUptade2 = obUser.Actualizar(varConsulta2);
             if (validUptade == 1 && validUptade2 == 1)
             {
                 MessageBox.Show("Datos de la publicacion modificados correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("No se logro modificar la publicacion", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("Sin cambios en la informacion de la publicacion.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("No se ha seleccionado ninguna publicacion.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #2
0
 private void btnModificarUsuario_Click(object sender, EventArgs e)
 {
     if (txtModNombre.Text != nombre || txtModApellido.Text != apellido || txtModTelefono.Text != telefono || txtModContra.Text != clave)
     {
         string    varConsulta = "UPDATE USUARIO SET" + " UNOMBRE = " + "'" + txtModNombre.Text + "', UAPELLIDO = '" + txtModApellido.Text + "', UTELEFONO = '" + txtModTelefono.Text + "', UCLAVE = '" + txtModContra.Text + "' WHERE UCORREO = '" + MailUsuario + "'";
         UserModel obUser      = new UserModel();
         int       validUptade = obUser.Actualizar(varConsulta);
         if (validUptade == 1)
         {
             MessageBox.Show("Datos del usuario modificados correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
         else
         {
             MessageBox.Show("No se logro modificar el usuario", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Sin cambios en la informacion del usuario", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }