Example #1
0
        public void Update(BlogQuestion entity)
        {
            this._questions.Remove(entity);
            this._questions.Add(entity);

            this._modifiedQ.Add(entity);
        }
Example #2
0
        /// <summary>
        /// 按键值取出
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public BlogQuestion GetByKey(Guid id)
        {
            BlogQuestion question = null;

            try
            {
                question = this._questions.Single(q => q.Id == id);
            }
            catch { }

            return(question);
        }
Example #3
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="categoryId">分类编号</param>
        /// <param name="startIndex">起始索引</param>
        /// <param name="count">取出数目</param>
        public static IList <BlogQuestion> GetList(Guid categoryId, int startIndex, int count)
        {
            IList <BlogQuestion> list = new List <BlogQuestion>();

            using (DbDataReader rd = DataHelper.GetPageList("fbs_BlogQuestion", "CreationDate DESC", categoryId == Guid.Empty ? null : ("CategoryID='" + categoryId.ToString() + "'"), startIndex, count))
            {
                while (rd.Read())
                {
                    list.Add(BlogQuestion.CreateFromReader(rd));
                }
            }

            return(list);
        }
Example #4
0
        public static HashSet <BlogQuestion> GetAllQuestions()
        {
            string sql = "select * from fbs_BlogQuestion as b inner join fbs_BlogQuestionCategory as c on b.CategoryID=c.QuestionCategoryID order by CreationDate asc";
            HashSet <BlogQuestion> list = new HashSet <BlogQuestion>();

            using (DbDataReader rd = DataHelper.ExecuteReader(CommandType.Text, sql))
            {
                while (rd.Read())
                {
                    list.Add(BlogQuestion.CreateFromReader(rd));
                }
            }

            return(list);
        }
Example #5
0
 /// <summary>
 /// 添加回答
 /// </summary>
 /// <param name="entity"></param>
 public void Add(BlogQuestion entity)
 {
     this._questions.Add(entity);
     this._newQ.Add(entity);
 }
Example #6
0
 public void Remove(BlogQuestion entity)
 {
     this._questions.Remove(entity);
     this._removedQ.Add(entity);
 }