/// <summary> /// 获得数据列表 /// </summary> public List <Maticsoft.Model.test.Table_1> DataTableToList(DataTable dt) { List <Maticsoft.Model.test.Table_1> modelList = new List <Maticsoft.Model.test.Table_1>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Maticsoft.Model.test.Table_1 model; for (int n = 0; n < rowsCount; n++) { model = new Maticsoft.Model.test.Table_1(); if (dt.Rows[n]["name"] != null && dt.Rows[n]["name"].ToString() != "") { model.name = dt.Rows[n]["name"].ToString(); } if (dt.Rows[n]["nianling"] != null && dt.Rows[n]["nianling"].ToString() != "") { model.nianling = dt.Rows[n]["nianling"].ToString(); } if (dt.Rows[n]["shenggao"] != null && dt.Rows[n]["shenggao"].ToString() != "") { model.shenggao = dt.Rows[n]["shenggao"].ToString(); } if (dt.Rows[n]["bianhao"] != null && dt.Rows[n]["bianhao"].ToString() != "") { model.bianhao = dt.Rows[n]["bianhao"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.test.Table_1 model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Maticsoft.Model.test.Table_1 model) { return(dal.Add(model)); }