/// <summary> /// 获得数据列表 /// </summary> public List<Light.Model.regioninfo> DataTableToList(DataTable dt) { List<Light.Model.regioninfo> modelList = new List<Light.Model.regioninfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.regioninfo model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.regioninfo(); if(dt.Rows[n]["id"].ToString()!="") { model.id=int.Parse(dt.Rows[n]["id"].ToString()); } if(dt.Rows[n]["countryid"].ToString()!="") { model.countryid=int.Parse(dt.Rows[n]["countryid"].ToString()); } model.regionname= dt.Rows[n]["regionname"].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.regioninfo> DataTableToList(DataTable dt) { List <Light.Model.regioninfo> modelList = new List <Light.Model.regioninfo>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Light.Model.regioninfo model; for (int n = 0; n < rowsCount; n++) { model = new Light.Model.regioninfo(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["countryid"].ToString() != "") { model.countryid = int.Parse(dt.Rows[n]["countryid"].ToString()); } model.regionname = dt.Rows[n]["regionname"].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.regioninfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Light.Model.regioninfo model) { dal.Add(model); }