public static bool ReturnBinaryGender(Bracket b)
 {
     if (b.Gender == GlobalVars.GenderEnum.Man)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        internal static void CreateNewBracket(int ContID)
        {
            // first check unplacedList to remove
            if (VisualUnplacedBracketsList.Any(x => x.SystemID == ContID) == true)
            {
                var cont = VisualUnplacedBracketsList.Where(x => x.SystemID == ContID).Select(c => c).Single();
                // remove from unplaced area
                VisualUnplacedBracketsList.Remove(cont);
            }
            else
            {
                // remove from Bracket area
                RemoveContender(ContID);
            }

            // the old visual contender will be disposd in order to remove from GUI
            var NewBracketVisualContToDispose = AllVisualContenders.Where(x => x.SystemID == ContID).Select(c => c).Single();
            // new visual contender will be created for the new bracket
            var NewBracketCont = AllVisualContenders.Where(x => x.SystemID == ContID).Select(c => c.Contender).Single();

            // remove from AllvisualContenders list (will be created again later)
            AllVisualContenders.Remove(NewBracketVisualContToDispose);
            // dispose old visual contender and he will dissapear from his old place in GUI
            NewBracketVisualContToDispose.Vcontender.Dispose();
            NewBracketVisualContToDispose = null;

            // create a new bracket
            MartialArts.Bracket newBracket = new MartialArts.Bracket(NewBracketCont.AgeCategory, NewBracketCont.Belt, NewBracketCont.WeightCategory);
            newBracket.AddSingleContender(NewBracketCont);
            // create a new visual bracket
            VisualBracket newVisualBracket = new VisualBracket(newBracket);

            newVisualBracket.Init();
            // add to bracket list
            VisualBracketsList.Add(newVisualBracket);
            // add to panel
            FormObj.BracktsFPanel.Controls.Add(newVisualBracket.Vbracket);
            // add the"new" visual contender to AllContenderList (he was removed) in order to find him in searches
            AllVisualContenders.Add(newVisualBracket.VisualCont[0]);
            // scroll to end of the panel to show the user the new bracket, first wait for weak graphic cards
            System.Threading.Thread.Sleep(50);
            FormObj.BracktsFPanel.VerticalScroll.Value = FormObj.BracktsFPanel.VerticalScroll.Maximum;
            // refresh clocks
            FormObj.UpdateClocks();
        }
        private void BuiledBracket(List <Contenders.Contender> br, Dictionary <int, double> IdAndScore)
        {
            // bracket data
            int HighestAge    = br.Max(x => x.AgeCategory);
            int HighestBelt   = br.Max(x => x.Belt);
            int HighestWeight = br.Max(x => x.WeightCategory);

            GlobalVars.GenderEnum bracketGender;
            if (br.All(x => x.IsMale == true))
            {
                bracketGender = GlobalVars.GenderEnum.Man;
            }
            else if (br.All(x => x.IsMale == false))
            {
                bracketGender = GlobalVars.GenderEnum.Woman;
            }
            else
            {
                bracketGender = GlobalVars.GenderEnum.Mixed;
            }

            MartialArts.Bracket b = new Bracket(HighestAge, HighestBelt, HighestWeight);
            // add contenders
            b.AddContenders(br);
            // add to brackets list
            BracketsList.Add(b);
            // reduce the contenders from the contendersList and statistics
            foreach (Contenders.Contender c in br)
            {
                // set that contender have bracket
                c.IsPlaced = true;
                // final grade
                c.FinalGradeInBracket = IdAndScore[c.SystemID];
                RemoveItemFromList(c.SystemID, false);
            }
        }
 public VisualBracket(MartialArts.Bracket bracket)
 {
     this.Bracket = bracket;
 }