private void UpdateLeaderBoardPersonalBest() { try { LearningGames lg = new LearningGames(); RegisterLogin rl = new RegisterLogin(); ModelLeaderBoard mlb = new ModelLeaderBoard { USER_LIBRARY_CARD_ID = currentUser }; List <ModelLeaderBoard> getPersonalBest = lg.GetPersonalBestIdentifyingAreas(mlb, connectionString); tbPBSCore.Text = getPersonalBest[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString(); if (getPersonalBest.Count == 1) { tbPBSCore.Text = getPersonalBest[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString(); } getAllRecords = lg.GetIdentifyingAreasChampion(connectionString); if (getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST == 0) { tbChampionName.Text = "No Champion Yet !"; } else { tbChampScore.Text = getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString(); List <ModelLeaderBoard> getBestUserId = lg.GetChampionNameIdentifyingAreas(getAllRecords[0].IDENTIFYING_AREAS_PERSONAL_BEST.ToString(), connectionString); int id = getBestUserId[0].USER_LIBRARY_CARD_ID; if (id == currentUser) { isChamp = true; } List <ModelRegisterLogin> getBestUser = rl.GetUser(id, connectionString); tbChampionName.Text = getBestUser[0].USER_FNAME + " " + getBestUser[0].USER_LNAME; } } catch (Exception) { tbChampionName.Text = "No Champion Yet !"; } }
private void InsertUpdateRecords() { LearningGames lg = new LearningGames(); ModelLeaderBoard mlb = new ModelLeaderBoard { USER_LIBRARY_CARD_ID = currentUser, IDENTIFYING_AREAS_PERSONAL_BEST = userCurrentScore }; List <ModelLeaderBoard> rec = lg.GetPersonalBestIdentifyingAreas(mlb, connectionString); if (rec.Count == 0) { lg.InsertNewPersonalBestIdentifyingAreas(mlb, connectionString); } else { lg.UpdateNewPersonalBestIdentifyingAreas(mlb, connectionString); } }