public static RoleCollection GetRoleCollection(Guid groupId) { //string sql = "select * from Roles where GroupId=@groupId order by RoleName"; //SqlParameter[] Parameters = new SqlParameter[1]; //Parameters[0] = new SqlParameter("@groupId", SqlDbType.UniqueIdentifier); //Parameters[0].Value = groupId; RoleCollection rc = new RoleCollection(); //using (DataTable table = SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.Text, sql, Parameters).Tables[0]) //{ // foreach (DataRow row in table.Rows) // { // Guid roleId = new Guid(row["RoleId"].ToString()); // // new Guid(row["GroupId"].ToString()); // string roleName = row["roleName"].ToString(); // string descr = row["description"].ToString(); // Role role = new Role(roleId, groupId, roleName, descr); // rc.Add(role); // } //} QJVRMS.Business.RoleWS.RoleService rs = new QJVRMS.Business.RoleWS.RoleService(); using (DataTable dt = rs.GetRolesByGroupId(groupId)) { foreach (DataRow row in dt.Rows) { Guid roleId = new Guid(row["RoleId"].ToString()); string roleName = row["roleName"].ToString(); string descr = row["description"].ToString(); Role role = new Role(roleId, groupId, roleName, descr); rc.Add(role); } } return(rc); }
public static RoleCollection GetRoleCollection(Guid groupId) { //string sql = "select * from Roles where GroupId=@groupId order by RoleName"; //SqlParameter[] Parameters = new SqlParameter[1]; //Parameters[0] = new SqlParameter("@groupId", SqlDbType.UniqueIdentifier); //Parameters[0].Value = groupId; RoleCollection rc = new RoleCollection(); //using (DataTable table = SqlHelper.ExecuteDataset(SqlHelper.SqlCon_QJVRMS, CommandType.Text, sql, Parameters).Tables[0]) //{ // foreach (DataRow row in table.Rows) // { // Guid roleId = new Guid(row["RoleId"].ToString()); // // new Guid(row["GroupId"].ToString()); // string roleName = row["roleName"].ToString(); // string descr = row["description"].ToString(); // Role role = new Role(roleId, groupId, roleName, descr); // rc.Add(role); // } //} QJVRMS.Business.RoleWS.RoleService rs = new QJVRMS.Business.RoleWS.RoleService(); using (DataTable dt = rs.GetRolesByGroupId(groupId)) { foreach (DataRow row in dt.Rows) { Guid roleId = new Guid(row["RoleId"].ToString()); string roleName = row["roleName"].ToString(); string descr = row["description"].ToString(); Role role = new Role(roleId, groupId, roleName, descr); rc.Add(role); } } return rc; }