/// <summary> /// 获得数据列表 /// </summary> public List<Ajax.Model.UserState> DataTableToList(DataTable dt) { List<Ajax.Model.UserState> modelList = new List<Ajax.Model.UserState>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Ajax.Model.UserState model; for (int n = 0; n < rowsCount; n++) { model = new Ajax.Model.UserState(); if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="") { model.ID=dt.Rows[n]["ID"].ToString(); } if(dt.Rows[n]["Name"]!=null && dt.Rows[n]["Name"].ToString()!="") { model.Name=dt.Rows[n]["Name"].ToString(); } modelList.Add(model); } } return modelList; }
/// <summary> /// 获得数据列表 /// </summary> public List <Ajax.Model.UserState> DataTableToList(DataTable dt) { List <Ajax.Model.UserState> modelList = new List <Ajax.Model.UserState>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Ajax.Model.UserState model; for (int n = 0; n < rowsCount; n++) { model = new Ajax.Model.UserState(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = dt.Rows[n]["ID"].ToString(); } if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "") { model.Name = dt.Rows[n]["Name"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Ajax.Model.UserState model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Ajax.Model.UserState model) { dal.Add(model); }