Exemple #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <lgk.Model.tb_FriendDynamic> DataTableToList(DataTable dt)
        {
            List <lgk.Model.tb_FriendDynamic> modelList = new List <lgk.Model.tb_FriendDynamic>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                lgk.Model.tb_FriendDynamic model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new lgk.Model.tb_FriendDynamic();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = long.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = long.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    model.Content = dt.Rows[n]["Content"].ToString();
                    model.Pic     = dt.Rows[n]["Pic"].ToString();
                    if (dt.Rows[n]["AddTime"].ToString() != "")
                    {
                        model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString());
                    }
                    if (dt.Rows[n]["GoodNum"].ToString() != "")
                    {
                        model.GoodNum = int.Parse(dt.Rows[n]["GoodNum"].ToString());
                    }
                    if (dt.Rows[n]["CommentNum"].ToString() != "")
                    {
                        model.CommentNum = int.Parse(dt.Rows[n]["CommentNum"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_FriendDynamic model)
 {
     return(dal.Update(model));
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(lgk.Model.tb_FriendDynamic model)
 {
     return(dal.Add(model));
 }