/// <summary> /// 获得数据列表 /// </summary> public List <JY.Model.Brand> DataTableToList(DataTable dt) { List <JY.Model.Brand> modelList = new List <JY.Model.Brand>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { JY.Model.Brand model; for (int n = 0; n < rowsCount; n++) { model = new JY.Model.Brand(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = long.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["BrandName"] != null && dt.Rows[n]["BrandName"].ToString() != "") { model.BrandName = dt.Rows[n]["BrandName"].ToString(); } if (dt.Rows[n]["LogoPic"] != null && dt.Rows[n]["LogoPic"].ToString() != "") { model.LogoPic = dt.Rows[n]["LogoPic"].ToString(); } if (dt.Rows[n]["Description"] != null && dt.Rows[n]["Description"].ToString() != "") { model.Description = dt.Rows[n]["Description"].ToString(); } if (dt.Rows[n]["IsDelete"] != null && dt.Rows[n]["IsDelete"].ToString() != "") { if ((dt.Rows[n]["IsDelete"].ToString() == "1") || (dt.Rows[n]["IsDelete"].ToString().ToLower() == "true")) { model.IsDelete = true; } else { model.IsDelete = false; } } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JY.Model.Brand model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public long Add(JY.Model.Brand model) { return(dal.Add(model)); }