private void btn_Salvar_Click(object sender, EventArgs e) { Youtuber youtuber = new Youtuber(); try { youtuber.SetNome(txt_Nome.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_Nome.Focus(); return; } try { youtuber.SetApelido(txt_Apelido.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_Apelido.Focus(); return; } try { youtuber.SetRenda(Convert.ToDouble(mtb_Renda.Text)); mtb_Renda.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } try { youtuber.SetStreamer(cb_Streamer.SelectedItem.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); cb_Streamer.DroppedDown = true; return; } try { if (cb_PatrocinadorSim.Checked) { youtuber.SetPatrocinador(txt_NomePatrocinador.Text); } if (cb_PatrocinadorNao.Checked) { youtuber.SetPatrocinador("nao"); } } catch (Exception ex) { MessageBox.Show(ex.Message); txt_NomePatrocinador.Focus(); return; } try { youtuber.SetNomeCanal(txt_NomeCanal.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_NomeCanal.Focus(); return; } try { youtuber.SetCategoria(cb_Categoria.SelectedItem.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); cb_Categoria.DroppedDown = true; return; } try { youtuber.SetVideos(Convert.ToInt64(txt_Videos.Text)); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_Videos.Focus(); return; } try { youtuber.SetViews(Convert.ToInt64(txt_Views.Text)); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_Views.Focus(); return; } try { youtuber.SetLikes(Convert.ToInt64(txt_Likes.Text)); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_Likes.Focus(); return; } try { youtuber.SetInscritos(Convert.ToInt64(txt_Inscritos.Text)); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_Inscritos.Focus(); return; } try { youtuber.SetPlataforma(cb_Plataforma.SelectedItem.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); cb_Plataforma.DroppedDown = true; return; } try { youtuber.SetDescricao(txt_Descricao.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } try { youtuber.SetNacionalidade(cb_Nacionalidade.SelectedItem.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); cb_Nacionalidade.DroppedDown = true; return; } try { youtuber.SetStrikes(Convert.ToInt64(txt_Strikes.Text)); } catch (Exception ex) { MessageBox.Show(ex.Message); txt_Strikes.Focus(); return; } try { if (cb_PatrocinadorSim.Checked) { youtuber.SetPatrocinador(txt_NomePatrocinador.Text); } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } try { if (cb_AnuncioSim.Checked) { youtuber.SetAnuncio("sim"); } if (cb_AnuncioNao.Checked) { youtuber.SetAnuncio("nao"); } } catch (Exception) { MessageBox.Show("Informe se possui anuncios."); return; } try { youtuber.SetLink(txt_NomeCanal.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } Repository tudo = new Repository(); if (posicao == -1) { tudo.AddYoutuber(youtuber); MessageBox.Show("Youtuber cadastrado com sucesso"); } else { tudo.EditarYoutuber(youtuber, posicao); MessageBox.Show("Youtuber alterado com sucesso"); } llb_Link.Enabled = true; LimpaCampos(); AtualizarListaYoutuber(); }