/// <summary> /// 获得数据列表 /// </summary> public List<Light.Model.countryinfo> DataTableToList(DataTable dt) { List<Light.Model.countryinfo> modelList = new List<Light.Model.countryinfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.countryinfo model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.countryinfo(); if(dt.Rows[n]["id"].ToString()!="") { model.id=int.Parse(dt.Rows[n]["id"].ToString()); } model.countryname= dt.Rows[n]["countryname"].ToString(); if(dt.Rows[n]["creatman"].ToString()!="") { model.creatman=int.Parse(dt.Rows[n]["creatman"].ToString()); } if(dt.Rows[n]["creattime"].ToString()!="") { model.creattime=DateTime.Parse(dt.Rows[n]["creattime"].ToString()); } model.remark= dt.Rows[n]["remark"].ToString(); modelList.Add(model); } } return modelList; }
/// <summary> /// 获得数据列表 /// </summary> public List <Light.Model.countryinfo> DataTableToList(DataTable dt) { List <Light.Model.countryinfo> modelList = new List <Light.Model.countryinfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.countryinfo model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.countryinfo(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.countryname = dt.Rows[n]["countryname"].ToString(); if (dt.Rows[n]["creatman"].ToString() != "") { model.creatman = int.Parse(dt.Rows[n]["creatman"].ToString()); } if (dt.Rows[n]["creattime"].ToString() != "") { model.creattime = DateTime.Parse(dt.Rows[n]["creattime"].ToString()); } model.remark = dt.Rows[n]["remark"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Light.Model.countryinfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Light.Model.countryinfo model) { dal.Add(model); }