public void AtualizarObjeto() { ClientePst cliente; try { if (txt_nome.Text != "" && txt_id.Text != "") { cliente = new ClientePst(); cliente.Id = int.Parse(txt_id.Text); cliente.Nome = txt_nome.Text; cliente.Telefone = txt_telefone.Text; cliente.Debito = txt_debito.Text.Replace(",", "."); con.openCon(cliente.Atualizar()); con.closeCon(); MessageBox.Show("Cliente Atualizado com Sucesso"); DisplayData(cliente.Pesquisar()); } else { MessageBox.Show("Erro! Por favor verifique os valores informados"); } } catch (Exception err) { MessageBox.Show(err.Message + " A tentativa de atualização falhou"); } ClearData(); }
public void PesquisarObjeto() { try { ClientePst cliente = new ClientePst(); if (string.IsNullOrEmpty(txt_id.Text)) { DisplayData(cliente.Pesquisar()); } else { DisplayData(cliente.PesquisarId(int.Parse(txt_id.Text))); if (table.Rows.Count > 0) { txt_nome.Text = table.Rows[0]["nome"].ToString(); txt_telefone.Text = table.Rows[0]["telefone"].ToString(); txt_debito.Text = table.Rows[0]["debito"].ToString(); aux = ""; } else { MessageBox.Show("Cliente com o id " + txt_id.Text + " não existe!"); aux = ""; } } } catch (Exception err) { MessageBox.Show(err.Message + " A tentativa de pesquisa falhou!"); } }
public void ChecarId(string objeto) { ProdutoPst produto = new ProdutoPst(); DisplayData(produto.checar(objeto)); if (table.Rows.Count > 0) { txt_id_produto.Text = table.Rows[0]["id_produto"].ToString(); txt_valor_u.Text = table.Rows[0]["valor"].ToString(); calcularPreco(); EstoquePst estoque = new EstoquePst(); DisplayData(estoque.checar(objeto)); if (table.Rows.Count > 0) { txt_quant_estoque.Text = table.Rows[0]["quantidade_produto"].ToString(); ClientePst cliente = new ClientePst(); DisplayData(cliente.checar(cbb_cliente.Text)); if (table.Rows.Count > 0) { txt_id_cliente.Text = table.Rows[0]["id_cliente"].ToString(); } } PesquisarObjeto(); } }
protected Movimento(DateTime data_Venda, DateTime data_Entrega, ClientePst cliente, FuncionarioPst funcionario, ProdutoPst produto) { Data_Venda = data_Venda; Data_Entrega = data_Entrega; Cliente = cliente; Funcionario = funcionario; Produto = produto; }
public void CadastrarObjeto() { ClientePst cliente; try { if (!string.IsNullOrEmpty(txt_nome.Text)) { if (string.IsNullOrEmpty(txt_debito.Text)) { txt_debito.Text = "0"; } if (string.IsNullOrEmpty(txt_telefone.Text)) { txt_telefone.Text = "0"; } cliente = new ClientePst(); cliente.Nome = txt_nome.Text; cliente.Telefone = txt_telefone.Text; cliente.Debito = txt_debito.Text.Replace(",", "."); //Consultar Objeto Checar(txt_nome.Text); if (table.Rows.Count > 0) { aux = table.Rows[0]["nome"].ToString(); } else { aux = ""; } //Condição para não haver produtos iguais. if (aux == txt_nome.Text) { MessageBox.Show("Erro! O cliente já está cadastrado. "); ClearData(); } else { con.openCon(cliente.Cadastrar()); con.closeCon(); MessageBox.Show("Cliente Inserido com Sucesso"); } } } catch (Exception err) { MessageBox.Show(err.Message + "A tentativa de Cadastro falhou"); } ClearData(); PesquisarObjeto(); }
public void Checar(string objeto) { try { ClientePst cliente = new ClientePst(); DisplayData(cliente.checar(objeto)); } catch (Exception err) { MessageBox.Show(err.Message); } }
public void PesquisarObjeto(string coluna, string objeto) { try { PagamentoPst pagamento = new PagamentoPst(); if (aux == "cliente" || string.IsNullOrEmpty(aux)) { aux = "procurar"; ClientePst cliente = new ClientePst(); DisplayData(cliente.checar(objeto)); if (table.Rows.Count > 0) { if (!string.IsNullOrEmpty(table.Rows[0]["debito"].ToString())) { cbb_cliente.Text = table.Rows[0]["nome"].ToString(); txt_debito.Text = table.Rows[0]["debito"].ToString(); cbb_id_cliente.Text = table.Rows[0]["id_cliente"].ToString(); } else { txt_debito.Text = "0"; } } aux = ""; } else if (aux == "id") { aux = ""; DisplayData(pagamento.Pesquisar(coluna, int.Parse(objeto))); if (table.Rows.Count > 0) { if (!string.IsNullOrEmpty(table.Rows[0]["id_movimento"].ToString())) { cbb_cliente.Text = table.Rows[0]["nome_cliente"].ToString(); cbb_id_cliente.Text = table.Rows[0]["id_cliente"].ToString(); } else { txt_debito.Text = "0"; } } } } catch (Exception err) { MessageBox.Show(err.Message); } }
public void AtualizarObjeto() { if (txt_nome.Text != "" && txt_id.Text != "") { ClientePst cliente = new ClientePst(int.Parse(txt_id.Text), txt_nome.Text, txt_telefone.Text, txt_debito.Text.Replace(",", ".")); con.openCon(cliente.Atualizar()); con.closeCon(); MessageBox.Show("Cliente Atualizado com Sucesso"); DisplayData(cliente.Pesquisar()); ClearData(); } else { MessageBox.Show("Erro! Por favor verifique os valores informados"); } }
public void ChecarId(string objeto) { try { ProdutoPst produto = new ProdutoPst(); DisplayData(produto.checar(objeto)); if (table.Rows.Count > 0) { txt_id_produto.Text = table.Rows[0]["id_produto"].ToString(); txt_valor_u.Text = table.Rows[0]["valor"].ToString(); calcularPreco(); EstoquePst estoque = new EstoquePst(); DisplayData(estoque.checar(objeto)); if (table.Rows.Count > 0) { txt_quant_estoque.Text = table.Rows[0]["quantidade_produto"].ToString(); ClientePst cliente = new ClientePst(); DisplayData(cliente.checar(cbb_cliente.Text)); if (table.Rows.Count > 0) { txt_id_cliente.Text = table.Rows[0]["id_cliente"].ToString(); } } PesquisarObjeto(); } } catch (Exception err) { MessageBox.Show(err.Message + " A tentativa de busca falhou!"); } }
public void Checar(string objeto) { ClientePst cliente = new ClientePst(); DisplayData(cliente.checar(objeto)); }