public bool DeleteUserPhoto(int userID, String photoAbsoluteURI) { try { FileManager fileManager = new FileManager(userID); FileProperties properties = fileManager.GetFilePropertiesByURI(photoAbsoluteURI); IList<PersonAttribute> userPhoto = PersonAttributes.GetPersonAttributesByKeyword(userID, PersonAttributeTypes.Photo.ToString(), "StringField", properties.FileName); if (userPhoto == null || userPhoto.Count == 0) return false; userPhoto[0].Delete(); fileManager.DeleteFileByURI(photoAbsoluteURI); return true; } catch(Exception ex) { Logger.Instance.Error("Error while deleting user photo attribute." , ex); return false; } }
public IList<String> GetUserPhotosAbsoluteURI(int userID) { IList<String> resList = new List<String>(); FileManager fileManager = new FileManager(userID); foreach (PersonAttribute attribute in PersonAttributes.GetPersonAttributesByKeyword(userID, PersonAttributeTypes.Photo.ToString())) { if (!String.IsNullOrEmpty(attribute.StringField)) resList.Add(fileManager.GetFileURL(attribute.StringField)); } return resList; }