Пример #1
0
        private void ApagarYoutuber()
        {
            int    codigo = Convert.ToInt32(dgvListaYoutubers.Rows[dgvListaYoutubers.CurrentRow.Index].Cells[0].Value.ToString());
            string nome2  = dgvListaYoutubers.Rows[dgvListaYoutubers.CurrentRow.Index].Cells[1].Value.ToString();

            dgvListaYoutubers.Rows.RemoveAt(dgvListaYoutubers.CurrentRow.Index);
            YoutuberRepository repositorio = new YoutuberRepository();

            repositorio.ApagarYoutuber(codigo);
            MessageBox.Show(nome2 + " apagado com sucesso.");
        }
Пример #2
0
        public ApresentaInformacoes(int codigoRegistro)
        {
            InitializeComponent();
            this.codigoRegistro = codigoRegistro;
            YoutuberRepository repositorio = new YoutuberRepository();

            int quantidade = 0;

            for (int i = 0; i < repositorio.ObterYoutuber().Count(); i++)
            {
                Youtuber youtuber = repositorio.ObterYoutuber()[i];
                if (youtuber.GetCodigo() == codigoRegistro)
                {
                    lblCodigo.Text                  = youtuber.GetCodigo().ToString();
                    lblNome.Text                    = youtuber.GetNome();
                    lblSobrenome.Text               = youtuber.GetSobrenome();
                    lblApelido.Text                 = youtuber.GetApelido();
                    chkStreamer.Checked             = youtuber.GetStreamer();
                    lblNacionalidade.Text           = youtuber.GetNacionalidade();
                    lblRenda.Text                   = youtuber.GetRenda().ToString();
                    chkAnuncio.Checked              = youtuber.GetTemAnuncios();
                    chkPatrocinio.Checked           = youtuber.GetTemPatrocinador();
                    lblNomeCanal.Text               = youtuber.GetNomeCanal();
                    lblCategoria.Text               = youtuber.GetCategoria();
                    lnkLinkCanal.Text               = youtuber.GetLinkCanal();
                    lblPlataforma.Text              = youtuber.GetPlataforma();
                    lblQuantidadeVideos.Text        = youtuber.GetQuantidadeVideos().ToString();
                    lblQuantidadeVisualizacoes.Text = youtuber.GetQuantidadeVisualizacoes().ToString();
                    lblQuantidadeInscritos.Text     = youtuber.GetQuantidadeInscritos().ToString();
                    lblQuantidadeStrikes.Text       = youtuber.GetQuantidadeStrikes().ToString();
                    lblQuantidadeLikes.Text         = youtuber.GetQuantidadeLikes().ToString();
                    lblDescricao.Text               = youtuber.GetDescricao();
                    linkCanal         = youtuber.GetLinkCanal();
                    lnkLinkCanal.Text = "Canal";
                    return;
                }
                quantidade++;
            }
        }
Пример #3
0
        private void AtualizarListaYoutubers()
        {
            YoutuberRepository tudo = new YoutuberRepository();

            dgvListaYoutubers.Rows.Clear();

            string busca = txtBuscar.Text.ToLower();

            foreach (Youtuber youtuber in tudo.ObterYoutuber())
            {
                if ((youtuber.GetNome().ToLower().Contains(busca)) || (youtuber.GetCodigo().ToString().Contains(busca)) || (youtuber.GetNomeCanal().ToLower().Contains(busca)) || (youtuber.GetNacionalidade().ToLower().Contains(busca)))
                {
                    dgvListaYoutubers.Rows.Add(new Object[]
                    {
                        youtuber.GetCodigo(),
                        youtuber.GetNome(),
                        youtuber.GetNomeCanal(),
                        youtuber.GetQuantidadeInscritos(),
                        youtuber.GetNacionalidade()
                    });
                }
            }
        }
        public CadastroCriadorConteudo(int codigoRegistro)
        {
            InitializeComponent();
            this.codigoRegistro = codigoRegistro;
            YoutuberRepository repositorio = new YoutuberRepository();

            int quantidade = 0;

            for (int i = 0; i < repositorio.ObterYoutuber().Count(); i++)
            {
                Youtuber youtuber = repositorio.ObterYoutuber()[i];
                if (youtuber.GetCodigo() == codigoRegistro)
                {
                    lblcodigo.Text                  = youtuber.GetCodigo().ToString();
                    txtNome.Text                    = youtuber.GetNome();
                    txtSobrenome.Text               = youtuber.GetSobrenome();
                    txtApelido.Text                 = youtuber.GetApelido();
                    chkStreamer.Checked             = youtuber.GetStreamer();
                    cbNacionalidade.Text            = youtuber.GetNacionalidade();
                    txtRenda.Text                   = youtuber.GetRenda().ToString();
                    chkAnuncio.Checked              = youtuber.GetTemAnuncios();
                    chkPatrocinio.Checked           = youtuber.GetTemPatrocinador();
                    txtNomeCanal.Text               = youtuber.GetNomeCanal();
                    cbCategoria.Text                = youtuber.GetCategoria();
                    txtLinkCanal.Text               = youtuber.GetLinkCanal();
                    cbPlataforma.Text               = youtuber.GetPlataforma();
                    nudQuantidadeVideos.Value       = youtuber.GetQuantidadeVideos();
                    txtQuantidadeVisualizacoes.Text = youtuber.GetQuantidadeVisualizacoes().ToString();
                    txtQuantidadeInscritos.Text     = youtuber.GetQuantidadeInscritos().ToString();
                    nudQuantidadeStrikes.Value      = youtuber.GetQuantidadeStrikes();
                    txtQuantidadeLikes.Text         = youtuber.GetQuantidadeLikes().ToString();
                    txtDescricao.Text               = youtuber.GetDescricao();
                    return;
                }
                quantidade++;
            }
        }
        private void SalvarYoutube()
        {
            youtuber = new Youtuber();

            try
            {
                youtuber.SetNome(txtNome.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtNome.Focus();
                return;
            }

            try
            {
                youtuber.SetSobrenome(txtSobrenome.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtSobrenome.Focus();
                return;
            }

            try
            {
                youtuber.SetApelido(txtApelido.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtApelido.Focus();
                return;
            }

            if (cbNacionalidade.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione uma nacionalidade.");
                cbNacionalidade.DroppedDown = true;
                return;
            }
            try
            {
                youtuber.SetNacionalidade(cbNacionalidade.SelectedItem.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                cbNacionalidade.DroppedDown = true;
                return;
            }

            try
            {
                youtuber.SetRenda(Convert.ToDouble(txtRenda.Text));
            }
            catch
            {
                MessageBox.Show("Preencha a renda com valores corretos.");
                txtRenda.Focus();
                return;
            }

            try
            {
                youtuber.SetNomeCanal(txtNomeCanal.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtNomeCanal.Focus();
                return;
            }

            if (cbCategoria.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione uma categoria.");
                cbCategoria.DroppedDown = true;
                return;
            }
            try
            {
                youtuber.SetCategoria(cbCategoria.SelectedItem.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                cbCategoria.DroppedDown = true;
                return;
            }

            try
            {
                youtuber.SetLinkCanal(txtLinkCanal.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtLinkCanal.Focus();
                return;
            }

            if (cbPlataforma.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione uma plataforma.");
                cbPlataforma.DroppedDown = true;
                return;
            }
            try
            {
                youtuber.SetPlataforma(cbPlataforma.SelectedItem.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                cbPlataforma.DroppedDown = true;
                return;
            }

            try
            {
                youtuber.SetQuantidadeVideos(Convert.ToInt32(nudQuantidadeVideos.Value));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                nudQuantidadeVideos.Focus();
                return;
            }

            try
            {
                youtuber.SetQuantidadeVisualizacoes(Convert.ToInt64(txtQuantidadeVisualizacoes.Text.Replace(".", "").Replace(",", "")));
            }
            catch
            {
                MessageBox.Show("Preencha a quantidade de visualizações com as informações corretar.");
                txtQuantidadeVisualizacoes.Focus();
                return;
            }

            try
            {
                youtuber.SetQuantidadeInscritos(Convert.ToInt64(txtQuantidadeInscritos.Text.Replace(".", "").Replace(",", "")));
            }
            catch
            {
                MessageBox.Show("Preencha a quantidade de inscritos com as informações corretar.");
                txtQuantidadeInscritos.Focus();
                return;
            }

            try
            {
                youtuber.SetQuantidadeStrikes(Convert.ToInt32(nudQuantidadeStrikes.Value));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                nudQuantidadeStrikes.Focus();
                return;
            }

            try
            {
                youtuber.SetQuantidadeLikes(Convert.ToInt64(txtQuantidadeLikes.Text.Replace(".", "").Replace(",", "")));
            }
            catch
            {
                MessageBox.Show("Preencha a quantidade de likes com as informações corretar.");
                txtQuantidadeLikes.Focus();
                return;
            }

            youtuber.SetTemAnuncios(chkAnuncio.Checked);

            try
            {
                youtuber.SetDescricao(txtDescricao.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtDescricao.Focus();
                return;
            }

            if (chkPatrocinio.Checked)
            {
                youtuber.SetTemPatrocinador(true);
            }
            else
            {
                youtuber.SetTemPatrocinador(false);
            }

            if (chkStreamer.Checked)
            {
                youtuber.SetStreamer(true);
            }
            else
            {
                youtuber.SetStreamer(false);
            }

            YoutuberRepository tudo = new YoutuberRepository();

            if (codigoRegistro == -1)
            {
                tudo.AdicionarYoutuber(youtuber);
                MessageBox.Show("Youtuber cadastrado com sucesso");
            }
            else
            {
                youtuber.SetCodigo(codigoRegistro);
                tudo.EditarYoutuber(youtuber, codigoRegistro);
                MessageBox.Show("Youtuber alterado com sucesso");
                Dispose();
            }
            LimparCampos();
        }