Esempio n. 1
0
        public clsLoadSavedMatch(string path)
        {
            SqlCeConnection currentCon = connection.getConnection(path);
            SqlCeCommand    com        = new SqlCeCommand("SELECT matchId FROM tblTeam", currentCon);
            int             matchId    = 0;

            int.TryParse(com.ExecuteScalar().ToString(), out matchId);

            clsMatch match = new clsMatch();

            clsFormCreater.openForm(new frmCaptureVideo());
        }
Esempio n. 2
0
        public clsMatch(int matchid, string mName, clsMatchTypes type, DateTime mDate, string mPath, clsCountry country, clsGround ground, List <clsTeams> squad, string tossWon, string firstBat)
        {
            matchID   = matchid;
            matchName = mName;
            matchType = type;
            matchDate = mDate;

            savePath       = mPath;
            countryPlayed  = country;
            groundPlayed   = ground;
            currentSquards = squad;

            tossWonBy    = tossWon;
            firstBatting = firstBat;

            team1 = squad[0];
            team2 = squad[1];

            //currentMatch = this;
            currentMatch = this;
        }
Esempio n. 3
0
 public clsMatch(clsMatch mt)
 {
     currentMatch = mt;
 }
Esempio n. 4
0
        public static List <clsMatch> getAllMatches()
        {
            List <clsMatch> matchList = new List <clsMatch>();

            SqlCeCommand     com = new SqlCeCommand("SELECT * FROM tblMatch", connection.CON);
            DataSet          ds  = new DataSet("tblMatch");
            SqlCeDataAdapter ad  = new SqlCeDataAdapter(com);

            ad.Fill(ds, "tblMatch");

            foreach (DataRow r in ds.Tables["tblMatch"].Rows)
            {
                string          savePath = r[9].ToString();
                List <clsTeams> squard   = new List <clsTeams>();
                clsTeams        team1    = new clsTeams();
                clsTeams        team2    = new clsTeams();

                int team1CountryId = Convert.ToInt32(r[5].ToString());
                int team2CountryId = Convert.ToInt32(r[6].ToString());



                team1.country = clsCountry.getCountry(clsCountry.getCountryName(team1CountryId));
                team2.country = clsCountry.getCountry(clsCountry.getCountryName(team2CountryId));
                SqlCeConnection con_temp = connection.getConnection(savePath);

                if (con_temp != null)
                {
                    SqlCeCommand     com1 = new SqlCeCommand("SELECT playerId, countryId FROM tblTeam", con_temp);
                    DataSet          ds1  = new DataSet("tblTeam");
                    SqlCeDataAdapter ad1  = new SqlCeDataAdapter(com1);
                    ad1.Fill(ds1, "tblTeam");

                    //Get the two teams // Inner loop
                    foreach (DataRow r1 in ds1.Tables["tblTeam"].Rows)
                    {
                        //If it is team 1 (Country 1)
                        if (Convert.ToInt32(r1[1].ToString()) == team1CountryId)
                        {
                            //clsPlayer pp=clsPlayer.getPlayer(Convert.ToInt32(r1[0].ToString()));
                            team1.players.Add(clsPlayer.getPlayer(Convert.ToInt32(r1[0].ToString())));
                        }
                        else
                        {
                            team2.players.Add(clsPlayer.getPlayer(Convert.ToInt32(r1[0].ToString())));
                        }
                    }

                    squard.Add(team1);
                    squard.Add(team2);

                    clsMatch mt = new clsMatch(Convert.ToInt32(r[0].ToString()), r[1].ToString(), clsMatchTypes.getMatchType(Convert.ToInt32(r[7].ToString())), Convert.ToDateTime(r[2].ToString()), r[9].ToString(), clsCountry.getCountry(clsCountry.getCountryName(Convert.ToInt32(r[3].ToString()))), clsGround.getGround(Convert.ToInt32(r[4].ToString())), squard, "toss won", "First bat");
                    matchList.Add(mt);
                }
            }



            com.Dispose();

            return(matchList);
        }