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

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_Model model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_Model();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["ModelType"] != null && dt.Rows[n]["ModelType"].ToString() != "")
                    {
                        model.ModelType = int.Parse(dt.Rows[n]["ModelType"].ToString());
                    }
                    if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[n]["Name"].ToString();
                    }
                    if (dt.Rows[n]["TableName"] != null && dt.Rows[n]["TableName"].ToString() != "")
                    {
                        model.TableName = dt.Rows[n]["TableName"].ToString();
                    }
                    if (dt.Rows[n]["ModelDescription"] != null && dt.Rows[n]["ModelDescription"].ToString() != "")
                    {
                        model.ModelDescription = dt.Rows[n]["ModelDescription"].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_Model model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(ROYcms.Sys.Model.ROYcms_Model model)
 {
     return(dal.Add(model));
 }