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

            if (rowsCount > 0)
            {
                ClassLibrary.Model.RouteType model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ClassLibrary.Model.RouteType();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.ClassName = dt.Rows[n]["ClassName"].ToString();
                    if (dt.Rows[n]["Recommend"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Recommend"].ToString() == "1") || (dt.Rows[n]["Recommend"].ToString().ToLower() == "true"))
                        {
                            model.Recommend = true;
                        }
                        else
                        {
                            model.Recommend = false;
                        }
                    }
                    if (dt.Rows[n]["CreatedTime"].ToString() != "")
                    {
                        model.CreatedTime = DateTime.Parse(dt.Rows[n]["CreatedTime"].ToString());
                    }
                    model.seoTitle    = dt.Rows[n]["seoTitle"].ToString();
                    model.seoKeyword  = dt.Rows[n]["seoKeyword"].ToString();
                    model.seoDesc     = dt.Rows[n]["seoDesc"].ToString();
                    model.classNamePY = dt.Rows[n]["classNamePY"].ToString();
                    if (dt.Rows[n]["ClassOrder"].ToString() != "")
                    {
                        model.ClassOrder = int.Parse(dt.Rows[n]["ClassOrder"].ToString());
                    }
                    model.ClassImg    = dt.Rows[n]["ClassImg"].ToString();
                    model.AppClassImg = dt.Rows[n]["AppClassImg"].ToString();

                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ClassLibrary.Model.RouteType model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ClassLibrary.Model.RouteType model)
 {
     return(dal.Add(model));
 }