Example #1
0
 public Contest(ContestInfo info, JudgeList judges, ContestantList contestants)
 {
     this.Info          = info;
     this.Judges        = judges;
     this.Contestants   = contestants;
     SubContestBranches = new SubContestBranchList();
 }
Example #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="info">Object containing info about contest</param>
 /// <param name="judges">List of judges</param>
 /// <param name="contestants">list of contestants</param>
 public Contest(ContestInfo info, JudgeList judges, ContestantList contestants, SubContestBranchList subContestBranches)
 {
     this.Info               = info;
     this.Judges             = judges;
     this.Contestants        = contestants;
     this.SubContestBranches = subContestBranches;
 }
Example #3
0
 //
 // Default constructor
 //
 public Contest()
 {
     Info               = new ContestInfo();
     Judges             = new JudgeList();
     Contestants        = new ContestantList();
     SubContestBranches = new SubContestBranchList();
 }
        public ContestantList DeepCopy()
        {
            ContestantList contestantList = new ContestantList();

            foreach (var c in this)
            {
                contestantList.Add(new Contestant(c.ID, c.FirstName, c.LastName, c.Age, c.Email, c.Gender, c.SocialSecurityNr, c.Address, c.DiveLists.ToList()));
            }

            return(contestantList);
        }
        /// <summary>
        /// Add a new subcontest to the contest
        /// </summary>
        private void AddSubContest()
        {
            bool isDataValid = false;

            if (CheckDataInput.StringCheckFormat(View.TextBoxName.Text))
            {
                if (SubContestContestants.Count != 0)
                {
                    isDataValid = true;
                }
                else
                {
                    MessageBox.Show("En deltävling behöver minst en deltagare.");
                }
            }
            else
            {
                MessageBox.Show("Tävlingsnamn ej korrekt. Får ej innehålla specialtecken, förutom _ och -");
            }

            if (isDataValid)
            {
                // Make a copy of the gathered SubContestants
                List <Contestant> list           = SubContestContestants.ToList();
                ContestantList    contestantList = new ContestantList();
                foreach (var c in list)
                {
                    contestantList.Add(c);
                }

                // Create the subcontest
                SubContestBranch subContestBranch = new SubContestBranch(View.TextBoxName.Text, CurrentContest, contestantList);

                SubContests.Add(subContestBranch);
                View.ListViewSubContests.Items.Add(subContestBranch.Name);

                // clear the inputs
                SubContestContestants.Clear();
                ClearInputs();
            }
        }
        public ContestantList FetchContestants()
        {
            DataTable contestantDataTable = FetchSpecifiedRole("contestant");

            // Iterate through data table and add too person list
            ContestantList contestantList = new ContestantList();

            foreach (DataRow row in contestantDataTable.Rows)
            {
                Contestant contestant = new Contestant
                {
                    ID        = Int32.Parse(row["id"].ToString()),
                    FirstName = row["firstName"].ToString(),
                    LastName  = row["lastName"].ToString(),
                    Age       = Int32.Parse(row["age"].ToString()),
                    Gender    = row["gender"].ToString(),
                    Email     = row["email"].ToString()
                };

                contestantList.Add(contestant);
            }

            return(contestantList);
        }
 public SubContestBranch(string name, Contest parentContest, ContestantList branchContestants)
 {
     this.Name              = name;
     this.ParentContest     = parentContest;
     this.BranchContestants = branchContestants;
 }
 public SubContestBranch()
 {
     Name              = "-";
     ParentContest     = null;
     BranchContestants = new ContestantList();
 }