/// <summary> /// 得到一个对象实体 /// </summary> public PermissionSystem.Model.RolePermission DataRowToModel(DataRow row) { PermissionSystem.Model.RolePermission model=new PermissionSystem.Model.RolePermission(); if (row != null) { if(row["role_permission_id"]!=null && row["role_permission_id"].ToString()!="") { model.role_permission_id=long.Parse(row["role_permission_id"].ToString()); } if(row["role_id"]!=null && row["role_id"].ToString()!="") { model.role_id=long.Parse(row["role_id"].ToString()); } if(row["permission_id"]!=null && row["permission_id"].ToString()!="") { model.permission_id=long.Parse(row["permission_id"].ToString()); } if(row["permission_type_id"]!=null && row["permission_type_id"].ToString()!="") { model.permission_type_id=long.Parse(row["permission_type_id"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public PermissionSystem.Model.RolePermission GetModel(long role_permission_id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 role_permission_id,role_id,permission_id,permission_type_id from RolePermission "); strSql.Append(" where role_permission_id=@role_permission_id"); SqlParameter[] parameters = { new SqlParameter("@role_permission_id", SqlDbType.BigInt) }; parameters[0].Value = role_permission_id; PermissionSystem.Model.RolePermission model=new PermissionSystem.Model.RolePermission(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }