public List <Teem> makeTeam_QueryBy_Continnent(int ContinnentArea)
        { // Done
            List <Teem> teems = new List <Teem>();
            //SqlCommand command = new SqlCommand(Query + " where team = " + ContinnentArea.ToString(), makeConnection("open"));
            String GivenCommand = "select * from [team] where region in " +
                                  $"(select id_region from region where region.id_region = {ContinnentArea})";
            SqlCommand    command = new SqlCommand(GivenCommand, makeConnection("open"));
            SqlDataReader reader  = command.ExecuteReader();

            Console.WriteLine("Did come to here");

            while (reader.Read())
            {
                Teem teemObject = new Teem();
                //teemObject.AddplayerToTeem(reader["playername"].ToString());
                teemObject.teemindexing  = (int)reader["id_team"];
                teemObject.Coach         = reader["coach"].ToString();
                teemObject.CountryName   = reader["name"].ToString();
                teemObject.ContinentCode = ContinnentArea;
                teems.Add(teemObject);
                //Console.WriteLine(teem.ContinentCode.ToString());
            }
            closeConnection(makeConnection("close"));
            foreach (var item in teems)
            {
                item.listOfPlayer = GetPlayerByTeem(item.teemindexing);
            }
            return(teems);
        }
        public Teem startFinal(Teem teemA, Teem teemB)
        {
            match.TeemA = teemA;
            match.TeemB = teemB;
            match.who_Is_Winning();

            return(match.Winner);
        }
        //public List<String> getPlayer(String Query)
        //{
        //    List<String> tempReturn = new List<string>();

        //    SqlConnection connection1 = new SqlConnection();
        //    connection1.ConnectionString = path_connection;
        //    connection1.Open();
        //    SqlCommand command = new SqlCommand(Query,connection1);
        //    return tempReturn;
        //}


        /*GROUND:
         *
         */
        public bool WriteMatchToDB(Teem teemA, Teem teemB, int stage = 0, int ground = 0, string sroce = "")
        {
            // this fuction write to Database which ref stage or ground if them are not 0 then it consider a legit match
            String GivenCommand = "INSERT INTO game(stage, ground, teamA, teamB, score) "
                                  + $"VALUES({stage},{ground}," + @"'" + $"{ teemA.CountryName}" + @"'" + "," + @"'" + $"{teemB.CountryName}" + @"'" + "," + @"'" + $"{sroce}" + @"'" + ")";
            SqlCommand command = new SqlCommand(GivenCommand, makeConnection("open"));

            command.ExecuteNonQuery();
            makeConnection("close");
            return(true);
        }
示例#4
0
 private void RandomplayerGoal(Teem teem, int teemSroce)
 {
     // Distribute player Sroce by it teem sroce
     //Encapsulation method
     while (teemSroce > 0)
     {
         int _sroce          = random.Next(1, teemSroce);
         int selected_player = random.Next(0, teem.listOfPlayer.Count);
         teem.listOfPlayer[selected_player]._Pesonalsroce = _sroce;
         teemSroce = teemSroce - _sroce;
     }
 }
示例#5
0
        public int writeResultToDatabase(Teem Winner, Teem Losser, int stage = 0, int ground = 0, string sroce = "")
        {
            DatabaseConnector database = new DatabaseConnector();

            if (database.WriteMatchToDB(Winner, Losser, stage, ground, sroce))
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
示例#6
0
 public void PlayoffStage(Teem teemA, Teem teemB, Teem teemC, Teem teemD)
 {
     Match match = new Match();
 }