public bool GameSetup() { do { if (this.User == null || this.User.Pseudo == null || this.User.Pseudo == "") this.User = Bl.BlDisplay.SelectUser(); //if (this.Setup == null || this.Setup.MaxTry == 0) //{ try { Setup = Bl.BlSetup.GetSetupByStatus((int)ESetup.Active)[0]; } catch (ApplicationException e) { Bl.BlDisplay.displayMessage(e.Message); Bl.BlDisplay.setupMaxTry(); Setup = Bl.BlSetup.GetSetupByStatus((int)ESetup.Active)[0]; } //} } while (!SettingCheck() ); return true; }
public Play(IActionManager bl, ISetting setting, Random rd) { this.rd = rd; Bl = bl; Setting = setting; NewWord = new Words(); User = new User(); Setup = new Setup(); setting.init( User, Setup, rd); }
public Statistic getOneUserStatistics(int userId) { Statistic stat; Words word; Setup setup; User user; List<Statistic> statsList = new List<Statistic>(); var stats = tabadapStat.GetStatisticByUserId(userId); stat = new Statistic(); for (int i = 0; i < stats.Count(); i++) { word = new Words(); setup = new Setup(); user = new User(); stat.WordList = new List<Words>(); stat.UserList = new List<User>(); stat.SetupList = new List<Setup>(); for (int j = 0; j < stats.Rows[i].ItemArray.Count(); j++) { user.Id = (int)stats.Rows[i].ItemArray[5]; user.Pseudo = (string)stats.Rows[i].ItemArray[6]; word.Id = (int)stats.Rows[i].ItemArray[7]; word.Name = (string)stats.Rows[i].ItemArray[8]; setup.Id = (int)stats.Rows[i].ItemArray[9]; setup.MaxTry = (int)stats.Rows[i].ItemArray[10]; /*stat.id = (int)stats.Rows[i].ItemArray[1]; stat.UserId = (int)stats.Rows[i].ItemArray[2]; stat.WordId = (int)stats.Rows[i].ItemArray[3]; stat.SetupId = (int)stats.Rows[i].ItemArray[4]; stat.NbTry = (int)stats.Rows[i].ItemArray[5];*/ stat.WordList.Add(word); stat.SetupList.Add(setup); stat.UserList.Add(user); } } return stat; }
public User DeleteUser(User user) { throw new NotImplementedException(); }
private List<User> GetListUsersFromTableAdapter(HiddenWordDAL.DataModel.DsHiddenWord.usersDataTable source) { List<User> listUsers = new List<User>(); User user; foreach (var row in source) { user = new User(); user.Id = row.id; user.Pseudo = row.Pseudo; listUsers.Add(user); } return listUsers; }
private User getUser(User user) { var checkUserRegistered = BlUser.GetUserByPseudo(user.Pseudo); if ( !user.Pseudo.Equals("") && checkUserRegistered.Pseudo == null) { BlUser.InsertUser(user.Pseudo); checkUserRegistered = BlUser.GetUserByPseudo(user.Pseudo); } checkUserRegistered.UserStats = BlStat.GetStatisticByUserId(checkUserRegistered.Id); foreach (var stat in checkUserRegistered.UserStats) { checkUserRegistered.UserWordsStats.Add(BlWord.GetWordsById(stat.WordId)); checkUserRegistered.UserSetupsStats.Add(BlSetup.GetSetupById(stat.SetupId)); } return checkUserRegistered; }
public EndGame(IActionManager bl, User user, Words word, int nbTry, Setup setup) { this.Bl = bl; Bl.BlDisplay.endGame(word.Name); save(user, word, nbTry, setup); }
public User DeleteUser(User user) { return DALAccess.DeleteUser(user); }
public User SelectUser() { string response = ""; this.displayEmptyLine(); this.displayTabulation(2); displayMessage("\n....... USER SELECTION ......\n"); this.displayEmptyLine(); do { this.displayTabulation(1); response = readResponse("Do you have a pseudo already register? (y/n): "); this.displayEmptyLine(); } while (response != "y" && response != "n"); if (response.Equals("y")) { response = readResponse("\tPlease enter your pseudo: "); this.displayEmptyLine(); } else { this.displayTabulation(2); displayMessage("....... SETTING NEW USER ......",nbEmptyLineAfter:1); //bool next = false; do { response = readResponse("\tPlease enter your pseudo: "); this.displayEmptyLine(); } while ( response == "" ); } this.displayEmptyLine(); User user = new User(); user.Pseudo = response; return user; }
public User UpdateUser(User user) { Dictionary<string, string> param = new Dictionary<string, string>(); param["ID"] = user.Id.ToString(); param["pseudo"] = user.Pseudo.ToString(); return genericMethode.updateXmlData<User>("XUsers", param); }
public User InsertUser(string pseudo) { XUsers user = new XUsers(); user.ID = genericMethode.autoIncrementXmlDataPrimaryKey("XUsers", "ID"); user.pseudo = pseudo; HiddenWord hiddenWord = new HiddenWord(); hiddenWord.Item = user; List<XUsers> paramList = new List<XUsers>(); paramList.Add(genericMethode.saveXmlData<XUsers>(hiddenWord, "XUsers", user.ID.ToString())); List<User> usersList = bindXmlDataToUser(paramList); User result = new User(); if (usersList.Count != 0) { result = usersList[0]; } return result; }
public User GetUserByPseudo(string pseudo) { List<XUsers> paramList = new List<XUsers>(); paramList.Add(genericMethode.getXmlDataByValue<XUsers>("XUsers", pseudo)); List<User> usersList = bindXmlDataToUser(paramList); User result = new User(); if ( usersList.Count != 0 ) { result = usersList[0]; } return result; }
//---------------[ The User implementation ] -------------------- public User GetUserById(int id) { List<XUsers> paramList = new List<XUsers>(); paramList.Add(genericMethode.getXmlDataByAttribute<XUsers>("XUsers", "ID", id.ToString())); List<User> usersList = bindXmlDataToUser(paramList); User result = new User(); if (usersList.Count != 0) { result = usersList[0]; } return result; }
public void init(User user, Setup setup, Random rd) { User = user; Setup = setup; }
/*-------------------[ Display User Statistics ]--------------*/ public void DisplayStatisticByUser(User user) { Display.DisplayStatisticByUser(user); }
private User GetOneUserFromTableAdapter(HiddenWordDAL.DataModel.DsHiddenWord.usersDataTable source) { User user = new User(); foreach (var row in source) { user.Pseudo = row.Pseudo; user.Id = row.id; break; } return user; }
private List<User> bindXmlDataToUser(List<XUsers> resultList) { List<User> userFound = new List<User>(); foreach (XUsers result in resultList) { User userTemp = new User(); userTemp.Id = result.ID; userTemp.Pseudo = (string)result.pseudo; userFound.Add(userTemp); } return userFound; }
public User DeleteUser(User user) { return genericMethode.deleteXmlData<User>("XUsers", user.Id.ToString()); }
public void DisplayStatisticByUser(User user) { throw new NotImplementedException(); }
public void DisplayStatisticByUser(User user) { MyChart.Title = "Statistics of "+user.Pseudo; KeyValuePair<string, int>[] keyValuePair = new KeyValuePair<string, int>[user.UserStats.Count()]; for (int i=0; i< user.UserStats.Count; i++) { keyValuePair[i] = new KeyValuePair<string, int>(user.UserWordsStats[i].Name, user.UserStats[i].NbTry); } ((AreaSeries)MyChart.Series[0]).ItemsSource = keyValuePair; }
public User UpdateUser(User user) { return DALAccess.UpdateUser(user); }
public User SelectUser() { User user = new User(); user.Pseudo = read("Please enter your pseudo "); return user; }
public void save(User user, Words word, int nbTry, Setup setup) { Bl.BlStat.insertStatistic(user.Id, word.Id, nbTry, setup.Id); }
public bool SetGame() { string response = ""; do { if (isSetting) response = Bl.BlDisplay.setupMenu(); // SETTING MENU if (response.Equals(ESetupMenu.Exit)) return false; if (response.Equals(ESetupMenu.ChoiceOne)) { if (isSetting) { Bl.BlDisplay.setupNewWord(); } } if (response.Equals(ESetupMenu.ChoiceTwo)) { if (isSetting || this.Setup.MaxTry == 0) { try { this.Setup = Bl.BlDisplay.setupMaxTry(); // MAX TRY SETTING } catch (ApplicationException e) { Bl.BlDisplay.displayMessage(e.Message); this.Setup = Bl.BlDisplay.setupMaxTry(); // MAX TRY SETTING } } } if (this.User == null || this.User.Pseudo == null || this.User.Pseudo == "") this.User = Bl.BlDisplay.SelectUser(); if (this.Setup == null || this.Setup.MaxTry == 0) { try { Setup = Bl.BlSetup.GetSetupByStatus((int)ESetup.Active)[0]; } catch (ApplicationException e) { Bl.BlDisplay.displayMessage(e.Message); Bl.BlDisplay.setupMaxTry(); Setup = Bl.BlSetup.GetSetupByStatus((int)ESetup.Active)[0]; } } } while (!SettingCheck()); return true; }