/// <summary> /// 获得数据列表 /// </summary> /// <param name="strWhere">条件</param> /// <returns>Routes集合</returns> public List <ClassLibrary.Model.Routes> GetModelList(DataTable dt) { List <ClassLibrary.Model.Routes> modelList = new List <ClassLibrary.Model.Routes>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ClassLibrary.Model.Routes model; for (int n = 0; n < rowsCount; n++) { model = new ClassLibrary.Model.Routes(); if (dt.Rows[n]["ID"] != DBNull.Value) { model.ID = Convert.ToInt32(dt.Rows[n]["ID"]); } if (dt.Rows[n]["routesClassID"] != DBNull.Value) { model.routesClassID = Convert.ToString(dt.Rows[n]["routesClassID"]); } if (dt.Rows[n]["ThemeID"] != DBNull.Value) { model.ThemeID = Convert.ToString(dt.Rows[n]["ThemeID"]); } if (dt.Rows[n]["routesPrentClassID"] != DBNull.Value) { model.routesPrentClassID = Convert.ToString(dt.Rows[n]["routesPrentClassID"]); } if (dt.Rows[n]["Title"] != DBNull.Value) { model.Title = Convert.ToString(dt.Rows[n]["Title"]); } if (dt.Rows[n]["Price"] != DBNull.Value) { model.Price = Convert.ToDecimal(dt.Rows[n]["Price"]); } if (dt.Rows[n]["Image"] != DBNull.Value) { model.Image = Convert.ToString(dt.Rows[n]["Image"]); } if (dt.Rows[n]["StartPosition"] != DBNull.Value) { model.StartPosition = Convert.ToString(dt.Rows[n]["StartPosition"]); } if (dt.Rows[n]["Destination"] != DBNull.Value) { model.Destination = Convert.ToString(dt.Rows[n]["Destination"]); } if (dt.Rows[n]["RouteTime"] != DBNull.Value) { model.RouteTime = Convert.ToString(dt.Rows[n]["RouteTime"]); } if (dt.Rows[n]["TrafficModel"] != DBNull.Value) { model.TrafficModel = Convert.ToString(dt.Rows[n]["TrafficModel"]); } if (dt.Rows[n]["DescriptionRoute"] != DBNull.Value) { model.DescriptionRoute = Convert.ToString(dt.Rows[n]["DescriptionRoute"]); } if (dt.Rows[n]["DescriptionPrice"] != DBNull.Value) { model.DescriptionPrice = Convert.ToString(dt.Rows[n]["DescriptionPrice"]); } if (dt.Rows[n]["ViewCount"] != DBNull.Value) { model.ViewCount = Convert.ToInt32(dt.Rows[n]["ViewCount"]); } if (dt.Rows[n]["LastUpdateTimeRoute"] != DBNull.Value) { model.LastUpdateTimeRoute = Convert.ToDateTime(dt.Rows[n]["LastUpdateTimeRoute"]); } if (dt.Rows[n]["LastUpdateTimePrice"] != DBNull.Value) { model.LastUpdateTimePrice = Convert.ToDateTime(dt.Rows[n]["LastUpdateTimePrice"]); } if (dt.Rows[n]["RecommendHot"] != DBNull.Value) { model.RecommendHot = Convert.ToBoolean(dt.Rows[n]["RecommendHot"]); } if (dt.Rows[n]["CreatedTime"] != DBNull.Value) { model.CreatedTime = Convert.ToDateTime(dt.Rows[n]["CreatedTime"]); } if (dt.Rows[n]["SeoKeywords"] != DBNull.Value) { model.SeoKeywords = Convert.ToString(dt.Rows[n]["SeoKeywords"]); } if (dt.Rows[n]["SeoDescription"] != DBNull.Value) { model.SeoDescription = Convert.ToString(dt.Rows[n]["SeoDescription"]); } if (dt.Rows[n]["IsDisplay"] != DBNull.Value) { model.Display = Convert.ToBoolean(dt.Rows[n]["IsDisplay"]); } model.FirstTime = dt.Rows[n]["FirstTime"].ToString(); if (dt.Rows[n]["DetailType"] != DBNull.Value) { model.DetailType = Convert.ToBoolean(dt.Rows[n]["DetailType"]); } if (dt.Rows[n]["DateType"] != DBNull.Value) { model.DateType = Convert.ToBoolean(dt.Rows[n]["DateType"]); } if (dt.Rows[n]["DatePrice"] != DBNull.Value) { model.DatePrice = Convert.ToString(dt.Rows[n]["DatePrice"]); } if (dt.Rows[n]["ChildPrice"] != DBNull.Value) { model.ChildPrice = Convert.ToDecimal(dt.Rows[n]["ChildPrice"]); } if (dt.Rows[n]["AdvanceDays"] != DBNull.Value) { model.AdvanceDays = Convert.ToInt32(dt.Rows[n]["AdvanceDays"]); } if (dt.Rows[n]["RouteFeature"] != DBNull.Value) { model.RouteFeature = Convert.ToString(dt.Rows[n]["RouteFeature"]); } if (dt.Rows[n]["RouteNotice"] != DBNull.Value) { model.RouteNotice = Convert.ToString(dt.Rows[n]["RouteNotice"]); } if (dt.Rows[n]["RouteOrder"] != DBNull.Value) { model.Order = Convert.ToInt32(dt.Rows[n]["RouteOrder"]); } if (dt.Rows[n]["Supplier"] != DBNull.Value) { model.Supplier = Convert.ToString(dt.Rows[n]["Supplier"]); } if (dt.Rows[n]["seoTitle"] != DBNull.Value) { model.SeoTitle = Convert.ToString(dt.Rows[n]["seoTitle"]); } if (dt.Rows[n]["Bright"] != DBNull.Value) { model.Bright = Convert.ToString(dt.Rows[n]["Bright"]); } if (dt.Rows[n]["BoatName"] != DBNull.Value) { model.BoatName = Convert.ToString(dt.Rows[n]["BoatName"]); } if (dt.Rows[n]["LocationID"] != DBNull.Value) { model.LocationID = Convert.ToInt32(dt.Rows[n]["LocationID"]); } if (dt.Rows[n]["SupplierTel"] != DBNull.Value) { model.SupplierTel = Convert.ToString(dt.Rows[n]["SupplierTel"]); } if (dt.Rows[n]["appImg"] != DBNull.Value) { model.AppImg = Convert.ToString(dt.Rows[n]["appImg"]); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="model">model对象</param> public int Add(ClassLibrary.Model.Routes model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model">model对象</param> /// <returns>影响行数</returns> public int Update(ClassLibrary.Model.Routes model) { return(dal.Update(model)); }