/// <summary> /// 获得数据列表 /// </summary> public List <Hownet.Model.CaiPian> DataTableToList(DataTable dt) { List <Hownet.Model.CaiPian> modelList = new List <Hownet.Model.CaiPian>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hownet.Model.CaiPian model; for (int n = 0; n < rowsCount; n++) { model = new Hownet.Model.CaiPian(); if (dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } model.Name = dt.Rows[n]["Name"].ToString(); model.Remark = dt.Rows[n]["Remark"].ToString(); model.Sn = dt.Rows[n]["Sn"].ToString(); if (dt.Rows[n]["IsEnd"].ToString() != "") { if ((dt.Rows[n]["IsEnd"].ToString() == "1") || (dt.Rows[n]["IsEnd"].ToString().ToLower() == "true")) { model.IsEnd = true; } else { model.IsEnd = false; } } model.A = int.Parse(dt.Rows[n]["A"].ToString()); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Hownet.Model.CaiPian model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hownet.Model.CaiPian model) { return(dal.Add(model)); }