/// <summary> /// 获得数据列表 /// </summary> public List <Tunnel.Model.Tunnel_log> DataTableToList(DataTable dt) { List <Tunnel.Model.Tunnel_log> modelList = new List <Tunnel.Model.Tunnel_log>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Tunnel.Model.Tunnel_log model; for (int n = 0; n < rowsCount; n++) { model = new Tunnel.Model.Tunnel_log(); //model.l_id=dt.Rows[n]["l_id"].ToString(); if (dt.Rows[n]["l_user"].ToString() != "") { model.l_user = int.Parse(dt.Rows[n]["l_user"].ToString()); } if (dt.Rows[n]["l_time"].ToString() != "") { model.l_time = DateTime.Parse(dt.Rows[n]["l_time"].ToString()); } model.l_content = dt.Rows[n]["l_content"].ToString(); model.l_ip = dt.Rows[n]["l_ip"].ToString(); if (dt.Rows[n]["l_sort"].ToString() != "") { model.l_sort = int.Parse(dt.Rows[n]["l_sort"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Tunnel.Model.Tunnel_log model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Tunnel.Model.Tunnel_log model) { return(dal.Add(model)); }