Пример #1
0
        private void btAdicionar_Click(object sender, EventArgs e)
        {
            string msgRetorno = string.Empty;

            msgRetorno = ValidarPrevisao();

            if (msgRetorno == string.Empty)
            {
                ObraEtapaPlanejamento planejamento = new ObraEtapaPlanejamento()
                {
                    idObraEtapa   = etapaSelecionada.idObraEtapa,
                    idUEN         = int.Parse(cbUEN.SelectedValue.ToString()),
                    descricaoUEN  = cbUEN.Text,
                    valorPrevisto = decimal.Parse(tbValorPrevisto.Text)
                };

                lstPlanejamento.Add(planejamento);

                cbUEN.SelectedIndex  = 0;
                tbValorPrevisto.Text = "0,00";

                CarregarGrid();
            }
            else
            {
                MessageBox.Show("Atenção: " + msgRetorno, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #2
0
        private void btRemover_Click(object sender, EventArgs e)
        {
            int linhaGrid = 0;

            if (gvPrevisao.RowCount == 0)
            {
                return;
            }

            linhaGrid = gvPrevisao.SelectedCells[0].RowIndex;

            ObraEtapaPlanejamento itemSelecionado = new ObraEtapaPlanejamento()
            {
                idUEN = int.Parse(gvPrevisao[0, linhaGrid].Value.ToString())
            };

            lstPlanejamento.RemoveAll(item => item.idUEN == itemSelecionado.idUEN);

            CarregarGrid();
        }