private void LL_Conteudos_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Form load = new Form_Load(); load.Show(); load.Refresh(); try { ConteudoDAL dal = new ConteudoDAL(); List <Conteudo> conteudos = new List <Conteudo>(); conteudos = dal.ConsultarPorMateria(this.materia.ID); if (conteudos.Count > 0) { Form frm = new Form_Selecionar(conteudos); frm.MdiParent = this.MdiParent; frm.Show(); } else { if (MessageBox.Show("Não há conteúdos relacionados a essa matérias. Gostaria de Adicionar ?", "EnigmaADMSys", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Form frm = new Form_CadastroConteudo(); frm.MdiParent = this.MdiParent; frm.Show(); } } } catch { MessageBox.Show("Erro de Conexão. Tente novamente", "EnigmaADMSys", MessageBoxButtons.OK, MessageBoxIcon.Error); } load.Close(); }
private void Grid_Materias_CellClick(object sender, DataGridViewCellEventArgs e) { if (Grid_Materias.Rows.Count > 0) { foreach (var item in materias.Where(x => x.Nome == Grid_Materias.CurrentRow.Cells[0].Value.ToString())) { try { Program.PanelCarregando.Visible = true; Program.PanelCarregando.Refresh(); ConteudoDAL dal = new ConteudoDAL(); conteudos = dal.ConsultarPorMateria(item.ID); CarregarConteudos(); Program.PanelCarregando.Visible = false; } catch { MessageBox.Show("Erro de Conexão, tente novamente", "Enigma", MessageBoxButtons.OK, MessageBoxIcon.Error); Program.PanelCarregando.Visible = false; } } } }
public List <Conteudo> GetForMateria(int id) { ConteudoDAL dal = new ConteudoDAL(); return(dal.ConsultarPorMateria(id)); }