private void dgvAdmin_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 3)
            {
                if (e.RowIndex >= 0)
                {
                    DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao);

                    BLLConfigCusto bll = new BLLConfigCusto(cx);

                    DataTable tabela = bll.LocalizarConfigPorId(Convert.ToInt32(dgvAdmin.Rows[e.RowIndex].Cells[0].Value));

                    cbGrupoAdmin.Text = dgvAdmin.Rows[e.RowIndex].Cells[2].Value.ToString();

                    BLLCmvGrupo bllg = new BLLCmvGrupo(cx);

                    bllg.ExcluirGrupoReceita(Convert.ToInt32(dgvAdmin.Rows[e.RowIndex].Cells[1].Value));

                    CarregaDgvAdmin();
                }
            }
        }
示例#2
0
        private void carregaGrupo()
        {
            DALConexao     cx  = new DALConexao(DadosDaConexao.StringDaConexao);
            BLLConfigCusto bll = new BLLConfigCusto(cx);

            DataTable tabela = bll.LocalizarConfig(idUnidade);

            var dataSource = new List <Language>();

            dataSource.Add(new Language()
            {
                Name = "", Value = "0"
            });

            for (int i = 0; i < tabela.Rows.Count; i++)
            {
                dataSource.Add(new Language()
                {
                    Name = tabela.Rows[i][1].ToString() + " - " + tabela.Rows[i][2].ToString(), Value = tabela.Rows[i][0].ToString()
                });
            }

            dataSource.Add(new Language()
            {
                Name = "ACRÉSCIMO AO PAX", Value = "-1"
            });
            dataSource.Add(new Language()
            {
                Name = "ACRÉSCIMO À RECEITA", Value = "-2"
            });

            //Setup data binding
            this.cbConta.DataSource    = dataSource;
            this.cbConta.DisplayMember = "Name";
            this.cbConta.ValueMember   = "Value";
            this.cbConta.Text          = "";
        }