示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ROYcms.Sys.Model.ROYcms_Gallery> DataTableToList(DataTable dt)
        {
            List <ROYcms.Sys.Model.ROYcms_Gallery> modelList = new List <ROYcms.Sys.Model.ROYcms_Gallery>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_Gallery model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_Gallery();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["Rid"] != null && dt.Rows[n]["Rid"].ToString() != "")
                    {
                        model.Rid = int.Parse(dt.Rows[n]["Rid"].ToString());
                    }
                    if (dt.Rows[n]["TYPE"] != null && dt.Rows[n]["TYPE"].ToString() != "")
                    {
                        model.TYPE = int.Parse(dt.Rows[n]["TYPE"].ToString());
                    }
                    if (dt.Rows[n]["URL"] != null && dt.Rows[n]["URL"].ToString() != "")
                    {
                        model.URL = dt.Rows[n]["URL"].ToString();
                    }
                    if (dt.Rows[n]["thumb_url"] != null && dt.Rows[n]["thumb_url"].ToString() != "")
                    {
                        model.thumb_url = dt.Rows[n]["thumb_url"].ToString();
                    }
                    if (dt.Rows[n]["Title"] != null && dt.Rows[n]["Title"].ToString() != "")
                    {
                        model.Title = dt.Rows[n]["Title"].ToString();
                    }
                    if (dt.Rows[n]["TIME"] != null && dt.Rows[n]["TIME"].ToString() != "")
                    {
                        model.TIME = DateTime.Parse(dt.Rows[n]["TIME"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ROYcms.Sys.Model.ROYcms_Gallery model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ROYcms.Sys.Model.ROYcms_Gallery model)
 {
     return(dal.Add(model));
 }