Exemplo n.º 1
0
        private void produtoDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string codd;

            codd = produtoDataGridView.CurrentRow.Cells[0].Value.ToString();
            if (codd == "")
            {
                MessageBox.Show("Insira um valor no código!");
            }
            else
            {
                ProdutoTableAdapter taProduto = new ProdutoTableAdapter();
                DataTable           dtProduto;
                dtProduto = taProduto.PesquisaProduto(int.Parse(codd));
                if (dtProduto.Rows.Count == 0)
                {
                    MessageBox.Show("Produto Não Cadastrado");
                }
                else
                {
                    int cod;
                    cod = int.Parse(codd);
                    frmProdutoConsulta consulta = new frmProdutoConsulta();
                    consulta.Propriedades = codd;
                    consulta.Show();
                    this.Close();
                }
                Limpar_Caixa();
            }
        }
Exemplo n.º 2
0
        private void frmProdutoConsulta_Load(object sender, EventArgs e)
        {
            txtCod.Enabled = false;


            if (!this.Propriedades.Equals(""))
            {
                txtCod.Text = this.Propriedades;
            }
            ProdutoTableAdapter taProduto = new ProdutoTableAdapter();
            DataTable           dtProduto;

            dtProduto = taProduto.PesquisaProduto(int.Parse(txtCod.Text));

            txtCodBarras.Text  = dtProduto.Rows[0]["CodigoBarra_Produto"].ToString();
            txtDesc.Text       = dtProduto.Rows[0]["Descricao_Produto"].ToString();
            txtQuantidade.Text = dtProduto.Rows[0]["Quantidade_Produto"].ToString();
            txtTipo.Text       = dtProduto.Rows[0]["Tipo_Produto"].ToString();
            txtEmbalagem.Text  = dtProduto.Rows[0]["Embalagem_Produto"].ToString();
            txtPreco.Text      = dtProduto.Rows[0]["Preco_Produto"].ToString();
            txtMarca.Text      = dtProduto.Rows[0]["Marca_Produto"].ToString();
            txtFoto.Text       = dtProduto.Rows[0]["Foto_Produto"].ToString();
            if (txtFoto.Text == "")
            {
            }
            else
            {
                pictureBox1.ImageLocation = txtFoto.Text;
                pictureBox1.Load();
            }
        }
Exemplo n.º 3
0
        private void btnConsultar_Click(object sender, EventArgs e)
        {
            if (txtCod.Text == "")
            {
                MessageBox.Show("Insira um valor no código!");
            }
            else
            {
                ProdutoTableAdapter taProduto = new ProdutoTableAdapter();
                DataTable           dtProduto;
                dtProduto = taProduto.PesquisaProduto(int.Parse(txtCod.Text));
                if (dtProduto.Rows.Count == 0)
                {
                    MessageBox.Show("Produto Não Cadastrado");
                }
                else
                {
                    int cod;
                    cod = int.Parse(txtCod.Text);
                    frmProdutoConsulta consulta = new frmProdutoConsulta();
                    consulta.Propriedades = txtCod.Text;
                    consulta.Show();
                    this.Close();
                    //txtCodBarras.Text = dtProduto.Rows[0]["CodigoBarra_Produto"].ToString();
                    //txtDesc.Text = dtProduto.Rows[0]["Descricao_Produto"].ToString();
                    //txtQuantidade.Text = dtProduto.Rows[0]["Quantidade_Produto"].ToString();
                    //txtTipo.Text = dtProduto.Rows[0]["Tipo_Produto"].ToString();
                    //txtEmbalagem.Text = dtProduto.Rows[0]["Embalagem_Produto"].ToString();
                    //txtPreco.Text = dtProduto.Rows[0]["Preco_Produto"].ToString();
                    //txtMarca.Text = dtProduto.Rows[0]["Marca_Produto"].ToString();
                    //txtFoto.Text = dtProduto.Rows[0]["Foto_Produto"].ToString();
                    //pictureBox1.ImageLocation = txtFoto.Text;
                    //pictureBox1.Load();

                    //btnConsultar.Text = "Atualizar Produto";
                }
                //}
                //else//gravar
                //{
                //    ProdutoTableAdapter taPessoa = new ProdutoTableAdapter();
                //    taPessoa.Update2(int.Parse(txtCodBarras.Text), txtDesc.Text, txtMarca.Text,txtEmbalagem.Text, txtTipo.Text,int.Parse(txtQuantidade.Text),  int.Parse(txtPreco.Text), txtFoto.Text,int.Parse(txtCod.Text));
                //    btnConsultar.Text = "Consultar";
                //    MessageBox.Show("Produto Atualizado com sucesso!");
                //    Limpar_Caixa();
            }
        }
Exemplo n.º 4
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            ProdutoTableAdapter taProduto = new ProdutoTableAdapter();
            DataTable           dtProduto;

            dtProduto = taProduto.PesquisaProduto(int.Parse(txtCod.Text));
            if (dtProduto.Rows.Count == 0)
            {
                MessageBox.Show("Pessosa Não Cadastrada");
            }
            else
            {
                txtCodBarras.Text  = dtProduto.Rows[0]["CodigoBarra_Produto"].ToString();
                txtDesc.Text       = dtProduto.Rows[0]["Descricao_Produto"].ToString();
                txtQuantidade.Text = dtProduto.Rows[0]["Quantidade_Produto"].ToString();
                txtTipo.Text       = dtProduto.Rows[0]["Tipo_Produto"].ToString();
                txtEmbalagem.Text  = dtProduto.Rows[0]["Embalagem_Produto"].ToString();
                txtPreco.Text      = dtProduto.Rows[0]["Preco_Produto"].ToString();
                txtMarca.Text      = dtProduto.Rows[0]["Marca_Produto"].ToString();
                txtFoto.Text       = dtProduto.Rows[0]["Foto_Produto"].ToString();
                if (pictureBox1.ImageLocation == null)
                {
                }
                else
                {
                    pictureBox1.ImageLocation = txtFoto.Text;
                    pictureBox1.Load();
                }
                if (MessageBox.Show("Deseja Excluir?", "Confirma", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    taProduto.Delete2(int.Parse(txtCod.Text));
                }
                txtCod.Focus();
                if (DialogResult == DialogResult.Yes)
                {
                    MessageBox.Show("Produto Excluido");
                }
                frmProduto att = new frmProduto();
                att.Show();
                this.Close();
            }
        }