Ejemplo n.º 1
0
 private void PremiosListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         premioActual = (Premio)((ListView)sender).SelectedItems[0].Tag;
         if (premioActual.puntosNecesarios > cliente.puntos)
         {
             this.CanjearButton.Enabled = false;
         }
         else
         {
             this.CanjearButton.Enabled = true;
         }
     }
     catch (Exception ex) { }
 }
Ejemplo n.º 2
0
        private void btnComprar_Click(object sender, EventArgs e)
        {
            Premio selectedPremio = (Premio)listBoxPremios.SelectedItem;

            if (selectedPremio != null && selectedPremio.puntos <= puntosClientes)
            {
                try
                {
                    repoCanjePuntos.ChangePointsToPremio(UserSession.UserId, selectedPremio.id);
                    puntosClientes           -= selectedPremio.puntos;
                    txtPuntosDisponibles.Text = puntosClientes.ToString();
                    MessageBox.Show("Puntos canjeados correctamente.");
                }
                catch (Exception) {
                    MessageBox.Show(Messages.ERROR_INESPERADO);
                }
            }
            else
            {
                MessageBox.Show("No le alcanzan los puntos para comprar el premio que eligió");
            }
        }