示例#1
0
        private void btnCancelar_Click(object sender, EventArgs e)
        {
            frmProduto att = new frmProduto();

            att.Show();
            this.Close();
        }
示例#2
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();
            }
        }