/// <summary> /// 获得数据列表 /// </summary> public List <university.Model.CCOM.Role> DataTableToList(DataTable dt) { List <university.Model.CCOM.Role> modelList = new List <university.Model.CCOM.Role>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { university.Model.CCOM.Role model; for (int n = 0; n < rowsCount; n++) { model = new university.Model.CCOM.Role(); if (dt.Rows[n]["Role_id"].ToString() != "") { model.Role_id = int.Parse(dt.Rows[n]["Role_id"].ToString()); } model.Role_name = dt.Rows[n]["Role_name"].ToString(); if (dt.Rows[n]["Role_status"].ToString() != "") { if ((dt.Rows[n]["Role_status"].ToString() == "1") || (dt.Rows[n]["Role_status"].ToString().ToLower() == "true")) { model.Role_status = true; } else { model.Role_status = false; } } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(university.Model.CCOM.Role model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(university.Model.CCOM.Role model) { return(dal.Add(model)); }