示例#1
0
        public FormTip(Match match)
        {
            InitializeComponent();

            Match = match;
            rButtons = new List<RadioButton>();
            coefficients = new List<Coefficient>();
            labels = new List<Label>();

            rButtons.Add(radioButton1);
            rButtons.Add(radioButton2);
            rButtons.Add(radioButton3);
            rButtons.Add(radioButton4);
            rButtons.Add(radioButton5);
            rButtons.Add(radioButton6);
            rButtons.Add(radioButton7);


            labels.Add(label1);
            labels.Add(label2);
            labels.Add(label3);
            labels.Add(label4);
            labels.Add(label5);
            labels.Add(label6);
            labels.Add(label7);
        }
示例#2
0
		public MainForm()
		{
			var board = new DartBoard { Dock = DockStyle.Fill };
			Controls.Add(board);
			match = new Match("1", new[] { "John", "Elis" }, 501, 5);
			board.OnSectorClick += result => Text = result.ToString();
		}
        public FrmReportEmailSend(Match match, Club homeClub, Team homeTeam, Club guestClub, Team guestTeam)
        {
            InitializeComponent();

            txtSubject.Text = "Utakmica br. " + match.MatchId + ": " + homeClub.Name + " - " + guestClub.Name;
            txtMailBody.Text = "Rezultat utakmice br. " + match.MatchId + ": \n" +
                homeClub.Name + " - " + guestClub.Name + " " + homeTeam.Goals + ":" + guestTeam.Goals;
            txtRemarks.Text = "";
        }
        /*Кнопка добавление турнира*/
        private void addMatchButton_Click(object sender, EventArgs e)
        {
            /*Идентификаторы выбранных участников или команд*/
            int firstID  = int.Parse(firstItemComboBox.SelectedValue.ToString());
            int secondID = int.Parse(secondItemComboBox.SelectedValue.ToString());

            logger.Info(firstID.ToString());
            logger.Info(secondID.ToString());

            /*С самим собой драться нельзя*/
            if(firstID == secondID)
            {
                logger.Info("Совпадение ID");
                MessageBox.Show("ID не могут совпадать!",
                    "Ошибка",
                    buttons: MessageBoxButtons.OK,
                    icon: MessageBoxIcon.Error);
                return;
            }

            Tournament tourn = tourtab.Tournament.Where(x => x.Id == tournamentID).Select(x => x).First();

            Match mtc = new Match();
            mtc.Round = int.Parse(currentRound.Text);
            mtc.Tournament_id = tournamentID;

            /*Если командный*/
            if((bool)tourn.Sport.Teams)
            {
                mtc.Team1_id = firstID;
                mtc.Team2_id = secondID;
                mtc.Score_1 = 0;
                mtc.Score_2 = 0;
            }
            /*Если для участников*/
            else
            {
                mtc.Part1_id = firstID;
                mtc.Part2_id = secondID;
                mtc.Score_1 = 0;
                mtc.Score_2 = 0;
            }

            if(tourn.Match == 0)
            {
                tourn.Match = 1;
            }
            tourn.Match += 1;

            tourtab.Match.InsertOnSubmit(mtc);
            tourtab.SubmitChanges();

            generateMatchTable(int.Parse(currentRound.Text));
        }
        public FrmMatchReport(Match match, Club homeClub, Club guestClub, Team homeTeam, Team guestTeam,
            BindingList<TeamPlayer> homeTeamPlayers, BindingList<TeamPlayer> guestTeamPlayers,
            BindingList<TeamOfficial> homeTeamOfficials, BindingList<TeamOfficial> guestTeamOfficials, string refereePairName)
        {
            InitializeComponent();

            this.Match = match;
            this.HomeClub = homeClub;
            this.GuestClub = guestClub;
            this.HomeTeam = homeTeam;
            this.GuestTeam = guestTeam;
            this.refereePairName = refereePairName;
            this.HomeTeamPlayers = homeTeamPlayers;
            this.GuestTeamPlayers = guestTeamPlayers;
            this.HomeTeamOfficials = homeTeamOfficials;
            this.GuestTeamOfficials = guestTeamOfficials;
        }
        private Match createMatch(int id)
        {
            DateTime matchDate;
            int matchRound;
            int matchHomeTeam;
            int matchGuestTeam;
            
            using(OracleConnection connection = new OracleConnection(FormLogin.connString)){
                connection.Open();
                String queryGetMatch = "SELECT * FROM Match WHERE idMatch = "+id;
                OracleCommand command = new OracleCommand(queryGetMatch, connection);
                OracleDataReader reader = command.ExecuteReader();
                reader.Read();
                id = reader.GetInt32(0);
                matchDate = reader.GetDateTime(1);
                matchRound = reader.GetInt32(2);
                matchGuestTeam = reader.GetInt32(3);
                matchHomeTeam = reader.GetInt32(4);
            }
            Match m = new Match(id, matchHomeTeam, matchGuestTeam, matchRound, matchDate);
            return m;

        }
示例#7
0
        /**
         * Shows the AI's guess on the screen, with the appropriate pegs for the match it received.
         * The bool return value signifies whether game is over or not, which is handled by play(), this function's caller.
         */
        private bool showOnGui(ColorSequence guess, Match m)
        {
            int x;
            // show the guess on the screen
            for (x = 0; x < DEPTH; x++)
            {
                mastermind.holes[x, mastermind.activeRow].Image = mastermind.images[log2(guess[x])];
            }
            // show appropriate pins for the match
            x = 0;
            for (int i = 0; i < m.blackHits; i++)
                mastermind.pegs[x++, mastermind.activeRow - 1].Image = mastermind.blackPegImage;
            for (int i = 0; i < m.whiteHits; i++)
                mastermind.pegs[x++, mastermind.activeRow - 1].Image = mastermind.whitePegImage;
            for (; x < DEPTH; x++)
                mastermind.pegs[x, mastermind.activeRow - 1].Image = mastermind.emptyPegImage;
            for (x = 0; x < DEPTH; x++)
                mastermind.pegs[x, mastermind.activeRow - 1].Visible = true;

            mastermind.Refresh();

            // check for game end conditions
            if (m.blackHits == DEPTH)
            {
                cleanUp();
                TimeSpan ts = stopWatch.Elapsed;
                MessageBox.Show("The AI cracked the code in " + ( 9 - mastermind.activeRow) + " attempts! Processing took " + ts.Minutes + ":" + ts.Seconds + "." + ts.Milliseconds, "Computer wins!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return true;
            }
            else
            {
                mastermind.progressBar.Location = new Point(mastermind.progressBar.Location.X, mastermind.progressBar.Location.Y - 55);
                mastermind.lblPossibilities.Location = new Point(mastermind.lblPossibilities.Location.X, mastermind.lblPossibilities.Location.Y - 55);
                if (--mastermind.activeRow == 0) // ran out of attempts, they lose
                {
                    cleanUp();
                    TimeSpan ts = stopWatch.Elapsed;
                    MessageBox.Show("The AI failed to crack the code in 8 attempts. Bad luck!Processing took " + ts.Minutes + ":" + ts.Seconds + "." + ts.Milliseconds, "Computer loses!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return true;
                }                
            }
            return false;
        }
        public FrmAddMatchDetails(Match match)
        {
            InitializeComponent();

            this.Match = match;

            this.MatchDetailsAddSuccess = false;

            this.Leagues = new BindingList<League>(db.League.ToList());
            this.Halls = new BindingList<Hall>(db.Hall.ToList());
            this.RefereePairs = new BindingList<RefereePair>(db.RefereePair.ToList());
            this.Delegates = new BindingList<Delegate>(db.Delegate.ToList());

            cbxLeague.DataSource = this.Leagues;
            cbxHall.DataSource = this.Halls;
            cbxRefereePair.DataSource = this.RefereePairs;
            cbxDelegate.DataSource = this.Delegates;

            dtpDateTime.MinDate = DateTime.Now;
            dtpDateTime.Value = DateTime.Now.AddMinutes(15);

            if(match.MatchId != 0)
            {
                txtRound.Value = this.Match.Round;
                txtSpectators.Value = this.Match.Spectators;
                txtScorer.Text = this.Match.Scorer;
                txtTimeKeeper.Text = this.Match.TimeKeeper;

                dtpDateTime.Value = new DateTime(this.Match.Date.Year, this.Match.Date.Month, this.Match.Date.Day,
                    this.Match.Time.Hours, this.Match.Time.Minutes, 0);

                foreach(object row in cbxLeague.Items)
                {
                    League data = (League)row;
                    if(data.LeagueId == this.Match.LeagueId)
                    {
                        cbxLeague.SelectedItem = row;
                        break;
                    }
                }

                foreach (object row in cbxHall.Items)
                {
                    Hall data = (Hall)row;
                    if (data.HallId == this.Match.HallId)
                    {
                        cbxLeague.SelectedItem = row;
                        break;
                    }
                }

                foreach (object row in cbxRefereePair.Items)
                {
                    RefereePair data = (RefereePair)row;
                    if (data.RefereePairId == this.Match.RefereePairId)
                    {
                        cbxLeague.SelectedItem = row;
                        break;
                    }
                }

                foreach (object row in cbxDelegate.Items)
                {
                    Delegate data = (Delegate)row;
                    if (data.DelegateId == this.Match.DelegateId)
                    {
                        cbxLeague.SelectedItem = row;
                        break;
                    }
                }
            }
        }
        private void matchNewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            panelMain.Show();
            panelMain.Enabled = true;

            lblTeamA.Text = "";
            lblTeamB.Text = "";

            lblResultA.Text = "0";
            lblResultB.Text = "0";

            txtTeamATTO1.Text = "";
            txtTeamATTO2.Text = "";
            txtTeamATTO3.Text = "";
            txtTeamBTTO1.Text = "";
            txtTeamBTTO2.Text = "";
            txtTeamBTTO3.Text = "";

            btnTeamATTO1.Enabled = false;
            btnTeamATTO2.Enabled = false;
            btnTeamATTO3.Enabled = false;

            btnTeamBTTO1.Enabled = false;
            btnTeamBTTO2.Enabled = false;
            btnTeamBTTO3.Enabled = false;

            btnHomeGoal.Enabled = false;
            btnGuestGoal.Enabled = false;
            btnHome7m.Enabled = false;
            btnGuest7m.Enabled = false;
            btnHomeWarning.Enabled = false;
            btnGuestWarning.Enabled = false;
            btnHomeSuspension.Enabled = false;
            btnGuestSuspension.Enabled = false;
            btnHomeDisqualification.Enabled = false;
            btnGuestDisqualification.Enabled = false;
            btnHomeDisqualificationReport.Enabled = false;
            btnGuestDisqualificationReport.Enabled = false;
            btnHomeUndo.Enabled = false;
            btnGuestUndo.Enabled = false;

            btnHomeOfficialWarning.Enabled = false;
            btnGuestOfficialWarning.Enabled = false;
            btnHomeOfficialSuspension.Enabled = false;
            btnGuestOfficialSuspension.Enabled = false;
            btnHomeOfficialDisqualification.Enabled = false;
            btnGuestOfficialDisqualification.Enabled = false;
            btnHomeOfficialUndo.Enabled = false;
            btnGuestOfficialUndo.Enabled = false;

            this.Match = new Match();

            this.HomeClub = new Club();
            this.GuestClub = new Club();

            this.HomePlayers = new BindingList<Player>();
            this.GuestPlayers = new BindingList<Player>();

            this.HomeClubOfficials = new BindingList<ClubOfficial>();
            this.GuestClubOfficials = new BindingList<ClubOfficial>();

            this.dataMatchDetailsToolStripMenuItem.Enabled = true;
            this.dataTeamsToolStripMenuItem.Enabled = true;
            this.dataPlayersToolStripMenuItem.Enabled = true;
            this.dataOfficialsToolStripMenuItem.Enabled = true;

            this.matchSaveToolStripMenuItem.Enabled = true;
            this.matchConcludeToolStripMenuItem.Enabled = true;
            this.matchCloseToolStripMenuItem.Enabled = true;

            this.reportPrintToolStripMenuItem.Enabled = true;
            this.reportSendToolStripMenuItem.Enabled = true;

            this.SavedTeams = false;
            this.SavedPlays = false;
            this.SavedManages = false;

            dgvHomeTeam.DataSource = null;
            dgvGuestTeam.DataSource = null;
            dgvHomeTeam.Refresh();
            dgvGuestTeam.Refresh();

            dgvHomeOfficials.DataSource = null;
            dgvGuestOfficials.DataSource = null;
            dgvHomeOfficials.Refresh();
            dgvGuestOfficials.Refresh();
        }
        private void matchCloseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "Jeste li sigurni da želite zatvoriti utakmicu?\nPristup utakmici će biti onemogućen.",
                "Zatvori utakmicu", MessageBoxButtons.YesNo, MessageBoxIcon.Question).Equals(DialogResult.Yes))
            {
                this.Match = null;

                this.HomeClub = null;
                this.HomePlayers = null;
                this.HomePlays = null;
                this.HomeClubOfficials = null;
                this.HomeManages = null;

                this.GuestClub = null;
                this.GuestPlayers = null;
                this.GuestPlays = null;
                this.GuestClubOfficials = null;
                this.GuestManages = null;

                lblTeamA.Text = "";
                lblTeamB.Text = "";
                lblResultA.Text = "0";
                lblResultB.Text = "0";
                lblTimeMinutes.Text = "00";
                lblTimeSeconds.Text = "00";

                this.dataMatchDetailsToolStripMenuItem.Enabled = false;
                this.dataTeamsToolStripMenuItem.Enabled = false;
                this.dataPlayersToolStripMenuItem.Enabled = false;
                this.dataOfficialsToolStripMenuItem.Enabled = false;

                this.matchSaveToolStripMenuItem.Enabled = false;
                this.matchConcludeToolStripMenuItem.Enabled = false;
                this.matchCloseToolStripMenuItem.Enabled = false;

                this.reportPrintToolStripMenuItem.Enabled = false;
                this.reportSendToolStripMenuItem.Enabled = false;

                panelMain.Hide();
            }
        }
        // Triggered when each innings has been completed, either due to declaration, weather or full result
        public void End_Of_Innings()
        {
            if (Innings_Id == 0)
            {
                InningsList[0].Notes = First_Inn_Notes_Textbox.Text;
                Innings1fallOfWicketList = FallOfWicketList;
                Innings1BatsmanList = BatList;
                Innings1BowlerList = BowlList;
                Innings1OverList = OverAnalysisList;
                Innings_1_Score = InningsList[0].Team_Name + "," + InningsList[0].Innings_Total.ToString() + "-" + InningsList[0].Innings_Wickets.ToString();
                Scoring_App_Tab_Set.SelectedTab = Second_Inn_Select_Tab;
                Innings_Of = Second_Inn_Tab.Text;
            }
            else
            {
                Innings2fallOfWicketList = FallOfWicketList;
                InningsList[1].Notes = Second_Inn_Notes_Textbox.Text;
                Innings2BatsmanList = BatList;
                Innings2BowlerList = BowlList;
                Innings_2_Score = InningsList[1].Team_Name + "," + InningsList[1].Innings_Total.ToString() + "-" + InningsList[1].Innings_Wickets.ToString();

                Match match = new Match();
                match.Save_Match_Result(Innings1BatsmanList, Innings1BowlerList, Innings2BatsmanList, Innings2BowlerList, Home_Team, Away_Team, InningsList[0].Date, Innings_1_Score, Innings_2_Score, match.Get_Match_Result(InningsList), this.folderName);
            }
        }
        // Load function to read all text files created in the previous form, information is stored into the applications lists
        private void Scoring_Application_Form_Load(object sender, EventArgs e)
        {
            // On load the innings to be scored is the first innings
            Innings_Id = 0;

            Match match = new Match();
            Match awayTeamHandler = new Match();

            // Storing match and team details into lists
            MatchDetailsList = match.GetMatchDetails(this.folderName);
            HomeTeamList = match.GetTeamDetails(MatchDetailsList[1], this.folderName);
            AwayTeamList = awayTeamHandler.GetTeamDetails(MatchDetailsList[2], this.folderName);

            // Insert team names into the Toss Winner combo box on the Opener Selection tab
            Toss_Winner_Combo_Box.Items.Clear();
            Toss_Winner_Combo_Box.Items.Add(MatchDetailsList[1]);
            Toss_Winner_Combo_Box.Items.Add(MatchDetailsList[2]);

            // Insert team names into the Batting Side combo box on the Opener Selection tab
            Open_Select_Bat_Side.Items.Clear();
            Open_Select_Bat_Side.Items.Add(MatchDetailsList[1]);
            Open_Select_Bat_Side.Items.Add(MatchDetailsList[2]);
        }
 public FormMatchDetails(Match m)
 {
     InitializeComponent();
     match = createMatch(m.Id);
     init();
 }
示例#14
0
 private List<Match> SampleMatches(QueryGraph qg)
 {
     int matchNum = 20;
     Random ra = new Random();
     List<Match> res = new List<Match>();
     for (int i = 0; i < matchNum; ++i)
     {
         Match m = new Match();
         foreach (long cid in qg.CellIDSet)
         {
             NodePair np = new NodePair(cid, ra.Next());
             m.PartialMatch.Add(np);
         }
         res.Add(m);
     }
     return res;
 }