Esempio n. 1
0
        public List <ClassLibrary.Model.RouteClass> GetList(DataTable dt)
        {
            List <ClassLibrary.Model.RouteClass> modelList = new List <ClassLibrary.Model.RouteClass>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ClassLibrary.Model.RouteClass model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ClassLibrary.Model.RouteClass();
                    if (dt.Rows[n]["ID"] != DBNull.Value)
                    {
                        model.ID = Convert.ToInt32(dt.Rows[n]["ID"]);
                    }
                    if (dt.Rows[n]["ParentID"] != DBNull.Value)
                    {
                        model.ParentID = Convert.ToInt32(dt.Rows[n]["ParentID"]);
                    }
                    if (dt.Rows[n]["ClassName"] != DBNull.Value)
                    {
                        model.ClassName = Convert.ToString(dt.Rows[n]["ClassName"]);
                    }
                    if (dt.Rows[n]["CreatedTime"] != DBNull.Value)
                    {
                        model.CreatedTime = Convert.ToDateTime(dt.Rows[n]["CreatedTime"]);
                    }
                    if (dt.Rows[n]["Recommend"] != DBNull.Value)
                    {
                        model.Recommend = Convert.ToBoolean(dt.Rows[n]["Recommend"]);
                    }
                    if (dt.Rows[n]["seoTitle"] != DBNull.Value)
                    {
                        model.SeoTitle = Convert.ToString(dt.Rows[n]["seoTitle"]);
                    }
                    if (dt.Rows[n]["seoKeyword"] != DBNull.Value)
                    {
                        model.SeoKeyword = Convert.ToString(dt.Rows[n]["seoKeyword"]);
                    }
                    if (dt.Rows[n]["seoDesc"] != DBNull.Value)
                    {
                        model.SeoDesc = Convert.ToString(dt.Rows[n]["seoDesc"]);
                    }
                    if (dt.Rows[n]["classlevel"] != DBNull.Value)
                    {
                        model.ClassLevel = Convert.ToInt32(dt.Rows[n]["classlevel"]);
                    }
                    if (dt.Rows[n]["classNamePY"] != DBNull.Value)
                    {
                        model.ClassNamePY = Convert.ToString(dt.Rows[n]["classNamePY"]);
                    }
                    if (dt.Rows[n]["ClassOrder"] != DBNull.Value)
                    {
                        model.ClassOrder = Convert.ToInt32(dt.Rows[n]["ClassOrder"]);
                    }
                    if (dt.Rows[n]["ClassImg"] != DBNull.Value)
                    {
                        model.ClassImg = Convert.ToString(dt.Rows[n]["ClassImg"]);
                    }
                    if (dt.Rows[n]["IsHaidao"] != DBNull.Value)
                    {
                        model.IsHaidao = Convert.ToBoolean(dt.Rows[n]["IsHaidao"]);
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 public int Add(ClassLibrary.Model.RouteClass model)
 {
     return(dal.Add(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 /// <returns>影响行数</returns>
 public int Update(ClassLibrary.Model.RouteClass model)
 {
     return(dal.Update(model));
 }