Example #1
0
        public List <User> GetNewsItems()
        {
            DataSet     ds        = WikiDBAdapter.GetDataSet("GetNewsItems");
            List <User> newsItems = new List <User>();

            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable myTable = ds.Tables[0];
                if (myTable != null && myTable.Rows.Count > 0)
                {
                    var dsm = new DataSetMapper <User>();
                    newsItems = dsm.ConvertFromBackend <List <User> >(myTable);
                }
            }
            return(newsItems);
        }
        public List <DifficultyLevel> GetDifficultyLevel()
        {
            DataSet ds = WikiDBAdapter.GetDataSet("GetDifficultyLevel");
            List <DifficultyLevel> difficultyLevels = new List <DifficultyLevel>();

            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable myTable = ds.Tables[0];
                if (myTable != null && myTable.Rows.Count > 0)
                {
                    var dsm = new DataSetMapper <DifficultyLevel>();
                    difficultyLevels = dsm.ConvertFromBackend <List <DifficultyLevel> >(myTable);
                }
            }
            return(difficultyLevels);
        }
Example #3
0
        public List <Topic> GetTopics()
        {
            DataSet      ds     = WikiDBAdapter.GetDataSet("GetTopics");
            List <Topic> topics = new List <Topic>();

            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable myTable = ds.Tables[0];
                if (myTable != null && myTable.Rows.Count > 0)
                {
                    var dsm = new DataSetMapper <Topic>();
                    topics = dsm.ConvertFromBackend <List <Topic> >(myTable);
                }
            }
            return(topics);
        }
Example #4
0
        /// <summary>
        /// Retornna todos los post relacionados a un subtopic
        /// </summary>
        /// <param name="subTopic">Sub topic del cual se quieren obtener los post</param>
        /// <returns></returns>
        public List <Post> GetPostBySubTopicId(SubTopic subTopic)
        {
            DataSet ds = WikiDBAdapter.GetDataSet("GetPostBySubTopicId",
                                                  new DataAccessParameter("@SubTopicId", subTopic.SubTopicId, typeof(int), null, ParameterDirection.Input));

            List <Post> postResult = new List <Post>();

            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable myTable = ds.Tables[0];
                if (myTable != null && myTable.Rows.Count > 0)
                {
                    var dsm = new DataSetMapper <Post>();
                    postResult = dsm.ConvertFromBackend <List <Post> >(myTable);
                }
            }
            return(postResult);
        }
Example #5
0
        public List <SubTopic> GetSubTopicsByTopicId(Topic topic)
        {
            DataSet ds = WikiDBAdapter.GetDataSet("GetSubTopicsByTopicId",
                                                  new DataAccessParameter("@TopicId", topic.TopicId, typeof(int), null, ParameterDirection.Input));

            List <SubTopic> subTopics = new List <SubTopic>();

            if (ds != null && ds.Tables.Count > 0)
            {
                DataTable myTable = ds.Tables[0];
                if (myTable != null && myTable.Rows.Count > 0)
                {
                    var dsm = new DataSetMapper <SubTopic>();
                    subTopics = dsm.ConvertFromBackend <List <SubTopic> >(myTable);
                }
            }
            return(subTopics);
        }