/// <summary> /// 获得数据列表 /// </summary> public List <Model.tb_ruzhu> DataTableToList(DataTable dt) { List <Model.tb_ruzhu> modelList = new List <Model.tb_ruzhu>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Model.tb_ruzhu model; for (int n = 0; n < rowsCount; n++) { model = new Model.tb_ruzhu(); if (dt.Rows[n]["r_id"] != null && dt.Rows[n]["r_id"].ToString() != "") { model.r_id = int.Parse(dt.Rows[n]["r_id"].ToString()); } if (dt.Rows[n]["r_no"] != null && dt.Rows[n]["r_no"].ToString() != "") { model.r_no = dt.Rows[n]["r_no"].ToString(); } if (dt.Rows[n]["r_name"] != null && dt.Rows[n]["r_name"].ToString() != "") { model.r_name = dt.Rows[n]["r_name"].ToString(); } if (dt.Rows[n]["r_uname"] != null && dt.Rows[n]["r_uname"].ToString() != "") { model.r_uname = dt.Rows[n]["r_uname"].ToString(); } if (dt.Rows[n]["r_utel"] != null && dt.Rows[n]["r_utel"].ToString() != "") { model.r_utel = dt.Rows[n]["r_utel"].ToString(); } if (dt.Rows[n]["r_address"] != null && dt.Rows[n]["r_address"].ToString() != "") { model.r_address = dt.Rows[n]["r_address"].ToString(); } if (dt.Rows[n]["r_desc"] != null && dt.Rows[n]["r_desc"].ToString() != "") { model.r_desc = dt.Rows[n]["r_desc"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.tb_ruzhu model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.tb_ruzhu model) { return(dal.Add(model)); }