Example #1
0
 private void tlaConfigTwitter_Load(object sender, EventArgs e)
 {
     if (config.conectar())
     {
         configurado       = config.twitterToken()[0] != "";
         checkBox1.Checked = configurado;
     }
     else
     {
         this.Close();
     }
 }
Example #2
0
 private void tlaConfigFacebook_Load(object sender, EventArgs e)
 {
     if (banco.conectar())
     {
         configurado       = banco.buscarFacebookToken()[0] != "";
         checkBox1.Checked = configurado;
     }
     else
     {
         MessageBox.Show("Erro ao conectar ao banco de dados", "Alerta | knoodou");
         this.Close();
     }
 }
Example #3
0
 private void Configs_Load(object sender, EventArgs e)
 {
     if (config.conectar())
     {
         string[][] valores = config.listarConfigs();
         textBox1.Text       = valores[1][0];
         maskedTextBox1.Text = valores[0][0];
     }
     else
     {
         MessageBox.Show("Banco de dados indisponivel", "Alerta | Knoodou");
         this.Close();
     }
 }
Example #4
0
 private void tlaConfigEmail_Load(object sender, EventArgs e)
 {
     if (conf.conectar())
     {
         string[] valores = conf.buscarEmail();
         if (valores[0] != "")
         {
             inEmail.Text   = valores[0];
             inSenha.Text   = valores[1];
             inServ.Text    = valores[2];
             inPort.Text    = valores[3];
             chkTLS.Checked = valores[4] == "TLS";
         }
     }
     else
     {
         MessageBox.Show("Banco de dados indisponível", "Alerta | Knoodou");
         this.Close();
     }
 }
Example #5
0
        private void btOk_Click(object sender, EventArgs e)
        {
            if (inTitulo.Text == "")
            {
                MessageBox.Show("Digite um título", "Alerta | Knoodou");
                inTitulo.Focus();
            }
            else if (inAno.Text.Length != 4)
            {
                MessageBox.Show("Digite o ano de lançamento", "Alerta | Knoodou");
                inAno.Focus();
            }
            else if (comboClass.Text == "")
            {
                MessageBox.Show("Escolha uma classificação", "Alerta | Knoodou");
                comboClass.Focus();
            }
            else if (inDuracao.Text == "")
            {
                MessageBox.Show("Digite a duração do filme");
                inDuracao.Focus();
            }
            else if (checkedListBox1.CheckedItems.Count < 1)
            {
                MessageBox.Show("Escolha ao menos um gênero", "Alerta | Knoodou");
            }
            else if (comboFormato.Text == "")
            {
                MessageBox.Show("Escolha um formato");
                comboFormato.Focus();
            }
            else
            {
                IList <int> listadegeneros = new List <int>();
                foreach (int gen in checkedListBox1.CheckedIndices)
                {
                    listadegeneros.Add(ids[gen]);
                }

                if (this.id < 0)
                {
                    filmes.criarFilme(formatos[comboFormato.SelectedIndex], Convert.ToInt32(inAno.Text), inTitulo.Text,
                                      comboClass.Text, Convert.ToInt32(inQuantidade.Text), inIMDB.Text, inURL.Text, Convert.ToInt32(inDuracao.Text),
                                      comboCaract.Text, listadegeneros.ToArray <int>());
                    //Twitter

                    Banco.Config config = new Banco.Config();
                    config.conectar();
                    if (config.twitterToken()[0] != "")
                    {
                        Internet.Twitter tw = new Internet.Twitter();
                        if (inTitulo.Text.Length > 128)
                        {
                            tw.novaMensagem("Novo filme: " + inTitulo.Text.Substring(0, 125) + "...");
                        }
                        else
                        {
                            tw.novaMensagem("Novo filme: " + inTitulo.Text);
                        }
                    }
                    //facebook
                    if (config.buscarFacebookToken()[0] != "")
                    {
                        Internet.Facebook fb = new Internet.Facebook();
                        fb.postarNoFB("Novo filme: " + inTitulo.Text);
                    }
                }
                else
                {
                    filmes.atualizarFilme(formatos[comboFormato.SelectedIndex], Convert.ToInt32(inAno.Text), inTitulo.Text,
                                          comboClass.Text, Convert.ToInt32(inQuantidade.Text), inIMDB.Text, inURL.Text, Convert.ToInt32(inDuracao.Text),
                                          comboCaract.Text, listadegeneros.ToArray <int>(), this.id);
                }
                this.Close();
            }
        }
Example #6
0
        private void btOk_Click(object sender, EventArgs e)
        {
            if (inTitulo.Text == "")
            {
                MessageBox.Show("Digite um título", "Alerta | Knoodou");
                inTitulo.Focus();
            }
            else if (inAno.Text.Length != 4)
            {
                MessageBox.Show("Digite o ano de lançamento", "Alerta | Knoodou");
                inAno.Focus();
            }
            else if (comboClass.Text == "")
            {
                MessageBox.Show("Escolha uma classificação", "Alerta | Knoodou");
                comboClass.Focus();

            }
            else if (inDuracao.Text == "")
            {
                MessageBox.Show("Digite a duração do filme");
                inDuracao.Focus();
            }
            else if (checkedListBox1.CheckedItems.Count < 1)
            {
                MessageBox.Show("Escolha ao menos um gênero", "Alerta | Knoodou");
            }
            else if (comboFormato.Text == "")
            {
                MessageBox.Show("Escolha um formato");
                comboFormato.Focus();
            }
            else
            {
                IList<int> listadegeneros = new List<int>();
                foreach (int gen in checkedListBox1.CheckedIndices)
                    listadegeneros.Add(ids[gen]);

                if (this.id < 0)
                {
                    filmes.criarFilme(formatos[comboFormato.SelectedIndex], Convert.ToInt32(inAno.Text), inTitulo.Text,
                        comboClass.Text, Convert.ToInt32(inQuantidade.Text), inIMDB.Text, inURL.Text, Convert.ToInt32(inDuracao.Text),
                        comboCaract.Text, listadegeneros.ToArray<int>() );
                    //Twitter

                    Banco.Config config = new Banco.Config();
                    config.conectar();
                    if (config.twitterToken()[0] != "")
                    {
                        Internet.Twitter tw = new Internet.Twitter();
                        if(inTitulo.Text.Length > 128)
                            tw.novaMensagem("Novo filme: " + inTitulo.Text.Substring(0,125) + "...");
                        else
                            tw.novaMensagem("Novo filme: " + inTitulo.Text);
                    }
                    //facebook
                    if (config.buscarFacebookToken()[0] != "")
                    {
                        Internet.Facebook fb = new Internet.Facebook();
                        fb.postarNoFB("Novo filme: " + inTitulo.Text);
                    }

                }
                else
                {
                    filmes.atualizarFilme(formatos[comboFormato.SelectedIndex], Convert.ToInt32(inAno.Text), inTitulo.Text,
                        comboClass.Text, Convert.ToInt32(inQuantidade.Text), inIMDB.Text, inURL.Text, Convert.ToInt32(inDuracao.Text),
                        comboCaract.Text, listadegeneros.ToArray<int>(), this.id);
                }
                this.Close();
            }
        }