/// <summary> /// 获得数据列表 /// </summary> public List <SeoWebSite.Model.ForecastScripts> DataTableToList(DataTable dt) { List <SeoWebSite.Model.ForecastScripts> modelList = new List <SeoWebSite.Model.ForecastScripts>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.ForecastScripts model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.ForecastScripts(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.name = dt.Rows[n]["name"].ToString(); model.content = dt.Rows[n]["content"].ToString(); model.remark = dt.Rows[n]["remark"].ToString(); if (dt.Rows[n]["win"].ToString() != "") { model.win = int.Parse(dt.Rows[n]["win"].ToString()); } if (dt.Rows[n]["lost"].ToString() != "") { model.lost = int.Parse(dt.Rows[n]["lost"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 获得数据列表 /// </summary> public List<SeoWebSite.Model.ForecastScripts> DataTableToList(DataTable dt) { List<SeoWebSite.Model.ForecastScripts> modelList = new List<SeoWebSite.Model.ForecastScripts>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.ForecastScripts model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.ForecastScripts(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.name = dt.Rows[n]["name"].ToString(); model.content = dt.Rows[n]["content"].ToString(); model.remark = dt.Rows[n]["remark"].ToString(); if (dt.Rows[n]["win"].ToString() != "") { model.win = int.Parse(dt.Rows[n]["win"].ToString()); } if (dt.Rows[n]["lost"].ToString() != "") { model.lost = int.Parse(dt.Rows[n]["lost"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(SeoWebSite.Model.ForecastScripts model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SeoWebSite.Model.ForecastScripts model) { return(dal.Add(model)); }