Exemplo n.º 1
0
        public int GetTotalPoints(int courseID, int compID)
        {
            CourseInfo cInfo      = new CourseInfo();
            var        CompScores = from cs in db.CompScores
                                    join cp in db.CompPlayers on cs.CompPlayerID equals cp.CompPlayerID
                                    join pr in db.Profiles on cp.UserID equals pr.UserID
                                    join ur in db.Users on pr.UserID equals ur.UserID
                                    where cs.CompID == compID && cs.CourseID == courseID && pr.HomeClubID == courseID
                                    select new { cs.TotalPoints, cs.TeeColour, cs.SSS, cp.CompPlayerID };

            int totalPoints = 0;

            foreach (var item in CompScores)
            {
                totalPoints += Convert.ToInt32(item.TotalPoints) - (cInfo.GetCoursePar(courseID, item.TeeColour) - Convert.ToInt32(item.SSS));
            }

            return(totalPoints);
        }
Exemplo n.º 2
0
        // Get Total Points (Player / Comp) **** BEST 10 Scores ****
        public int TotalNETPoints(int CompID, int CompPlayerID)
        {
            int totalNETPoints    = 0;
            var GetTotalNETPoints = from tp in db.CompScores
                                    where tp.CompID == CompID && tp.CompPlayerID == CompPlayerID
                                    orderby tp.TotalPoints descending
                                    select tp;

            int ptnCount = 1;

            foreach (var item in GetTotalNETPoints)
            {
                if (item.TotalPoints != null && ptnCount <= 10)
                {
                    totalNETPoints += Convert.ToInt32(item.TotalPoints) - (cInfo.GetCoursePar(item.CourseID, item.TeeColour) - Convert.ToInt32(item.SSS));
                    ptnCount       += 1;
                }
            }
            return(totalNETPoints);
        }