public ShootingTrainingData GetShootingTrainingRecord(int id) { ShootingTrainingData sh = new ShootingTrainingData(); try { string str = "SELECT * FROM `shootingtraining` WHERE UserId=" + id; MySqlCommand comm = new MySqlCommand(str, dbConnection); comm.CommandTimeout = 30; MySqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { sh.weaponName = reader.GetString(1); sh.bulletNumbers = reader.GetInt32(2); sh.shootingAccuracyGPA = reader.GetString(3); sh.shootingRange = reader.GetInt32(4); sh.accuracy = reader.GetFloat(5); } reader.Close(); } catch (Exception e) { Debug.LogError("Error While get Training Shooting Record "); Debug.LogError(e.ToString()); ErrorDialougText.color = Color.red; ErrorDialougText.text = "there is no user with this Id to add record to it "; } return(sh); }
//Set Shoooting Test Data //Send All the Data for it's class to handle it //Training Data sent to Trainig class to store public void SetTrainingShootingDataForSpecificUser(ShootingTrainingData trainignData) { shootingData.SetShootingTrainingData(trainignData); }
//Set current Changes in the Training Scene for Specific User public void SetShootingTrainingData(ShootingTrainingData trainingData) { CurrentChangesOnShootingTrainingData.Add(trainingData); }