/// <summary> /// 获得数据列表 /// </summary> public List <Maticsoft.Model.t_User> DataTableToList(DataTable dt) { List <Maticsoft.Model.t_User> modelList = new List <Maticsoft.Model.t_User>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Maticsoft.Model.t_User model; for (int n = 0; n < rowsCount; n++) { model = new Maticsoft.Model.t_User(); if (dt.Rows[n]["userId"].ToString() != "") { model.userId = int.Parse(dt.Rows[n]["userId"].ToString()); } model.userName = dt.Rows[n]["userName"].ToString(); model.pwd = dt.Rows[n]["pwd"].ToString(); model.email = dt.Rows[n]["email"].ToString(); model.sex = dt.Rows[n]["sex"].ToString(); model.colloge = dt.Rows[n]["colloge"].ToString(); model.personalwords = dt.Rows[n]["personalwords"].ToString(); if (dt.Rows[n]["inCollogeYear"].ToString() != "") { model.inCollogeYear = int.Parse(dt.Rows[n]["inCollogeYear"].ToString()); } if (dt.Rows[n]["registerTime"].ToString() != "") { model.registerTime = DateTime.Parse(dt.Rows[n]["registerTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.t_User model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Maticsoft.Model.t_User model) { dal.Add(model); }