public ActionResult ScoreCardEdit(int compScoreID) { CompScore compScore = db.CompScores.Find(compScoreID); if (compScore == null) { return(HttpNotFound()); } CourseInfo cInfo = new CourseInfo(); // Get Course Details depending on course and tee colour selected int courseID = compScore.CourseID; string teeColour = compScore.TeeColour; ViewBag.scoreCard = cInfo.GetCourseDetails(Convert.ToInt32(courseID), teeColour); // Get Course Totals depending on course and tee colour - Store totals in View bag variables CourseTotals cTotals = cInfo.GetCourseTotals(Convert.ToInt32(courseID), teeColour); ViewBag.TeeColour = cTotals.teeColour; ViewBag.FrontYrds = cTotals.frontYrds; ViewBag.BackYrds = cTotals.backYrds; ViewBag.TotalYrds = cTotals.totalYrds; ViewBag.FrontPar = cTotals.frontPar; ViewBag.BackPar = cTotals.backPar; ViewBag.TotalPar = cTotals.totalPar; ViewBag.PHcap = compScore.PlayerHcap; // Store the current scores in a viewbag variable. ViewBag.CurrentScore = compScore; // Store the current points in a viewbag variable CompPoints compPoints = pScore.GetCompPoints(compScore); ViewBag.RndPoints = compPoints; return(PartialView("_ScoreCard")); }
public ActionResult ScoreCard(int?id, string teeColour, int?PHcap) { CourseInfo cInfo = new CourseInfo(); // Get Course Details depending on course and tee colour selected ViewBag.scoreCard = cInfo.GetCourseDetails(Convert.ToInt32(id), teeColour); // Blank Scores var compScore = new CompScore(); ViewBag.CurrentScore = compScore; // Blank Points CompPoints compPoints = pScore.GetCompPoints(compScore); ViewBag.RndPoints = compPoints; // Get Course Totals depending on course and tee colour - Store totals in View bag variables CourseTotals cTotals = cInfo.GetCourseTotals(Convert.ToInt32(id), teeColour); ViewBag.TeeColour = cTotals.teeColour; ViewBag.FrontYrds = cTotals.frontYrds; ViewBag.BackYrds = cTotals.backYrds; ViewBag.TotalYrds = cTotals.totalYrds; ViewBag.FrontPar = cTotals.frontPar; ViewBag.BackPar = cTotals.backPar; ViewBag.TotalPar = cTotals.totalPar; // Store the playing handicap in the ViewBag var playingHCap = 0; if (PHcap != null) { playingHCap = Convert.ToInt32(PHcap); } ViewBag.PHcap = playingHCap; return(PartialView("_ScoreCard")); }
public ActionResult PlayerScoreCard(int?compScoreID, int rndNumber) { ScoreInfo scoreInfo = new ScoreInfo(); if (compScoreID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CompScore compScore = db.CompScores.Find(compScoreID); int NumberofRnds = pStats.NumberRndsPlayed(Convert.ToInt32(compScore.CompID), compScore.CompPlayerID); if (NumberofRnds < rndNumber) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } // Get Course Logo using a stored procedure using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnValue("TigerLineScoresDB"))) { List <String> courseLogo = connection.Query <string>("dbo.spGetLogoImagePath @CourseID", new { CourseID = compScore.CourseID }).ToList(); ViewBag.CourseLogo = courseLogo[0]; } ViewBag.PHcap = compScore.PlayerHcap; ViewBag.PlayerName = pStats.GetPlayerName(compScore.CompPlayerID); ViewBag.PlayerPhoto = pStats.GetPlayerPhoto(compScore.CompPlayerID); ViewBag.PlayerHomeID = pStats.HomeClubID(compScore.CompPlayerID); ViewBag.RndDate = compScore.RndDate; ViewBag.RndNumber = rndNumber; // Score Card Image ViewBag.CardImage = compInfo.GetScoreCardImage(compScore.CompScoreID); CourseMain courseM = db.CourseMains.Find(compScore.CourseID); ViewBag.CourseName = courseM.ClubName; CompMain cMain = db.CompMains.Find(compScore.CompID); ViewBag.CompName = cMain.CompName; // Get the Course Par ViewBag.CoursePar = cInfo.GetCoursePar(compScore.CourseID, compScore.TeeColour); // Get the NET Points (Gross Points - (CoursePar - SSS)) ViewBag.NetPoints = compScore.TotalPoints - (ViewBag.CoursePar - compScore.SSS); if (compScore == null) { return(HttpNotFound()); } // Get Course Details depending on course and tee colour selected int courseID = compScore.CourseID; string teeColour = compScore.TeeColour; decimal?PHcap = compScore.PlayerHcap; ViewBag.scoreCard = cInfo.GetCourseDetails(Convert.ToInt32(courseID), teeColour); // Get Hole Scores ViewBag.CurrentScore = compScore; // Front 9 Total Score ViewBag.FrontScore = scoreInfo.FrontScore(compScore.CompScoreID); // Back 9 Total Score ViewBag.BackScore = scoreInfo.BackScore(compScore.CompScoreID); // Total Score ViewBag.TotalScore = ViewBag.FrontScore + ViewBag.BackScore; // Blank Points CompPoints compPoints = pScore.GetCompPoints(compScore); ViewBag.RndPoints = compPoints; // Get Course Totals depending on course and tee colour - Store totals in View bag variables CourseTotals cTotals = cInfo.GetCourseTotals(Convert.ToInt32(courseID), teeColour); ViewBag.TeeColour = cTotals.teeColour; ViewBag.FrontYrds = cTotals.frontYrds; ViewBag.BackYrds = cTotals.backYrds; ViewBag.TotalYrds = cTotals.totalYrds; ViewBag.FrontPar = cTotals.frontPar; ViewBag.BackPar = cTotals.backPar; ViewBag.TotalPar = cTotals.totalPar; // Store the playing handicap in the ViewBag var playingHCap = 0; if (PHcap != null) { playingHCap = Convert.ToInt32(PHcap); } ViewBag.PHcap = playingHCap; return(PartialView("_ScoreCard", compScore)); }