コード例 #1
0
        private void listBoxTorneio_SelectedIndexChanged(object sender, EventArgs e)
        {
            //torneios.GetType();
            if (listBoxTorneio.SelectedItem.GetType() == typeof(TeamTournament))
            {
                TeamTournament team = (TeamTournament)listBoxTorneio.SelectedItem;

                if (team != null)
                {
                    labelNome.Text = team.Nome;
                    labelDesc.Text = team.Desc;
                    labelData.Text = Convert.ToString(team.Data);
                }
            }
            else if (listBoxTorneio.SelectedItem.GetType() == typeof(StandardTournament))
            {
                StandardTournament solo = (StandardTournament)listBoxTorneio.SelectedItem;
                if (solo != null)
                {
                    labelNome.Text = solo.Nome;
                    labelDesc.Text = solo.Desc;
                    labelData.Text = Convert.ToString(solo.Data);
                }
            }
        }
 public List <TeamGame> getTeamGamesOfRefereeList(TeamTournament tourn, Referee arbitro)
 {
     return((from jogo in dbConteirner.Tournament.
             OfType <TeamTournament>().ToList().
             Find(t => t == tourn).Game
             where jogo.Referee.Id == arbitro.Id
             select jogo).ToList());
 }
コード例 #3
0
        public bool EditTournament(TeamTournament torneio)
        {
            bool flag = checkTournament(torneio);

            if (flag)
            {
                dbContainer.SaveChanges();
            }
            return(flag);
        }
コード例 #4
0
        public bool AddTournament(TeamTournament torneio)
        {
            bool flag = checkTournament(torneio);

            if (flag)
            {
                dbContainer.Tournament.Add(torneio);
                dbContainer.SaveChanges();
                flag = true;
            }
            return(flag);
        }
コード例 #5
0
 private void RefreshListJogos(TeamTournament tourn)
 {
     lbJogos.Items.Clear();
     if (flagLoginArbitro)
     {
         listaTeamGames = gameRepo.getTeamGamesOfRefereeList(tourn, arbitro);
     }
     else
     {
         listaTeamGames = gameRepo.getTeamGamesList(tourn);
     }
     listaTeamGames = gameRepo.getTeamGamesList(tourn);
     foreach (TeamGame game in listaTeamGames)
     {
         lbJogos.Items.Add(game.Number + "\t" + game.Date.ToShortDateString());
     }
 }
コード例 #6
0
ファイル: NovoTorneio.cs プロジェクト: LHCCM/ProjetoArcMage
        private void buttonCriarTorneio_Click(object sender, EventArgs e)
        {
            if (textBoxNome.Text.Length == 0 || textBoxDesc.Text.Length == 0)
            {
                MessageBox.Show("Preencha as caixas de texto, Por Favor.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (radioButtonStandard.Checked == true)
            {
                string   nome = textBoxNome.Text.Trim();
                string   desc = textBoxDesc.Text.Trim();
                DateTime date = dateTimePicker.Value;

                NovoTorneioStandard = new StandardTournament()
                {
                    Nome = nome,
                    Data = date,
                    Desc = desc,
                };
                DialogResult = DialogResult.OK;
                Close();
            }
            else if (radioButtonEquipas.Checked == true)
            {
                string   nome = textBoxNome.Text.Trim();
                string   desc = textBoxDesc.Text.Trim();
                DateTime date = dateTimePicker.Value;

                NovoTorneioTeam = new TeamTournament()
                {
                    Nome = nome,
                    Data = date,
                    Desc = desc,
                };
                DialogResult = DialogResult.Yes;
                Close();
            }
            else
            {
                MessageBox.Show("Nenhum tipo de torneio selecionado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #7
0
ファイル: EditarTorneio.cs プロジェクト: LHCCM/ProjetoArcMage
        private void listBoxTorneio_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBoxTorneio.SelectedItem.GetType() == typeof(TeamTournament))
            {
                TeamTournament team = (TeamTournament)listBoxTorneio.SelectedItem;

                if (team != null)
                {
                    textBoxNome.Text     = team.Nome;
                    textBoxDesc.Text     = team.Desc;
                    dateTimePicker.Value = team.Data;
                }
            }
            else
            {
                StandardTournament solo = (StandardTournament)listBoxTorneio.SelectedItem;
                if (solo != null)
                {
                    textBoxNome.Text     = solo.Nome;
                    textBoxDesc.Text     = solo.Desc;
                    dateTimePicker.Value = solo.Data;
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Ao selecionar 1 torneio, carrega os jogos
        /// associados ao árbitro atual para a tabela lvTeamJ
        /// </summary>
        private void lbxTeamT_SelectedIndexChanged(object sender, EventArgs e)
        {
            lvTeamJ.Items.Clear();

            if (lbxTeamT.SelectedItems.Count > 0)
            {
                //Obter torneio selecionado
                TeamTournament torneioSelecionado = (TeamTournament)lbxTeamT.SelectedItem;

                //Percorrer todos os jogos desse torneio
                foreach (TeamGame jogo in torneioSelecionado.Games)
                {
                    if (jogo.RefereeId == idArbitro) //Verificar se o jogo está associado ao árbitro
                    {
                        ListViewItem item = new ListViewItem(jogo.Description);
                        item.SubItems.Add(jogo.Date.ToShortDateString());
                        item.SubItems.Add(jogo.Team1.Name);
                        item.SubItems.Add(jogo.Team2.Name);

                        lvTeamJ.Items.Add(item);
                    }
                }
            }
        }
コード例 #9
0
ファイル: EditarTorneio.cs プロジェクト: LHCCM/ProjetoArcMage
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            if (listBoxTorneio.SelectedItem == null)
            {
                MessageBox.Show("Nenhum torneio selecionado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (listBoxTorneio.SelectedItem.GetType() == typeof(TeamTournament))
                {
                    TeamTournament team = (TeamTournament)listBoxTorneio.SelectedItem;

                    if (team != null)
                    {
                        DialogResult result = MessageBox.Show("Tem a certeza que deseja guardar as alterações ? ", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                        if (result == DialogResult.Yes)
                        {
                            if (textBoxDesc.Text == null || textBoxNome.Text == null)
                            {
                                MessageBox.Show("Preencha as caixas de texto, Por favor", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                string   nome = textBoxNome.Text.Trim();
                                string   desc = textBoxDesc.Text.Trim();
                                DateTime date = dateTimePicker.Value;

                                team.Nome = nome;
                                team.Data = date;
                                team.Desc = desc;

                                container.SaveChanges();
                            }
                        }
                    }
                }
                else //if(listBoxTorneio.SelectedItem.GetType() == typeof(StandardTournament))
                {
                    StandardTournament standard = (StandardTournament)listBoxTorneio.SelectedItem;

                    if (standard != null)
                    {
                        DialogResult result = MessageBox.Show("Tem a certeza que deseja guardar as alterações ? ", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);


                        if (result == DialogResult.Yes)
                        {
                            if (textBoxDesc.Text == null || textBoxNome.Text == null)
                            {
                                MessageBox.Show("Preencha as caixas de texto, Por favor", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                string   nome = textBoxNome.Text.Trim();
                                string   desc = textBoxDesc.Text.Trim();
                                DateTime date = dateTimePicker.Value;

                                standard.Nome = nome;
                                standard.Data = date;
                                standard.Desc = desc;

                                container.SaveChanges();
                            }
                        }
                    }
                }
            }
        }
コード例 #10
0
 private void AdicionarTorneioEquipas(TeamTournament torneio)
 {
     container.Tournament.Add(torneio);
     container.SaveChanges();
 }
コード例 #11
0
 private void btGuardarTorneio_Click(object sender, EventArgs e)
 {
     if (rbNormal.Checked)
     {
         StandardToutnament tourn;
         if (!flagEditarTorneio)
         {
             tourn = new StandardToutnament();
         }
         else
         {
             tourn = listaStandardTourn.ElementAt(lbTorneiosNormais.SelectedIndex);
         }
         tourn.Name       = tbNomeTorneio.Text;
         tourn.Date       = dpDataTorneio.Value;
         tourn.Descrition = tbDescricaoTorneio.Text;
         if (!flagEditarTorneio)
         {
             if (tourRepo.AddTournament(tourn))
             {
                 AtivarFormTorneio(false);
                 LimpaFormTorneio();
                 RefreshListTorneiosNormais();
                 lbTorneiosNormais.SelectedIndex = lbTorneiosNormais.Items.Count - 1;
             }
         }
         else
         {
             if (tourRepo.EditTournament(tourn))
             {
                 AtivarFormTorneio(false);
                 LimpaFormTorneio();
                 RefreshListTorneiosEquipas();
                 flagEditarTorneio = false;
             }
         }
     }
     else
     {
         TeamTournament tourn;
         if (!flagEditarTorneio)
         {
             tourn = new TeamTournament();
         }
         else
         {
             tourn = listaTeamTourn.ElementAt(lbTorneiosEquipas.SelectedIndex);
         }
         tourn.Name       = tbNomeTorneio.Text;
         tourn.Date       = dpDataTorneio.Value;
         tourn.Descrition = tbDescricaoTorneio.Text;
         if (!flagEditarTorneio)
         {
             if (tourRepo.AddTournament(tourn))
             {
                 AtivarFormTorneio(false);
                 LimpaFormTorneio();
                 RefreshListTorneiosEquipas();
                 lbTorneiosEquipas.SelectedIndex = lbTorneiosEquipas.Items.Count - 1;
             }
         }
         else
         {
             if (tourRepo.EditTournament(tourn))
             {
                 AtivarFormTorneio(false);
                 LimpaFormTorneio();
                 RefreshListTorneiosEquipas();
                 flagEditarTorneio = false;
             }
         }
     }
     btNovoTorn.Enabled = true;
 }
 public List <TeamGame> getTeamGamesList(TeamTournament tourn)
 {
     return(dbConteirner.Tournament.OfType <TeamTournament>().ToList().Find(tour => tour == tourn).Game.ToList());
 }