Beispiel #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <SmartTeaching.Entity.Base_BBS> DataTableToList(DataTable dt)
        {
            List <SmartTeaching.Entity.Base_BBS> modelList = new List <SmartTeaching.Entity.Base_BBS>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                SmartTeaching.Entity.Base_BBS model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new SmartTeaching.Entity.Base_BBS();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["UserId"].ToString() != "")
                    {
                        model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString());
                    }
                    if (dt.Rows[n]["ToUserId"].ToString() != "")
                    {
                        model.ToUserId = int.Parse(dt.Rows[n]["ToUserId"].ToString());
                    }
                    if (dt.Rows[n]["NewsId"].ToString() != "")
                    {
                        model.NewsId = int.Parse(dt.Rows[n]["NewsId"].ToString());
                    }
                    if (dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    model.NewsContent = dt.Rows[n]["NewsContent"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(SmartTeaching.Entity.Base_BBS model)
 {
     return(dal.Update(model));
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(SmartTeaching.Entity.Base_BBS model)
 {
     return(dal.Add(model));
 }