/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns> /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: /// Less than zero: This instance is less than <paramref name="obj"/>. Zero: This instance is equal to <paramref name="obj"/>. /// Greater than zero: This instance is greater than <paramref name="obj"/>. /// </returns> /// <exception cref="T:System.ArgumentException"> /// <paramref name="obj"/> is not the same type as this instance. </exception> public int CompareTo(object obj) { if (obj == null) { return(1); } else { GalleryServerRole other = (GalleryServerRole)obj; return(String.Compare(this.RoleName, other.RoleName, StringComparison.CurrentCulture)); } }
/// <summary> /// Compares the current instance with another object of the same type. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns> /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: /// Less than zero: This instance is less than <paramref name="obj"/>. Zero: This instance is equal to <paramref name="obj"/>. /// Greater than zero: This instance is greater than <paramref name="obj"/>. /// </returns> /// <exception cref="T:System.ArgumentException"> /// <paramref name="obj"/> is not the same type as this instance. </exception> public int CompareTo(object obj) { // Sort by gallery ID first, then by role name. if (obj == null) { return(1); } else { GalleryServerRole other = (GalleryServerRole)obj; return(String.Compare(this.RoleName, other.RoleName, StringComparison.CurrentCulture)); } }
private static IGalleryServerRoleCollection GetRolesFromRoleDtos(IEnumerable<RoleDto> roleDtos) { IGalleryServerRoleCollection roles = new GalleryServerRoleCollection(); foreach (RoleDto roleDto in roleDtos) { IGalleryServerRole role = new GalleryServerRole( roleDto.RoleName, roleDto.AllowViewAlbumsAndObjects, roleDto.AllowViewOriginalImage, roleDto.AllowAddMediaObject, roleDto.AllowAddChildAlbum, roleDto.AllowEditMediaObject, roleDto.AllowEditAlbum, roleDto.AllowDeleteMediaObject, roleDto.AllowDeleteChildAlbum, roleDto.AllowSynchronize, roleDto.AllowAdministerSite, roleDto.AllowAdministerGallery, roleDto.HideWatermark); role.RootAlbumIds.AddRange(from r in roleDto.RoleAlbums select r.FKAlbumId); roles.Add(role); } return roles; }