コード例 #1
0
        private void editTeamButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();
            IList<Object> teams = session.QueryOver<Object>("Team").List();
            SelectionForm selection = new SelectionForm(teams);
            selection.ShowDialog();

            // Get selection result
            Team team = (Team)selection.getSelection();

            if (team != null)
            {
                TeamForm teamForm = new TeamForm(team.Id);
                teamForm.ShowDialog();
            }
        }
コード例 #2
0
        private void editAssociationButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();
            IList<Object> associations = session.QueryOver<Object>("Association").List();
            SelectionForm selection = new SelectionForm(associations);
            selection.ShowDialog();

            // Get selection result
            Association association = (Association)selection.getSelection();

            if (association != null)
            {
                AssociationForm associationForm = new AssociationForm(association.Id);
                associationForm.ShowDialog();
            }
        }
コード例 #3
0
        private void resultButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();
            IList<Object> matches = session.QueryOver<Object>("Match").List();
            SelectionForm selection = new SelectionForm(matches);
            selection.ShowDialog();

            // Get selection result
            Match match = (Match) selection.getSelection();

            if (match != null)
            {
                MatchForm matchForm = new MatchForm(match.Id);
                matchForm.ShowDialog();
            }
            session.Close();
        }
コード例 #4
0
        private void addTeamButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();
            IList<Object> teams = session.CreateCriteria<Team>().Add(Restrictions.IsEmpty("Tournaments")).List<Object>();
            SelectionForm selection = new SelectionForm(teams);
            selection.ShowDialog();

            // Get selection result
            Team team = (Team)selection.getSelection();

            Tournament tournament = session.Load<Tournament>(tournamentId);

            if (team != null)
            {
                tournament.Teams.Add(team);
                session.Flush();
            }
            session.Close();
        }
コード例 #5
0
        private void addAssociationButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();
            IList<Object> associations = session.CreateCriteria<Association>().Add(Restrictions.IsEmpty("Tournaments")).List<Object>();
            SelectionForm selection = new SelectionForm(associations);
            selection.ShowDialog();

            // Get selection result
            Association association = (Association) selection.getSelection();

            Tournament tournament = session.Load<Tournament>(tournamentId);

            if(association != null)
            {
                tournament.Associations.Add(association);
                session.Flush();
            }
            session.Close();
        }
コード例 #6
0
        private void removeTeamButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();
            Tournament tournament = session.Load<Tournament>(tournamentId);
            SelectionForm selection = new SelectionForm(tournament.Teams);
            selection.ShowDialog();

            // Get selection result
            Team team = (Team)selection.getSelection();

            if (team != null)
            {
                tournament.Teams.Remove(team);
                session.Flush();
            }
            session.Close();
        }
コード例 #7
0
        private void removeAssociationsButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();

            Tournament tournament = session.Load<Tournament>(tournamentId);

            SelectionForm selection = new SelectionForm(tournament.Associations);
            selection.ShowDialog();

            // Get selection result
            Association association = (Association) selection.getSelection();

            if (association != null)
            {
                tournament.Associations.Remove(association);
                session.Flush();
            }
            session.Close();
        }
コード例 #8
0
        private void loadTournamentButton_Click(object sender, EventArgs e)
        {
            ISession session = DatabaseManager.Instance.OpenSession();
            IList<Object> tournaments = session.QueryOver<Object>("Tournament").List();
            SelectionForm selection = new SelectionForm(tournaments);
            selection.ShowDialog();

            // Get selection result
            Tournament tournament = (Tournament) selection.getSelection();

            session.Close();

            if (tournament != null)
            {
                Form tournamentSetupForm = new TournamentSetupForm(tournament.Id);
                tournamentSetupForm.Show();
                Close();
            }
        }