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