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

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_Form model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_Form();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.title   = dt.Rows[n]["title"].ToString();
                    model.zhaiyao = dt.Rows[n]["zhaiyao"].ToString();
                    if (dt.Rows[n]["classname"].ToString() != "")
                    {
                        model.classname = int.Parse(dt.Rows[n]["classname"].ToString());
                    }
                    if (dt.Rows[n]["ClassKind_id"].ToString() != "")
                    {
                        model.ClassKind_id = int.Parse(dt.Rows[n]["ClassKind_id"].ToString());
                    }
                    if (dt.Rows[n]["Class_id"].ToString() != "")
                    {
                        model.Class_id = int.Parse(dt.Rows[n]["Class_id"].ToString());
                    }
                    model.SetFrom  = dt.Rows[n]["SetFrom"].ToString();
                    model.Path     = dt.Rows[n]["Path"].ToString();
                    model.Contents = dt.Rows[n]["Contents"].ToString();
                    if (dt.Rows[n]["Time"].ToString() != "")
                    {
                        model.Time = DateTime.Parse(dt.Rows[n]["Time"].ToString());
                    }
                    model.GUID = dt.Rows[n]["GUID"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(ROYcms.Sys.Model.ROYcms_Form model)
 {
     dal.Update(model);
 }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(ROYcms.Sys.Model.ROYcms_Form model)
 {
     dal.Add(model);
 }