상속: System.Windows.Forms.UserControl
예제 #1
0
        //Eventhanlder click Del button to Delete team
        void AddTeam_onDelete(object sender, EventArgs e)
        {
            Add_Team AddTeam = new Add_Team();
            int teamID = (e as MyEventArgs).IDTeam;
            foreach (Add_Team item in ts.flp_Team.Controls)
            {
                if (item.ID_Team == teamID)
                {
                    Player.IDPlayer = Convert.ToInt32(item.lbl_IDPlayer.Text.Trim());
                    if (PlayerBL.DeletePlayerbyID(Player))
                    {
                        ts.flp_Team.Controls.Remove(item);
                    }
                    else
                    {
                        MessageBox.Show("Cant delete teamplayer.");
                    }

                }

            }
        }
예제 #2
0
        //Add Team
        private void btn_AddTeam_Click(object sender, EventArgs e)
        {
            int count = 0;
            foreach (Add_Team item in flp_Team.Controls)
            {
                count++;
            }
            if (count < 4)
            {
                Add_Team AddPhase = new Add_Team();
                i++;
                AddPhase.Tag = i;
                AddPhase.ID_Team = i;
                AddPhase.onDelete += AddTeam_onDelete;
                AddPhase.txt_Sequence.Text = (i).ToString();
                //AddPhase.lbl_Number.Text = i.ToString();
                flp_Team.Controls.Add(AddPhase);

                //for (int j = 0; j < flp_Team.Controls.Count; j++)
                //{
                //    AddPhase.txt_Sequence.Text = (j + 1).ToString();
                //}
            }
            else
            {
                MessageBox.Show("Hệ thống cho phép nhập tối đa là 4 đội.", "Cảnh Báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #3
0
        //Load Team Setting
        public void LoadTeamSetting()
        {
            ts.flp_Team.Controls.Clear();
            List<Player> ListPlayer;
            ListPlayer = PlayerBL.GetPlayer();
            if (ListPlayer != null)
            {
                for (int j  = 0; j < ListPlayer.Count; j++)
                {
                    if (ListPlayer.ElementAt(j).IDContest == IdContest)
                    {
                        Add_Team AddTeam = new Add_Team();
                        TeamTag++;
                        AddTeam.Tag = TeamTag;
                        AddTeam.ID_Team = TeamTag;
                        AddTeam.onDelete += AddTeam_onDelete;

                        AddTeam.lbl_IDPlayer.Text = ListPlayer.ElementAt(j).IDPlayer.ToString();
                        AddTeam.txt_Sequence.Text = ListPlayer.ElementAt(j).Sequence.ToString();
                        AddTeam.txt_TeamName.Text = ListPlayer.ElementAt(j).PlayerName.ToString();
                        AddTeam.txt_TeamScore.Text = ListPlayer.ElementAt(j).PlayerScore.ToString();
                        //AddTeam.btn_Paint.BackColor = Color.FromName(ListPlayer.ElementAt(j).Color);
                        //AddTeam.pnl_ColorCoat.BackColor = Color.FromName(ListPlayer.ElementAt(j).Color);
                        AddTeam.btn_Paint.BackColor = Color.FromArgb(Convert.ToInt32(ListPlayer.ElementAt(j).Color));
                        AddTeam.pnl_ColorCoat.BackColor = Color.FromArgb(Convert.ToInt32(ListPlayer.ElementAt(j).Color));
                        ts.flp_Team.Controls.Add(AddTeam);
                    }
                }
            }
        }
예제 #4
0
        //Eventhanlder click Del button
        void AddTeam_onDelete(object sender, EventArgs e)
        {
            int i = 1;
            Add_Team AddPhase = new Add_Team();
            int teamID = (e as MyEventArgs).IDTeam;
            foreach (Add_Team item in flp_Team.Controls)
            {
                if (item.ID_Team == teamID)
                {
                    flp_Team.Controls.Remove(item);
                }

            }
            foreach (Add_Team item in flp_Team.Controls)
            {
                item.txt_Sequence.Text = (i++).ToString();
            }
        }