/// <summary> /// 获得数据列表 /// </summary> public List <Tunnel.Model.Tunnel_kaoqin> DataTableToList(DataTable dt) { List <Tunnel.Model.Tunnel_kaoqin> modelList = new List <Tunnel.Model.Tunnel_kaoqin>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Tunnel.Model.Tunnel_kaoqin model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_kaoqin(); model.k_id = Convert.ToInt64(dt.Rows[n]["k_id"].ToString()); if (dt.Rows[n]["k_date"].ToString() != "") { model.k_date = DateTime.Parse(dt.Rows[n]["k_date"].ToString()); } model.k_amtime = dt.Rows[n]["k_amtime"].ToString(); model.k_pmtime = dt.Rows[n]["k_pmtime"].ToString(); model.k_endtime = dt.Rows[n]["k_endtime"].ToString(); if (dt.Rows[n]["k_user"].ToString() != "") { model.k_user = int.Parse(dt.Rows[n]["k_user"].ToString()); } if (dt.Rows[n]["k_ifsb"].ToString() != "") { model.k_ifsb = int.Parse(dt.Rows[n]["k_ifsb"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Tunnel_kaoqin model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Tunnel.Model.Tunnel_kaoqin model) { return(dal.Add(model)); }