private void btnAdicionarAutor_Click(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(this.txtNomeAutor.Text)) { IAutor autor = new Autor(); autor.Nome = this.txtNomeAutor.Text; // Recupera a instancia do banco de dados ja inicializada BancoDeDados bd = BancoDeDados.GetInstance(); bd.AdicionarPessoa(autor); this.autores.Adicionar(autor); ComponentesHelper.AdicionaItemListView(autor.Nome, this.lvAutores); this.txtNomeAutor.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Construtor do Cadastro de Artigos /// </summary> /// <param name="pessoa">Autor do artigo</param> public FrmCadastroArtigo(IPessoa pessoa) { try { InitializeComponent(); this.artigo = new Artigo(); this.autores = new Lista <IAutor>(); this.autores.Adicionar((IAutor)pessoa); this.pessoa = pessoa; ComponentesHelper.AdicionaItemListView(artigo.ComentarioEditor, this.lvComentarios); ComponentesHelper.AdicionaItemListView(artigo.ComentariosAvaliadores, this.lvComentarios); ComponentesHelper.AdicionaItemListView(artigo.PalavrasChave, this.lvPalavrasChave); ComponentesHelper.AdicionaItemListView(autores, this.lvAutores); this.InicializalvComentarios(); this.InicializaComponentes(pessoa); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnAdicionarComentario_Click(object sender, EventArgs e) { try { ComponentesHelper.AdicionaItemListView(this.txtComentario.Text, this.lvComentarios); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Preenche o list view com as edições /// </summary> private void PreencheListView() { while (this.edicoes.ContemProximo()) { this.lvEdicoes.Clear(); IEdicao edicao = (IEdicao)edicoes.Proximo(); ComponentesHelper.AdicionaItemListView(edicao.Descricao, this.lvEdicoes); ComponentesHelper.AdicionaSubItemListView(this.lvEdicoes.Items.Count - 1, edicao.Id.ToString(), this.lvEdicoes); } }
/// <summary> /// Preenche o list view com as edições /// </summary> private void PreencheListView() { while (this.periodicos.ContemProximo()) { this.lvPeriodicos.Clear(); IPeriodico periodico = (IPeriodico)this.periodicos.Proximo(); ComponentesHelper.AdicionaItemListView(periodico.Descricao, this.lvPeriodicos, 2); ComponentesHelper.AdicionaSubItemListView(this.lvPeriodicos.Items.Count - 1, periodico.Id.ToString(), this.lvPeriodicos); } }
private void btnAdicionaPalavraChave_Click(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(this.txtAvaliador.Text)) { ComponentesHelper.AdicionaItemListView(this.txtAvaliador.Text, this.lvAvaliadores); this.txtAvaliador.Text = String.Empty; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click_1(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(this.txtPalavraChave.Text)) { ComponentesHelper.AdicionaItemListView(this.txtPalavraChave.Text, this.lvPalavrasChave); } this.txtPalavraChave.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Preenche o listview com os artigos do autor /// </summary> public void PreencheListView(Lista <IArtigo> artigos) { try { this.lvArtigos.Items.Clear(); int contador = 0; while (artigos.ContemProximo()) { IArtigo artigo = (IArtigo)artigos.Proximo(); if (artigo.Status is Apreciacao) { ComponentesHelper.AdicionaItemListView(artigo.Nome, this.lvArtigos, 0); ComponentesHelper.AdicionaSubItemListView(contador, "Apreciação", this.lvArtigos); } else if (artigo.Status is Avaliacao) { ComponentesHelper.AdicionaItemListView(artigo.Nome, this.lvArtigos, 1); ComponentesHelper.AdicionaSubItemListView(contador, "Avaliação", this.lvArtigos); } else if (artigo.Status is Aceito) { ComponentesHelper.AdicionaItemListView(artigo.Nome, this.lvArtigos, 2); ComponentesHelper.AdicionaSubItemListView(contador, "Aceito", this.lvArtigos); } else if (artigo.Status is Inativo) { ComponentesHelper.AdicionaItemListView(artigo.Nome, this.lvArtigos, 3); ComponentesHelper.AdicionaSubItemListView(contador, "Inativo", this.lvArtigos); } this.lvArtigos.Items[contador].SubItems.Add(artigo.Id.ToString()); contador++; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Preenche o listview com os artigos do autor /// </summary> public void PreencheListView(Lista <IArtigo> artigos) { this.lvTodos.Items.Clear(); int contador = 0; while (artigos.ContemProximo()) { IArtigo artigo = (IArtigo)artigos.Proximo(); if (artigo.Status is Aceito) { ComponentesHelper.AdicionaItemListView(artigo.Nome, this.lvTodos, 0); ComponentesHelper.AdicionaSubItemListView(contador, "Aceito", this.lvTodos); this.lvTodos.Items[contador].SubItems.Add(artigo.Id.ToString()); } contador++; } }
/// <summary> /// Construtor do form encaminhar artigo /// </summary> /// <param name="artigo"></param> public FrmEncaminharArtigo(IArtigo artigo) { try { InitializeComponent(); this.Artigo = artigo; this.bd = BancoDeDados.GetInstance(); this.txtNome.Text = artigo.Nome; this.lvAvaliadores.View = View.Details; this.lvAvaliadores.Columns.Add("Autores"); this.lvAutores.View = View.Details; ComponentesHelper.AdicionaItemListView(artigo.Autores, this.lvAutores); } catch (Exception ex) { MessageBox.Show(ex.Message); } }