Exemplo n.º 1
0
        private void btnInserir_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtId.Text == "")
                {
                    ClassCombinacao c = new ClassCombinacao();
                    c.NOME = txtDescricao.Text;
                    c.SUBSISTEMAID = int.Parse(txtSubsistema.Text);
                    c.NovaCombinacao();

                    txtDescricao.Text = "";
                    txtId.Text = "";

                    dtgCombinacao.DataSource = c.visualizarTodasCombinacaoNomeSub();
                    MessageBox.Show("Nome de combinação cadastrado com sucesso !");
                }
                else
                {
                    MessageBox.Show("Limpe os campos antes de inserir um novo registro !");
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void btnExcluir_Click(object sender, EventArgs e)
        {
            try
            {
                ClassCombinacao c = new ClassCombinacao();
                c.IDCOMBINACAO = int.Parse(txtId.Text);
                c.ExcluirCombinacao();

                txtDescricao.Text = "";
                txtId.Text = "";

                dtgCombinacao.DataSource = c.visualizarTodasCombinacaoNomeSub();
                MessageBox.Show("Nome de combinação excluída com sucesso !");

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            try
            {
                ClassCombinacao c = new ClassCombinacao();
                c.IDCOMBINACAO = int.Parse(txtId.Text);
                c.NOME = txtDescricao.Text;
                c.SUBSISTEMAID = int.Parse(txtSubsistema.Text);
                c.AlterarCombinacao();

                txtDescricao.Text = "";
                txtId.Text = "";

                dtgCombinacao.DataSource = c.visualizarTodasCombinacaoNomeSub();
                MessageBox.Show("Nome de combinação alterado com sucesso !");

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 4
0
        private void cmbSubsistema_SelectionChangeCommitted(object sender, EventArgs e)
        {
            try
            {
                if (cmbSubsistema.SelectedValue.ToString() != "")
                {
                    ClassCombinacao c = new ClassCombinacao();
                    c.SUBSISTEMAID = int.Parse(cmbSubsistema.SelectedValue.ToString());
                    DataTable dt = c.visualizarCombSubs();

                    cmbCombinacao.DataSource = dt;
                    cmbCombinacao.DisplayMember = "nome";
                    cmbCombinacao.ValueMember = "id";
                    cmbCombinacao.Text = "Selecione...";
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 5
0
        private void frmCombinacao_Load(object sender, EventArgs e)
        {
            try
            {
                ClassCombinacao c = new ClassCombinacao();
                dtgCombinacao.DataSource = c.visualizarTodasCombinacaoNomeSub();

                ClassSubsistemas s = new ClassSubsistemas();
                DataTable dt = s.visualizarTodosSubsistemas();

                cmbSubsistema.DataSource = dt;
                cmbSubsistema.DisplayMember = "nome";
                cmbSubsistema.ValueMember = "id";
                cmbSubsistema.Text = "Selecione...";
                txtSubsistema.Text = "";

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
        private void frmKit_Load(object sender, EventArgs e)
        {
            try
            {
                ClassKit k = new ClassKit();
                dtgKit.DataSource = k.visualizarTodosKits();

                ClassCombinacao c = new ClassCombinacao();
                DataTable dt = c.visualizarTodasCombinacao();

                cmbCombinacao.DataSource = dt;
                cmbCombinacao.DisplayMember = "nome";
                cmbCombinacao.ValueMember = "id";
                cmbCombinacao.Text = "Selecione...";
                txtCC.Text = "";

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }
        }