Beispiel #1
0
        private void btEdit_Click(object sender, EventArgs e)
        {
            if (dgRes.SelectedCells.Count > 0)
            {
                ClassProduto cp = new ClassProduto();
                cp.ReturnProd(Convert.ToInt32(dgRes.SelectedRows[0].Cells[0].Value));
                frmCadastroProduto fp = new frmCadastroProduto();

                fp.txtNome.Text      = cp.NomeProd.ToString();
                fp.txtDataCad.Text   = cp.DataCadProd.ToString();
                fp.txtPreco.Text     = cp.PrecoProd.ToString();
                fp.txtDescricao.Text = cp.DescProd.ToString();
                fp.txtQtde.Text      = cp.QtdeProd.ToString();
                fp.txtCod.Text       = cp.CodProd.ToString();
                fp.UpdatePlat        = cp.CodPlat;
                fp.UpdateCat         = cp.CatProd;

                fp.chkAtivo.Enabled = true;
                if (cp.StatusProd == 1)
                {
                    fp.chkAtivo.Checked = true;
                }
                else
                {
                    fp.chkAtivo.Checked = false;
                }

                fp.btCad.Visible = false;
                fp.btAtt.Visible = true;
                fp.ShowDialog();
                btPesq_Click(this, new EventArgs());
            }
        }
Beispiel #2
0
 private void produtoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms.OfType <frmCadastroProduto>().Count() > 0)
     {
         MessageBox.Show("Este formulário já está aberto!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         frmCadastroProduto objCad = new frmCadastroProduto();
         //objCad.MdiParent = this;
         objCad.Show();
     }
 }