コード例 #1
0
ファイル: frmCargoBusca.cs プロジェクト: esnfile/SisMusica
        private void btnDescExc_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(modulos.exclusao, "Atenção", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    apoio.AguardeExcluir();

                    //chama a função que exclui o registro na tabela
                    codigo = Convert.ToInt32(gridDesc["CodCargo", gridDesc.CurrentRow.Index].Value);

                    using (CargoController apiCargo = new CargoController()) { apiCargo.Delete(codigo); }

                    //chama a funcão montar grid
                    using (IBLL_DataGridView grid = new BLL_GridCargo()) { grid.MontarGrid(gridDesc, string.Empty); }
                }
                catch (SqlException exl)
                {
                    excp = new clsException(exl);
                }
                catch (Exception ex)
                {
                    excp = new clsException(ex);
                }
                finally
                {
                    apoio.FecharAguardeExcluir();
                }
            }
            else
            {
                txtDesc.Focus();
            }
        }
コード例 #2
0
ファイル: frmCargoBusca.cs プロジェクト: esnfile/SisMusica
 private void frmCargoBusca_Load(object sender, EventArgs e)
 {
     try
     {
         //chama a funcão montar grid
         using (IBLL_DataGridView grid = new BLL_GridCargo()) { grid.MontarGrid(gridDesc, string.Empty); }
         //verificar permissão de acesso
         VerPermDesc(gridDesc);
     }
     catch (SqlException exl)
     {
         excp = new clsException(exl);
     }
     catch (Exception ex)
     {
         excp = new clsException(ex);
     }
 }