public static IEnumerable <DataReferenceLabelPair <IImageFile> > GenerateSelectorOptions(DataReference <IMediaFileFolder> folderReference) { IMediaFileFolder folder = null; if (folderReference.IsSet) { try { folder = folderReference.Data; } catch (Exception) { string reference = folderReference.Serialize() ?? string.Empty; LoggingService.LogError(LogTitle, "Failed to get media folder by referece: '{0}'".FormatWith(reference)); } } if (folder != null) { int pathLength = folder.Path.Length; return (from mediaFile in DataFacade.GetData <IImageFile>() where mediaFile.StoreId == folder.StoreId && mediaFile.FolderPath.StartsWith(folder.Path) orderby mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName select new DataReferenceLabelPair <IImageFile>(mediaFile, mediaFile.FolderPath.Substring(pathLength) + "/" + mediaFile.FileName)); } // Returning all of the images return (from mediaFile in DataFacade.GetData <IImageFile>() orderby mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName select new DataReferenceLabelPair <IImageFile>(mediaFile, mediaFile.StoreId + ":" + mediaFile.FolderPath + "/" + mediaFile.FileName)); }
private static string GetFolderPath(DataReference <IMediaFileFolder> folderReference) { if (folderReference != null && folderReference.IsSet) { IMediaFileFolder folder; try { folder = folderReference.Data; if (folder != null) { return(folder.Path); } } catch (Exception) { string reference = folderReference.Serialize() ?? string.Empty; LoggingService.LogError(LogTitle, "Failed to get media folder by referece: '{0}'".FormatWith(reference)); } } return(null); }
public static IEnumerable<DataReferenceLabelPair<IImageFile>> GenerateSelectorOptions(DataReference<IMediaFileFolder> folderReference) { IMediaFileFolder folder = null; if (folderReference.IsSet) { try { folder = folderReference.Data; } catch (Exception) { string reference = folderReference.Serialize() ?? string.Empty; LoggingService.LogError(LogTitle, "Failed to get media folder by referece: '{0}'".FormatWith(reference)); } } if (folder != null) { int pathLength = folder.Path.Length; return from mediaFile in DataFacade.GetData<IImageFile>() where mediaFile.StoreId == folder.StoreId && mediaFile.FolderPath.StartsWith(folder.Path) orderby mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName select new DataReferenceLabelPair<IImageFile>(mediaFile, mediaFile.FolderPath.Substring(pathLength) + "/" + mediaFile.FileName); } // Returning all of the images return from mediaFile in DataFacade.GetData<IImageFile>() orderby mediaFile.StoreId, mediaFile.FolderPath, mediaFile.FileName select new DataReferenceLabelPair<IImageFile>(mediaFile, mediaFile.StoreId + ":" + mediaFile.FolderPath + "/" + mediaFile.FileName); }
private static string GetFolderPath(DataReference<IMediaFileFolder> folderReference) { if (folderReference != null && folderReference.IsSet) { IMediaFileFolder folder; try { folder = folderReference.Data; if (folder != null) { return folder.Path; } } catch (Exception) { string reference = folderReference.Serialize() ?? string.Empty; LoggingService.LogError(LogTitle, "Failed to get media folder by referece: '{0}'".FormatWith(reference)); } } return null; }