Exemplo n.º 1
0
 private void BtnCadastrarPasto_Click(object sender, EventArgs e)
 {
     Pasto.frmCadastroPasto frmCadastroPasto = new Pasto.frmCadastroPasto(true);
     if (frmCadastroPasto.ShowDialog() == DialogResult.OK)
     {
         contratoAluguel.Pastos.Add(frmCadastroPasto.pasto);
         dgvPastos.DataSource = null;
         dgvPastos.DataSource = contratoAluguel.Pastos;
     }
 }
 private void BtnCadastroPasto_Click(object sender, EventArgs e)
 {
     if (user.TipoUsuario.TipoUsuarioDescricao == "Administrador")
     {
         Pasto.frmCadastroPasto frmCadastroPasto = new Pasto.frmCadastroPasto(false);
         frmCadastroPasto.ShowDialog();
     }
     else
     {
         MessageBox.Show("Somente usuários administradores.", "Permissão negada.");
     }
 }