private void carregaListaLances() { List <testeRodrigo_LANCES> lLances = new List <testeRodrigo_LANCES>(); lLances = realizaLanceBusiness.getAllLANCES(); string lances = ""; foreach (var item in lLances) { testeRodrigo_PRODUTO p = new testeRodrigo_PRODUTO(); p = cadastraProdutoBusiness.getProdutoByCodigo(Convert.ToInt32(item.ID_PRODUTO)); testeRodrigo_USUARIO u = new testeRodrigo_USUARIO(); u = cadastraUsuarioBusiness.getUsuarioByCodigo(Convert.ToInt32(item.ID_USUARIO)); string tbdoyLance = "<tr> " + " <td>{0}</td> " + " <td>{1}</td> " + " <td>{2}</td> " + " <td>R$ {3}</td> " + " <td>{4}</td> " + " </tr> "; lances += string.Format(tbdoyLance, p.DS_NOME_PRODUTO, p.DS_PRODUTO, u.DS_NOME_USUARIO, item.VL_LANCE_ATUAL, Convert.ToDateTime(item.DT_LANCE.ToString()).ToShortDateString()); } listLances.Text = lances; }
public void adicionarProduto(testeRodrigo_PRODUTO p) { testeRodrigo_PRODUTO pTeste = new testeRodrigo_PRODUTO(); pTeste = getValidaProduto(p.DS_NOME_PRODUTO); if (pTeste == null) { _testeRodrigo_PRODUTORepository.adicionaProduto(p); } else { throw new Exception("Produto já existe"); } }
protected void btnCadastrar_Click(object sender, EventArgs e) { testeRodrigo_PRODUTO p = new testeRodrigo_PRODUTO(); p.DS_NOME_PRODUTO = txtNomeProduto.Text; p.DS_PRODUTO = txtDescricaoProduto.Text; p.VL_LANCE_INICIAL = Convert.ToDecimal(txtLanceInicial.Text); p.DT_INCLUSAO_PRODUTO = DateTime.Now; try { cadastraProdutoBusiness.adicionarProduto(p); Response.Redirect("consultaLances.aspx", true); } catch (Exception ex) { ltErro.Text = $@"<div class='alert alert-danger'>{ex.Message}</div>"; } }
protected void btnPesquisar_Click(object sender, EventArgs e) { List <testeRodrigo_LANCES> lLances = new List <testeRodrigo_LANCES>(); lLances = realizaLanceBusiness.getAllLANCES(); string lances = ""; foreach (var item in lLances) { int?codigoProduto = 0; testeRodrigo_PRODUTO p = new testeRodrigo_PRODUTO(); p = cadastraProdutoBusiness.getProdutoByCodigo(Convert.ToInt32(item.ID_PRODUTO)); testeRodrigo_USUARIO u = new testeRodrigo_USUARIO(); u = cadastraUsuarioBusiness.getUsuarioByCodigo(Convert.ToInt32(item.ID_USUARIO)); if (u.DS_NOME_USUARIO.Contains(searchUsuario.Value) && !string.IsNullOrEmpty(searchUsuario.Value) && codigoProduto != 0) { string tbdoyLance = "<tr> " + " <td>{0}</td> " + " <td>{1}</td> " + " <td>{2}</td> " + " <td>R$ {3}</td> " + " <td>{4}</td> " + " </tr> "; codigoProduto = item.ID_PRODUTO; lances += string.Format(tbdoyLance, p.DS_NOME_PRODUTO, p.DS_PRODUTO, u.DS_NOME_USUARIO, item.VL_LANCE_ATUAL, Convert.ToDateTime(item.DT_LANCE.ToString())); } if (p.DS_NOME_PRODUTO.Contains(searchProduto.Value) && !string.IsNullOrEmpty(searchProduto.Value) && codigoProduto != 0) { string tbdoyLance = "<tr> " + " <td>{0}</td> " + " <td>{1}</td> " + " <td>{2}</td> " + " <td>R$ {3}</td> " + " <td>{4}</td> " + " </tr> "; codigoProduto = item.ID_PRODUTO; lances += string.Format(tbdoyLance, p.DS_NOME_PRODUTO, p.DS_PRODUTO, u.DS_NOME_USUARIO, item.VL_LANCE_ATUAL, Convert.ToDateTime(item.DT_LANCE.ToString())); } else if (codigoProduto == 0) { string tbdoyLance = "<tr> " + " <td>{0}</td> " + " <td>{1}</td> " + " <td>{2}</td> " + " <td>R$ {3}</td> " + " <td>{4}</td> " + " </tr> "; codigoProduto = item.ID_PRODUTO; lances += string.Format(tbdoyLance, p.DS_NOME_PRODUTO, p.DS_PRODUTO, u.DS_NOME_USUARIO, item.VL_LANCE_ATUAL, Convert.ToDateTime(item.DT_LANCE.ToString())); } } listLances.Text = lances; }