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