Esempio n. 1
0
        /// <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);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Verifica se os campos obrigatorios estao preenchidos
        /// </summary>
        private void ValidarCampos()
        {
            this.Artigo.ComentarioEditor = this.txtComentarios.Text;

            Lista <String> nomesAvaliadores = ComponentesHelper.ListViewToLista(this.lvAvaliadores);

            while (nomesAvaliadores.ContemProximo())
            {
                IAvaliador avaliador = new Avaliador();
                avaliador.Nome = (String)nomesAvaliadores.Proximo();

                try
                {
                    avaliador = (IAvaliador)bd.AdicionarPessoa(avaliador);
                }
                catch (Exception)
                { }


                if (!this.Artigo.Avaliadores.Existe(avaliador))
                {
                    this.Artigo.Avaliadores.Adicionar(avaliador);
                }
            }
            if (this.Artigo.Avaliadores.Tamanho >= 2)
            {
                this.Close();
            }
            else
            {
                throw new Exception("O artigo deve ser encaminhado para no mínimo 2 avaliadores!");
            }
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
 private void btnRemoverComentario_Click(object sender, EventArgs e)
 {
     try
     {
         ComponentesHelper.RemoverItemListView(this.lvComentarios);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 5
0
 private void btnAdicionarComentario_Click(object sender, EventArgs e)
 {
     try
     {
         ComponentesHelper.AdicionaItemListView(this.txtComentario.Text, this.lvComentarios);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 6
0
 private void btnRemovePalavraChave_Click(object sender, EventArgs e)
 {
     try
     {
         ComponentesHelper.RemoverItemListView(this.lvPalavrasChave);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 7
0
 private void rdVisitante_KeyPress(object sender, KeyPressEventArgs e)
 {
     try
     {
         ComponentesHelper.ComponenteFocus(btnConfirma, e, 13);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 8
0
        /// <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);
            }
        }
Esempio n. 9
0
        /// <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);
            }
        }
Esempio n. 10
0
 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);
     }
 }
Esempio n. 11
0
        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);
            }
        }
Esempio n. 12
0
        /// <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);
            }
        }
Esempio n. 13
0
        /// <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++;
            }
        }
Esempio n. 14
0
        /// <summary>
        /// Preenche a propriedade Artigo com os dados da tela
        /// </summary>
        private void PreencheArtigo()
        {
            if (this.artigo == null)
            {
                this.artigo = new Artigo();
            }

            this.artigo.Nome     = txtNome.Text;
            this.artigo.Resumo   = txtResumo.Text;
            this.artigo.Conteudo = txtConteudo.Text;

            if (this.pessoa is Autor)
            {
                this.artigo.Status = new Apreciacao(this.artigo);
            }

            //retorno.Autores = ListViewToLista(lvAutores);
            this.artigo.PalavrasChave = ComponentesHelper.ListViewToLista(lvPalavrasChave);
            this.artigo.Autores       = autores;

            this.Artigo = this.artigo;
        }
Esempio n. 15
0
        /// <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);
            }
        }