private void Reload() { dataGridView1.DataSource = MillasDAO.getRecompensas(); this.textBox2.Text = MillasDAO.getMillas(this.textDNI.Text); UpdateDataGridViewRowColors(); dataGridView1.Enabled = true; }
private void button2_Click(object sender, EventArgs e) { this.errorProvider1.Clear(); dataGridView1.DataSource = MillasDAO.getRecompensas(); dataGridView1.DefaultCellStyle.BackColor = Color.White; dataGridView1.DefaultCellStyle.ForeColor = Color.Black; this.textBox2.Text = ""; this.textDNI.Text = ""; dataGridView1.Enabled = false; }
private void button1_Click(object sender, EventArgs e) { if (validar()) { return; } this.textBox2.Text = MillasDAO.getMillas(this.textDNI.Text); UpdateDataGridViewRowColors(); dataGridView1.Enabled = true; }
private void button1_Click(object sender, EventArgs e) { if (validar()) { return; } List <MillasDTO> listadoMillas = MillasDAO.getListadoMillas(this.textDNI.Text); listadoMillas = (from m in listadoMillas orderby m.Fecha select m).ToList(); dataGridView1.DataSource = listadoMillas; this.textBox2.Text = MillasDAO.getMillas(this.textDNI.Text); UpdateDataGridViewRowColors(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null) { MessageBox.Show("Debe introducir una cantidad a canjear."); return; } //Ignora los clicks que no son sobre los elementos de la columna de botones if (e.RowIndex < 0 || e.ColumnIndex != dataGridView1.Columns.IndexOf(dataGridView1.Columns["Seleccionar"]) || dataGridView1.DataSource == null) { return; } RecompensaDTO Recompensa = (RecompensaDTO)dataGridView1.Rows[e.RowIndex].DataBoundItem; int Cantidad = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[1].Value); if (Cantidad == 0) { MessageBox.Show("La cantidad a canjear debe ser mayor a 0."); return; } if (Recompensa.Stock > 0) { if (Recompensa.Millas * Cantidad < Convert.ToInt32(this.textBox2.Text)) { if (MillasDAO.doCanje(Convert.ToInt32(this.textDNI.Text), Recompensa.Id, Cantidad)) { MessageBox.Show("Canje exitoso, imprima el comprobante y pase a retirar su recompensa por cualquiera de nuestras sucursales."); Reload(); } else { MessageBox.Show("Su canje no se ha efectuado con exito."); } } else { MessageBox.Show("No le alcanzan las millas para lo que intenta canjear."); } } else { MessageBox.Show("No hay stock suficiente del producto seleccionado."); } }
private void ListadoDeRecompensas_Load(object sender, EventArgs e) { dataGridView1.DataSource = MillasDAO.getRecompensas(); dataGridView1.Columns[2].Visible = false; dataGridView1.Enabled = false; }