public static GameResults InsertGameResult(String UserName, String Password, GameListEnum gameType, int Score, decimal TestDuration, int Total) { GameResults results = new GameResults(); try { LoginResult loginResult = LoginResult.ValidateLogin(UserName, Password, String.Empty); if (loginResult.Success) { AgileMindEntities db = new AgileMindEntities(); t_GameResults gameResults = new t_GameResults(); gameResults.Created = DateTime.Now; gameResults.GameId = (int)gameType; gameResults.LoginId = loginResult.LoginInfo.LoginId; gameResults.Score = Score; gameResults.TestDuration = TestDuration; gameResults.Total = Total; db.t_GameResults.AddObject(gameResults); db.SaveChanges(); results.Success = true; results.Game = gameResults; } else { results.Error = "Could not login. Invalid Username/Password"; } } catch (Exception ex) { results.Error = ex.Message; } return results; }
public static GameResults InsertGameResultLoginId(String UserName, GameListEnum gameType, int Score, decimal TestDuration, int Total) { GameResults results = new GameResults(); try { AgileMindEntities db = new AgileMindEntities(); vwLoginInfo login = (from data in db.vwLoginInfoes where data.LoginName == UserName select data).Single(); if (login != null) { t_GameResults gameResults = new t_GameResults(); gameResults.Created = DateTime.Now; gameResults.GameId = (int)gameType; gameResults.LoginId = login.LoginId; gameResults.Score = Score; gameResults.TestDuration = TestDuration; gameResults.Total = Total; db.t_GameResults.AddObject(gameResults); db.SaveChanges(); results.Success = true; results.Game = gameResults; } else { results.Error = "Could not login. Invalid Username/Password"; } } catch (Exception ex) { results.Error = ex.Message; } return results; }
/// <summary> /// Deprecated Method for adding a new object to the t_GameResults EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTot_GameResults(t_GameResults t_GameResults) { base.AddObject("t_GameResults", t_GameResults); }
/// <summary> /// Create a new t_GameResults object. /// </summary> /// <param name="gameScoreId">Initial value of the GameScoreId property.</param> /// <param name="gameId">Initial value of the GameId property.</param> /// <param name="loginId">Initial value of the LoginId property.</param> /// <param name="created">Initial value of the Created property.</param> /// <param name="score">Initial value of the Score property.</param> /// <param name="total">Initial value of the Total property.</param> public static t_GameResults Createt_GameResults(global::System.Int32 gameScoreId, global::System.Int32 gameId, global::System.Int32 loginId, global::System.DateTime created, global::System.Int32 score, global::System.Int32 total) { t_GameResults t_GameResults = new t_GameResults(); t_GameResults.GameScoreId = gameScoreId; t_GameResults.GameId = gameId; t_GameResults.LoginId = loginId; t_GameResults.Created = created; t_GameResults.Score = score; t_GameResults.Total = total; return t_GameResults; }