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