private void btCadCat_Click(object sender, EventArgs e)
        {
            if (txtNomeCat.Text != "")
            {
                ClassConexao   cCon = new ClassConexao();
                ClassCategoria cCat = new ClassCategoria();

                cCat.NomeCategoria      = txtNomeCat.Text;
                cCat.DescricaoCategoria = txtDescCat.Text;

                int aux = cCat.CadastrarCategoria();

                if (aux != 0)
                {
                    MessageBox.Show("A Categoria '" + cCat.NomeCategoria + "' foi Cadastrada com Sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else
                {
                    MessageBox.Show("Erro ao Realizar Cadastro!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void frmCadastroProduto_Load(object sender, EventArgs e)
        {
            ClassPlataforma cPlat = new ClassPlataforma();

            CbPlat.DataSource    = cPlat.SearchPlat();
            CbPlat.DisplayMember = "Plataforma";
            CbPlat.ValueMember   = "CodPlat";
            CbPlat.SelectedValue = UpdatePlat;

            ClassCategoria CCat = new ClassCategoria();

            CbCat.DataSource    = CCat.CbCat();
            CbCat.DisplayMember = "Nome";
            CbCat.ValueMember   = "CodCategoria";
            CbCat.SelectedValue = UpdateCat;
        }
Exemplo n.º 3
0
        private void cbTipo_SelectedIndexChanged(object sender, EventArgs e)
        {
            gbStatus.Enabled = false;
            gbVal.Enabled    = false;
            txtPes.Enabled   = false;
            txtVfi.Enabled   = false;
            txtVin.Enabled   = false;
            cbCat.Enabled    = false;
            cbPlat.Enabled   = false;

            if (cbTipo.SelectedIndex == 0)
            {
                gbStatus.Enabled = true;
            }
            if (cbTipo.SelectedIndex == 1)
            {
                txtPes.Enabled = true;
            }
            if (cbTipo.SelectedIndex == 2)
            {
                gbVal.Enabled = true;
            }
            txtVfi.Enabled = true; txtVin.Enabled = true;
            if (cbTipo.SelectedIndex == 3)
            {
                cbPlat.Enabled = true;
                ClassPlataforma cPlat = new ClassPlataforma();
                cbPlat.DataSource    = cPlat.SearchPlat();
                cbPlat.DisplayMember = "Plataforma";
                cbPlat.ValueMember   = "CodPlat";
                cbPlat.SelectedIndex = -1;
            }
            if (cbTipo.SelectedIndex == 4)
            {
                cbCat.Enabled = true;
                ClassCategoria cc = new ClassCategoria();
                cbCat.DataSource    = cc.CbCat();
                cbCat.DisplayMember = "Nome";
                cbCat.ValueMember   = "CodCategoria";
                cbCat.SelectedIndex = -1;
            }
            if (cbTipo.SelectedIndex == 5)
            {
                txtPes.Enabled = true;
            }
        }