private void CadastroRAJ_Form(int formtypeParameters) { this.Text = "Cadastro " + Enum.GetName(typeof(TypeForm), formtypeParameters); label1.Text = Enum.GetName(typeof(TypeForm), formtypeParameters); label2 = (Label)common.MudarStatusVisible(label2, false, String.Empty); label3 = (Label)common.MudarStatusVisible(label3, false, String.Empty); label4 = (Label)common.MudarStatusVisible(label4, false, String.Empty); comboBox1 = (ComboBox)common.MudarStatusVisible(comboBox1, false, String.Empty); comboBox2 = (ComboBox)common.MudarStatusVisible(comboBox2, false, String.Empty); comboBox3 = (ComboBox)common.MudarStatusVisible(comboBox3, false, String.Empty); IEnumerable <dynamic> formCad = null; using (capdeEntities context = new capdeEntities()) { if (formtypeParameters == (int)TypeForm.RAJ) { if (isAdmin) { formCad = context.RAJs.Where(x => x.NomeRaj != StringBase.TODOS.ToString()) .Select(x => new { x.RajId, x.NomeRaj, x.IsExcluido }).ToList(); } else { formCad = context.RAJs.Where(x => x.NomeRaj != StringBase.TODOS.ToString() && x.IsExcluido == false) .Select(x => new { x.RajId, x.NomeRaj, x.IsExcluido }).ToList(); } } else if (formtypeParameters == (int)TypeForm.Turma) { if (isAdmin) { formCad = context.Turmas.Where(x => x.NomeTurma != StringBase.TODOS.ToString()) .Select(x => new { x.TurmaId, x.NomeTurma, x.IsExcluido }).ToList(); } else { formCad = context.Turmas.Where(x => x.NomeTurma != StringBase.TODOS.ToString() && x.IsExcluido == false) .Select(x => new { x.TurmaId, x.NomeTurma, x.IsExcluido }).ToList(); } } else if (formtypeParameters == (int)TypeForm.Cargo) { if (isAdmin) { formCad = context.Cargoes.Where(x => x.NomeCargo != StringBase.TODOS.ToString()) .Select(x => new { x.CargoId, x.NomeCargo, x.IsExcluido }).ToList(); } else { formCad = context.Cargoes.Where(x => x.NomeCargo != StringBase.TODOS.ToString() && x.IsExcluido == false) .Select(x => new { x.CargoId, x.NomeCargo, x.IsExcluido }).ToList(); } } } dataGridView1.DataSource = formCad; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView1.Columns[1].HeaderText = TypeForm.RAJ.ToString(); dataGridView1.Columns[2].Visible = false; }