private void dgvPecasServ_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (txtPesoIni.Text != "" && txtAceleIni.Text != "" && txtPotenciaIni.Text != "" && txtConsumoIni.Text != "" && txtRotMaxIni.Text != "" && txtTorqueIni.Text != "" && txtVeloMaxIni.Text != "") { pecas = pecasDAO.Listar(dgvPecasServ.Rows[e.RowIndex].Cells[0].Value.ToString()); itens.Add(int.Parse(dgvPecasServ.Rows[e.RowIndex].Cells["Codigo"].Value.ToString())); dgvPecasServ.CurrentRow.Cells[0].Style.BackColor = Color.Yellow; foreach (Pecas p in pecas) { dgvCarrinho.Rows.Add(p.Codigo, p.Tipo, p.Fabricante, p.Preco, p.Descricao, txtQuant.Text, p.AddTorque, p.AddPotencia, p.AddPeso); preco += (double.Parse(p.Preco.ToString()) * (double.Parse(txtQuant.Text))); peso += double.Parse(txtPesoIni.Text) + (double.Parse(p.AddPeso.ToString()) * (double.Parse(txtQuant.Text))); potencia += double.Parse(txtPotenciaIni.Text) + (double.Parse(p.AddPotencia.ToString()) * (double.Parse(txtQuant.Text))); torque += double.Parse(txtTorqueIni.Text) + (double.Parse(p.AddTorque.ToString()) * (double.Parse(txtQuant.Text))); } if (dgvCarrinho != null) { txtQuant.Value = 1; consumo = peso * 0.002 + double.Parse(txtConsumoIni.Text); velocidade = potencia * 0.07 + double.Parse(txtVeloMaxIni.Text); aceleracao = double.Parse(txtAceleIni.Text) - (torque * 0.009); lbPesoIni.Text = peso.ToString(); lbPesoIni.Visible = true; lbConsumoIni.Text = consumo.ToString(); lbConsumoIni.Visible = true; lbPotenciaIni.Text = potencia.ToString(); lbPotenciaIni.Visible = true; lbVelocidadeIni.Text = velocidade.ToString(); lbVelocidadeIni.Visible = true; lbTorqueIni.Text = torque.ToString(); lbTorqueIni.Visible = true; lbAceleracaoIni.Text = aceleracao.ToString(); lbAceleracaoIni.Visible = true; /* * txtConsumoFin.Text = consumo.ToString(); * txtPesoFin.Text = peso.ToString(); * txtPotenciaFin.Text = potencia.ToString(); * txtVelocMaxFin.Text = velocidade.ToString(); * txtTorqueFin.Text = torque.ToString(); * txtAceleFin.Text = aceleracao.ToString(); */ rtValor.Text = preco.ToString(); } } else { MessageBox.Show("digite a quantidade."); } }
private void txtBusca_TextChanged(object sender, EventArgs e) { List <Pecas> pecas; pecas = p.Listar(txtBusca.Text); dgvPecas.Rows.Clear(); foreach (Pecas p in pecas) { dgvPecas.Rows.Add(p.Codigo, p.Descricao, p.Preco, p.Fabricante, p.Tipo, p.Compatibilidade, p.AddPeso, p.AddPotencia, p.AddTorque); } }
private void txtPesquisaPecas_TextChanged(object sender, EventArgs e) { PecasDAO pecasDAO = new PecasDAO(); List <Pecas> pecas; pecas = pecasDAO.Listar(txtPesquisaPecas.Text); dgvPecasP.Rows.Clear(); foreach (Pecas p in pecas) { dgvPecasP.Rows.Add(p.Codigo, p.Descricao, p.Preco, p.Fabricante, p.Tipo, p.Compatibilidade, p.AddPeso, p.AddPotencia, p.AddTorque); } }