Example #1
0
        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;
        }
Example #2
0
 public Statistic DeleteStatistic(Statistic statistic)
 {
     throw new NotImplementedException();
 }
Example #3
0
        private List<Statistic> GetListStatisticFromTableAdapter(HiddenWordDAL.DataModel.DsHiddenWord.statisticDataTable source)
        {
            Statistic stats = new Statistic();
            List<Statistic> listStats = new List<Statistic>();

            foreach (var row in source)
            {
                stats.Id = row.id;
                stats.UserId = row.UserId;
                stats.SetupId = row.SetupId;
                stats.NbTry = row.NbTry;
                listStats.Add(stats);

            }

            return listStats;
        }
Example #4
0
 public Statistic DeleteStatistic(Statistic statistic)
 {
     return DALAccess.DeleteStatistic(statistic);
 }
Example #5
0
        public List<Statistic> getUsersStatistics()
        {
            //var tabadap = new usersTableAdapter();
            //var tabadapStat = new statisticTableAdapter();
            var users = tabadapUser.GetUsers();
            Statistic stat;
            Words word;
            Setup setup;
            List<User> userList = new List<User>();
            List<Statistic> statsList = new List<Statistic>();

            foreach (var row in users)
            {
                var stats = tabadapStat.GetStatisticByUserId(row.id);
                stat = new Statistic();
                stat.User.Id = row.id;
                stat.User.Pseudo = row.Pseudo;

                foreach (var rowStat in stats)
                {
                    word = new Words();
                    setup = new Setup();

                    word.Id = rowStat.wordsRow.id;
                    word.Name = rowStat.wordsRow.Name;
                    setup.Id = rowStat.setupsRow.id;
                    setup.MaxTry = rowStat.setupsRow.MaxTry;
                    stat.WordList.Add(word);
                    stat.SetupList.Add(setup);

                }

                statsList.Add(stat);

            }

            return statsList;
        }
Example #6
0
 public Statistic UpdateStatistic(Statistic statistic)
 {
     return DALAccess.UpdateStatistic(statistic);
 }
Example #7
0
 public Statistic DeleteStatistic(Statistic statistic)
 {
     return genericMethode.deleteXmlData<Statistic>("XStatistic", statistic.Id.ToString());
 }
Example #8
0
        private List<Statistic> bindXmlObjectToStatistic(List<XStatistic> xmlOjectList )
        {
            List<Statistic> listStatistic = new List<Statistic>();
            foreach (XStatistic result in xmlOjectList)
            {
                Statistic statisticTmp = new Statistic();
                statisticTmp.Id = result.ID;
                statisticTmp.NbTry = result.nbtry;
                statisticTmp.SetupId = result.setupid;
                statisticTmp.WordId = result.wordid;
                statisticTmp.UserId = result.userid;
                listStatistic.Add(statisticTmp);
            }

            return listStatistic;
        }
Example #9
0
        public Statistic UpdateStatistic(Statistic statistic)
        {
            Dictionary<string, string> param = new Dictionary<string, string>();
            param["ID"] = statistic.Id.ToString();
            param["nbtry"] = statistic.NbTry.ToString();
            param["setupid"] = statistic.SetupId.ToString();
            param["wordid"] = statistic.WordId.ToString();
            param["userid"] = statistic.UserId.ToString();

            return genericMethode.updateXmlData<Statistic>("XStatistic", param);
        }
Example #10
0
        public Statistic insertStatistic(int userId, int wordId, int nbTry, int setupId)
        {
            XStatistic statistic = new XStatistic();
            statistic.ID = genericMethode.autoIncrementXmlDataPrimaryKey("XStatistic", "ID");
            statistic.userid = userId;
            statistic.wordid = wordId;
            statistic.setupid = setupId;
            statistic.nbtry = nbTry;

            HiddenWord hiddenWord = new HiddenWord();
            hiddenWord.Item = statistic;

            List<XStatistic> paramList = new List<XStatistic>();
            paramList.Add(genericMethode.saveXmlData<XStatistic>(hiddenWord, "XStatistic", statistic.ID.ToString()));

            List<Statistic> statisticList = bindXmlObjectToStatistic(paramList);
            Statistic result = new Statistic();
            if (statisticList.Count != 0)
            {
                result = statisticList[0];
            }

            return result;
        }