public IProvider CreateProvider( Type resultType, object concreteIdentifier, UnityEngine.Object prefab, object identifier, GameObjectCreationParameters gameObjectBindInfo) { _markRegistry.MarkSingleton( resultType, concreteIdentifier, SingletonTypes.FromSubContainerPrefab); var customSingletonId = new CustomSingletonId( concreteIdentifier, prefab); CreatorInfo creatorInfo; if (_subContainerCreators.TryGetValue(customSingletonId, out creatorInfo)) { Assert.IsEqual(creatorInfo.GameObjectCreationParameters, gameObjectBindInfo, "Ambiguous creation parameters (game object name/parent info) when using ToSubContainerPrefab with AsSingle"); } else { var creator = new SubContainerCreatorCached( new SubContainerCreatorByNewPrefab(_container, new PrefabProvider(prefab), gameObjectBindInfo)); creatorInfo = new CreatorInfo(gameObjectBindInfo, creator); _subContainerCreators.Add(customSingletonId, creatorInfo); } return(new SubContainerDependencyProvider( resultType, identifier, creatorInfo.Creator)); }
public IProvider CreateProvider( Type resultType, string concreteIdentifier, string resourcePath, object identifier, string gameObjectName, string gameObjectGroupName) { _markRegistry.MarkSingleton( resultType, concreteIdentifier, SingletonTypes.ToSubContainerPrefabResource); var customSingletonId = new CustomSingletonId( concreteIdentifier, resourcePath); CreatorInfo creatorInfo; if (_subContainerCreators.TryGetValue(customSingletonId, out creatorInfo)) { Assert.IsEqual(creatorInfo.GameObjectName, gameObjectName, "Ambiguous creation parameters (gameObjectName) when using ToSubContainerPrefab with AsSingle"); Assert.IsEqual(creatorInfo.GameObjectGroupName, gameObjectGroupName, "Ambiguous creation parameters (gameObjectGroupName) when using ToSubContainerPrefab with AsSingle"); } else { var creator = new SubContainerCreatorCached( new SubContainerCreatorByPrefab( _container, new PrefabProviderResource(resourcePath), gameObjectName, gameObjectGroupName)); creatorInfo = new CreatorInfo( gameObjectName, gameObjectGroupName, creator); _subContainerCreators.Add(customSingletonId, creatorInfo); } return(new SubContainerDependencyProvider( resultType, identifier, creatorInfo.Creator)); }
public async Task AddCommentAsync(Guid userId, Guid postId, Guid commentId, string content) { var post = await this._postsRepository.GetAsync(x => x.PostId == postId); if (post is null) { _logger.Error($"Post not found: {postId.ToString()}."); throw new PostNotFoundException(postId); } var user = await this._usersRepository.GetAsync(x => x.UserId == userId); if (user is null) { _logger.Error($@"User with id: ""{userId}"" was not found."); throw new UserNotFoundException($@"User with id: ""{userId}"" was not found."); } var creatorInfo = new CreatorInfo(user.UserId, user.Username); post.AddComment(new PostComment(commentId, creatorInfo, content)); _logger.Info($"Comment with id: {commentId.ToString()} has been added successfully."); await this._postsRepository.UpdateAsync(post, x => x.PostId == postId); }
internal CreatorInfo Parse() { var rslt = new CreatorInfo(); rslt.GenericType = Generic_type.Parse(); foreach (var para in this.Assignment_expressions) { rslt.Assignment_expressions.Add(para.Parse()); } return rslt; }
internal CreatorInfo Parse() { var rslt = new CreatorInfo(); rslt.GenericType = Generic_type.Parse(); foreach (var para in this.Assignment_expressions) { rslt.Assignment_expressions.Add(para.Parse()); } return(rslt); }
private T BuildItem <T>(IdentityInfo identityInfo, SizeInfo sizeInfo, CreatorInfo creatorInfo, CatalogInfo catalogInfo, TargetInfo targetInfo, UserInfo userInfo, ThumbnailInfo thumbnailInfo) where T : class, IMetadata { var builder = new MediaItemBuilder <T>(securityContext, mediaFactory) .Identity(identityInfo.Name, identityInfo.Summary, identityInfo.FromDate, identityInfo.ToDate, identityInfo.Number, identityInfo.Location) .Size(sizeInfo.Duration, sizeInfo.Height, sizeInfo.Width) .Creator(creatorInfo.Location, creatorInfo.Name) .Catalog(catalogInfo.Location, catalogInfo.Name) .Target(targetInfo.Location, targetInfo.Type) .User(userInfo.Location, userInfo.Name) .Thumbnail(thumbnailInfo.Location, thumbnailInfo.Data); return(builder.ToMediaItem()); }
private DFDoc CreateDoc() { var content = CreateRandomFileContent(); var progInfo = new ProgramSystemInfo("DFDocTest", "0.0.0.1"); var dfDoc = DFDoc.CreateNew(progInfo); var creationDate = DateTime.UtcNow; var creator = new CreatorInfo("DATAflor", creationDate, "ADR005648"); var dmsInfo = new DMSDocumentInfo("Testdokument", "Mustermann, Max", "Auftrag", "sonstiges", null, new ReferenceType(XRefType.Adresse, "OWNERDATA_ADR")); dmsInfo.AddAnotherReference(new ReferenceType(XRefType.Mitarbeiter, creator.MitarbeiterId)); var dmsDoc = new DMSDocument("Test.data", creator, dmsInfo); dfDoc.AddDmsDocument(dmsDoc, content); return(dfDoc); }
public void DocWithTwoFilesWithSameNameNotAllowedTest() { var dfDoc = CreateDoc(); // create second document var content = CreateRandomFileContent(); var creationDate = DateTime.UtcNow; var creator = new CreatorInfo("DATAflor", creationDate, "ADR005648"); var dmsInfo = new DMSDocumentInfo("Testdokument", "Mustermann, Max", "Auftrag", "sonstiges", null, new ReferenceType(XRefType.Adresse, "OWNERDATA_ADR")); dmsInfo.AddAnotherReference(new ReferenceType(XRefType.Mitarbeiter, creator.MitarbeiterId)); var dmsDoc = new DMSDocument("Test.data", creator, dmsInfo); // There is already an item with the name Test.data Assert.Throws <InvalidFileformatException>(() => dfDoc.AddDmsDocument(dmsDoc, content)); }
public async Task <Guid> AddPostAsync(Guid userId, string content, string plateIdentifier, string plateNumber) { var user = await this._usersRepository.GetAsync(x => x.UserId == userId); if (user is null) { _logger.Error($@"User with id: ""{userId}"" was not found."); throw new UserNotFoundException($@"User with id: ""{userId}"" was not found."); } var plate = new Plate(plateIdentifier, plateNumber); var creatorInfo = new CreatorInfo(user.UserId, user.Username); var post = new Post(creatorInfo, plate, content); await this._postsRepository.AddAsync(post); _logger.Info($"Post with id: {post.PostId} has been added successfully."); return(post.PostId); }
private void SaveMediaItems(IVideo video) { try { var artist = video.GetArtist(securityContext, mediaFactory, mediaItemRepository); mediaItemRepository.Save(new List <IArtist> { artist }); tagRepository.Save(artist.GetTags()); var album = video.GetAlbum(securityContext, mediaFactory, mediaItemRepository, artist); mediaItemRepository.Save(new List <IAlbum> { album }); tagRepository.Save(album.GetTags()); var clip = video.GetClip(securityContext, mediaFactory, mediaItemRepository, artist, album); mediaItemRepository.Save(new List <IClip> { clip }); tagRepository.Save(clip.GetTags()); var clipDate = clip.FromDate > DateTime.MinValue ? clip.FromDate : clip.ToDate; if (album.FromDate == DateTime.MinValue && clipDate != DateTime.MinValue) { var identityInfo = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, clipDate, clipDate, album.Number); var sizeInfo = new SizeInfo(album.Duration, album.Height, album.Width); var creatorInfo = new CreatorInfo(album.Creator, album.CreatorName); var catalogInfo = new CatalogInfo(album.Catalog, album.CatalogName); var targetInfo = new TargetInfo(album.Target, album.TargetType); var userInfo = new UserInfo(album.User, album.UserName); var thumbnailInfo = new ThumbnailInfo(album.Thumbnail, album.ThumbnailData); album = new Album(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo); mediaItemRepository.Save(new List <IAlbum> { album }); } } catch (Exception ex) { logger.Error(" CatalogSpider.SaveMediaItems", ex); } }
protected virtual T ReadItem <T>(IDataRecord record) where T : class, IMetadata { var location = record.GetUri("Location"); var defaultItem = GetDefaultItem <T>(); if (defaultItem != null && defaultItem.Location.ToString() == location.ToString()) { return(defaultItem); } var name = record.GetString("Name"); var summary = record.GetString("Summary"); var fromDate = record.GetDateTime("FromDate"); var toDate = record.GetDateTime("ToDate"); var number = record.GetUInt32("Number"); var duration = record.GetTimeSpan("Duration"); var height = record.GetUInt32("Height"); var width = record.GetUInt32("Width"); var creator = record.GetUri("Creator"); var creatorName = record.GetString("CreatorName"); var catalog = record.GetUri("Catalog"); var catalogName = record.GetString("CatalogName"); var target = record.GetUri("Target"); var targetType = record.GetString("TargetType"); var user = record.GetUri("User"); var userName = record.GetString("UserName"); var thumbnail = record.GetUri("Thumbnail"); var thumbnailData = record.GetBytes("ThumbnailData"); var identityInfo = new IdentityInfo(location, defaultItem.Type, name, summary, fromDate, toDate, number); var sizeInfo = new SizeInfo(duration, height, width); var creatorInfo = new CreatorInfo(creator, creatorName); var catalogInfo = new CatalogInfo(catalog, catalogName); var targetInfo = new TargetInfo(target, targetType); var userInfo = new UserInfo(user, userName); var thumbnailInfo = new ThumbnailInfo(thumbnail, thumbnailData); return(BuildItem <T>(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo)); }
public async Task AddPlateCommentAsync(string plateIdentifier, string plateNumber, Guid userId, string comment, int note) { var modifiedIdentifier = plateIdentifier?.Trim().ToUpperInvariant(); var modifiedNumber = plateNumber?.Trim().ToUpperInvariant(); if (string.IsNullOrEmpty(modifiedIdentifier)) { throw new InvalidPlateIdentifierException(modifiedIdentifier); } if (string.IsNullOrEmpty(modifiedNumber)) { throw new InvalidPlateNumberException(modifiedNumber); } var plateDetails = await this._platesDetailsRepository.GetAsync(x => x.Identifier == plateIdentifier && x.Number == plateNumber); if (plateDetails is null) { throw new PlateNotFoundException(modifiedIdentifier, modifiedNumber); } var user = await this._usersRepository.GetAsync(x => x.UserId == userId); if (user is null) { throw new UserNotFoundException($"User with id: {userId} was not found."); } var creator = new CreatorInfo(userId, user.Username); var plateComment = new PlateComment(creator, comment, note); plateDetails.AddComment(plateComment); await this._platesDetailsRepository.UpdateAsync(plateDetails, x => x.Identifier == plateIdentifier && x.Number == plateNumber); }
protected void Page_Load(object sender, EventArgs e) { switch (_catalogType) { case CatalogType.Widgets: LiHyperLink.SetNameToCompare(Context, "presentation"); PageBreadcrumbs.SectionName = Breadcrumbs.Section.WidgetMarketplace; break; case CatalogType.Themes: LiHyperLink.SetNameToCompare(Context, "presentation"); PageBreadcrumbs.SectionName = Breadcrumbs.Section.ThemeMarketplace; break; case CatalogType.Plugins: LiHyperLink.SetNameToCompare(Context, "settings"); PageBreadcrumbs.SectionName = Breadcrumbs.Section.PluginMarketplace; break; case CatalogType.All: Response.Redirect(new Urls().AdminMarketplaceHome); break; } if (!IsPostBack) { try { CatalogInfo catalog = null; if (Marketplace.Catalogs.ContainsKey(_catalogType)) { catalog = Marketplace.Catalogs[_catalogType]; } MessageInfo messageInfo = null; if (catalog.Messages.Count > 0) { messageInfo = catalog.Messages[0]; } else if (Marketplace.Messages.Count > 0) { messageInfo = Marketplace.Messages[0]; } if (messageInfo != null) { MarketplaceMessage.Visible = true; MarketplaceMessage.Type = StatusType.Information; MarketplaceMessage.Text = messageInfo.Text; } categoryList.DataSource = catalog.Categories.Values; categoryList.DataBind(); itemList.DataSource = catalog.Items.Values; if (_categoryId > 0) { CategoryInfo category = catalog.Categories[_categoryId]; itemList.DataSource = category.Items.Values; } else if (!string.IsNullOrEmpty(_creatorId)) { CreatorInfo creator = Marketplace.Creators[_creatorId]; itemList.DataSource = creator.GetItems(_catalogType).Values; } itemList.DataBind(); } catch (Exception ex) { string messageText = "An unexpected error has occurred connecting to the marketplace. The <a href=\"http://extendgraffiti.com/\" target=\"_blank\">Graffiti Marketplace</a> is where you can find new themes, widgets, and plugins. Please try again later."; if (ex is System.Security.SecurityException) { messageText = "Your security settings do not allow you to access the marketplace from within the Control Panel. To find new themes, widgets, and plugins, please visit the <a href=\"http://extendgraffiti.com/\" target=\"_blank\">Graffiti Marketplace</a>."; } Message.Type = StatusType.Error; Message.Text = messageText; Message.Visible = true; MarketplaceImage.Visible = true; PageBreadcrumbs.Visible = false; categoryList.Visible = false; itemList.Visible = false; } } }
private string GetBreadCrumbs() { Urls urls = new Urls(); StringBuilder crumbs = new StringBuilder(); if (Page.MasterPageFile.EndsWith("AdminModal.master")) { crumbs.Append("<div class=\"breadcrumbs_modal\">"); } else { crumbs.Append("<div class=\"breadcrumbs\">"); } switch (_sectionName) { case Section.ThemeEdit: { crumbs.Append(GetHyperLink("Presentation", ResolveUrl("~/graffiti-admin/presentation/"), true)); crumbs.Append(GetHyperLink("Themes", ResolveUrl("~/graffiti-admin/presentation/themes/"), true)); string theme = HttpContext.Current.Request.QueryString[QueryStringKey.Theme]; crumbs.Append(GetHyperLink(theme, String.Format("EditTheme.aspx?{0}={1}", QueryStringKey.Theme, theme), false)); } break; case Section.ConfigureTheme: { crumbs.Append(GetHyperLink("Presentation", ResolveUrl("~/graffiti-admin/presentation/"), true)); crumbs.Append(GetHyperLink("Themes", ResolveUrl("~/graffiti-admin/presentation/themes/"), true)); string theme = HttpContext.Current.Request.QueryString[QueryStringKey.Theme]; crumbs.Append(GetHyperLink(theme, String.Format("EditTheme.aspx?{0}={1}", QueryStringKey.Theme, theme), true)); crumbs.Append(GetHyperLink("Configure Theme", ResolveUrl("~/graffiti-admin/presentation/themes/ConfigureTheme.aspx?" + QueryStringKey.Theme + "=" + theme), false)); } break; case Section.Widget: crumbs.Append(GetHyperLink("Presentation", ResolveUrl("~/graffiti-admin/presentation/"), true)); crumbs.Append(GetHyperLink("Widgets", ResolveUrl("~/graffiti-admin/presentation/widgets/"), true)); break; case Section.WidgetEdit: crumbs.Append(GetHyperLink("Presentation", ResolveUrl("~/graffiti-admin/presentation/"), true)); crumbs.Append(GetHyperLink("Widgets", ResolveUrl("~/graffiti-admin/presentation/widgets/"), true)); Widget widget = Widgets.Fetch(new Guid(HttpContext.Current.Request.QueryString[QueryStringKey.Id])); crumbs.Append(GetHyperLink(widget.Name, String.Format("edit.aspx?{0}={1}", QueryStringKey.Id, widget.Id), false)); break; case Section.SiteSettings: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Settings", ResolveUrl("~/graffiti-admin/site-options/settings/"), false)); break; case Section.Configuration: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Configuration", ResolveUrl("~/graffiti-admin/site-options/configuration/"), false)); break; case Section.Utilities: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Utilities", ResolveUrl("~/graffiti-admin/site-options/utilities/"), false)); break; case Section.RebuildPages: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Utilities", ResolveUrl("~/graffiti-admin/site-options/utilities/"), true)); crumbs.Append(GetHyperLink("Rebuild Pages", ResolveUrl("~/graffiti-admin/site-options/utilities/RebuildPages.aspx"), false)); break; case Section.Logs: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Utilities", ResolveUrl("~/graffiti-admin/site-options/utilities/"), true)); crumbs.Append(GetHyperLink("Logs", ResolveUrl("~/graffiti-admin/site-options/utilities/LogViewer.aspx"), false)); break; case Section.Migrator: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Utilities", ResolveUrl("~/graffiti-admin/site-options/utilities/"), true)); crumbs.Append(GetHyperLink("Migrator", ResolveUrl("~/graffiti-admin/site-options/utilities/migrator/"), false)); break; case Section.Comments: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Comments", ResolveUrl("~/graffiti-admin/site-options/comments/"), false)); break; case Section.CustomFields: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Custom Fields", ResolveUrl("~/graffiti-admin/site-options/custom-fields/"), true)); string customFieldId = HttpContext.Current.Request.QueryString[QueryStringKey.Id]; int fieldCategoryId = int.Parse(HttpContext.Current.Request.QueryString["category"] ?? "-1"); if (!String.IsNullOrEmpty(customFieldId)) { CustomFormSettings csf = CustomFormSettings.Get(fieldCategoryId, false); CustomField cf = null; Guid g = new Guid(customFieldId); foreach (CustomField cfx in csf.Fields) { if (cfx.Id == g) { cf = cfx; break; } } if (cf != null) { crumbs.Append(GetHyperLink(cf.Name, ResolveUrl("~/graffiti-admin/site-options/custom-fields/?id=" + cf.Id), false)); } } break; case Section.Themes: crumbs.Append(GetHyperLink("Presentation", ResolveUrl("~/graffiti-admin/presentation/"), true)); crumbs.Append(GetHyperLink("Themes", ResolveUrl("~/graffiti-admin/presentation/themes/"), false)); break; case Section.SortHomePosts: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Home Page", ResolveUrl("~/graffiti-admin/site-options/homesort/"), false)); break; case Section.Licensing: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Licensing", ResolveUrl("~/graffiti-admin/site-options/licensing/"), false)); break; case Section.Categories: { string id = HttpContext.Current.Request.QueryString[QueryStringKey.Id]; if (String.IsNullOrEmpty(id)) { return(string.Empty); } var categories = new List <Category>(); Category c = new Category(id); categories.Add(c); Category parent; if (c.ParentId != -1) { parent = c; bool noMoreParents = false; while (!noMoreParents) { parent = new Category(parent.ParentId); if (parent.Id != 0) { categories.Insert(0, parent); } else { noMoreParents = true; } } } crumbs.Append(GetHyperLink("Categories", ResolveUrl("~/graffiti-admin/categories/"), true)); int counter = 0; int catCount = categories.Count; foreach (Category tempcat in categories) { counter++; bool addArrow = counter == catCount ? false : true; crumbs.Append(GetHyperLink(tempcat.Name, ResolveUrl("~/graffiti-admin/categories/?id=" + tempcat.Id), addArrow)); } } break; case Section.SortPosts: { string id = HttpContext.Current.Request.QueryString[QueryStringKey.Id]; if (String.IsNullOrEmpty(id)) { return(string.Empty); } var categories = new List <Category>(); Category c = new Category(id); categories.Add(c); Category parent; if (c.ParentId != -1) { parent = c; bool noMoreParents = false; while (!noMoreParents) { parent = new Category(parent.ParentId); if (parent.Id != 0) { categories.Insert(0, parent); } else { noMoreParents = true; } } } crumbs.Append(GetHyperLink("Categories", ResolveUrl("~/graffiti-admin/categories/"), true)); foreach (Category tempcat in categories) { crumbs.Append(GetHyperLink(tempcat.Name, ResolveUrl("~/graffiti-admin/categories/?id=" + tempcat.Id), true)); } crumbs.Append(GetHyperLink("Order Posts", ResolveUrl("~/graffiti-admin/categories/PostSortOrder.aspx?id=" + id), false)); } break; case Section.SiteComments: string commentId = HttpContext.Current.Request.QueryString[QueryStringKey.Id]; if (String.IsNullOrEmpty(commentId)) { return(string.Empty); } Comment comment = new Comment(commentId); crumbs.Append(GetHyperLink("Comments", ResolveUrl("~/graffiti-admin/comments/"), true)); crumbs.Append(GetHyperLink(comment.Name + " @ " + comment.Published, ResolveUrl("~/graffiti-admin/comments/?id=" + comment.Id), false)); break; case Section.Navigation: crumbs.Append(GetHyperLink("Presentation", ResolveUrl("~/graffiti-admin/presentation/"), true)); crumbs.Append(GetHyperLink("Navigation", ResolveUrl("~/graffiti-admin/presentation/navigation/"), false)); break; case Section.UserManagement: crumbs.Append(GetHyperLink("User Management", ResolveUrl("~/graffiti-admin/user-management/"), true)); string user = HttpContext.Current.Request.QueryString[QueryStringKey.User]; if (!String.IsNullOrEmpty(user)) { crumbs.Append(GetHyperLink("Users", ResolveUrl("~/graffiti-admin/user-management/users"), true)); IGraffitiUser graffitiUser = GraffitiUsers.GetUser(user); crumbs.Append(GetHyperLink(graffitiUser.Name, ResolveUrl("~/graffiti-admin/user-management/users/?user="******"Users", ResolveUrl("~/graffiti-admin/user-management/users"), false)); } break; case Section.Roles: crumbs.Append(GetHyperLink("User Management", ResolveUrl("~/graffiti-admin/user-management/"), true)); string role = HttpUtility.HtmlEncode( HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString[QueryStringKey.Role])); if (!String.IsNullOrEmpty(role)) { crumbs.Append(GetHyperLink("Roles", ResolveUrl("~/graffiti-admin/user-management/roles"), true)); crumbs.Append(GetHyperLink(role, ResolveUrl("~/graffiti-admin/user-management/roles/?role=" + role), false)); } else { crumbs.Append(GetHyperLink("Roles", ResolveUrl("~/graffiti-admin/user-management/roles"), false)); } break; case Section.ChangePassword: string cpUser = HttpContext.Current.Request.QueryString[QueryStringKey.User]; if (String.IsNullOrEmpty(cpUser)) { return(string.Empty); } IGraffitiUser graffitiUser1 = GraffitiUsers.GetUser(cpUser); crumbs.Append(GetHyperLink("User Management", ResolveUrl("~/graffiti-admin/user-management/"), true)); crumbs.Append(GetHyperLink("Users", ResolveUrl("~/graffiti-admin/user-management/users/"), true)); crumbs.Append(GetHyperLink(graffitiUser1.Name, ResolveUrl("~/graffiti-admin/user-management/users/?user="******"Change Password", ResolveUrl("~/graffiti-admin/user-management/users/changepassword.aspx?user="******"Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Plug-Ins", ResolveUrl("~/graffiti-admin/site-options/plug-ins/"), false)); break; case Section.PlugInsEdit: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Plug-Ins", ResolveUrl("~/graffiti-admin/site-options/plug-ins/"), true)); EventDetails ed = Core.Events.GetEvent(HttpContext.Current.Request.QueryString["t"]); crumbs.Append(GetHyperLink(ed.Event.Name, ResolveUrl("~/graffiti-admin/site-options/plug-ins/edit.aspx?t=") + HttpContext.Current.Request.QueryString["t"], false)); break; case Section.Packages: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Packages", ResolveUrl("~/graffiti-admin/site-options/packages/"), false)); break; case Section.EmailSettings: crumbs.Append(GetHyperLink("Site Options", ResolveUrl("~/graffiti-admin/site-options/"), true)); crumbs.Append(GetHyperLink("Email Settings", ResolveUrl("~/graffiti-admin/site-options/email-settings/"), false)); break; case Section.WidgetMarketplace: crumbs.Append(GetHyperLink("All Widgets", urls.AdminMarketplace("Widgets"), true)); CatalogInfo widgets = Marketplace.Marketplace.Catalogs[CatalogType.Widgets]; int categoryId = 0; string category = HttpContext.Current.Request.QueryString["category"]; if (!string.IsNullOrEmpty(category)) { try { categoryId = int.Parse(category); } catch { } } if ((categoryId != 0) && widgets.Categories.ContainsKey(categoryId)) { CategoryInfo categoryInfo = widgets.Categories[categoryId]; crumbs.Append(GetHyperLink(categoryInfo.Name, urls.AdminMarketplace("Widgets") + "&category=" + categoryInfo.Id.ToString(), false)); } string creatorId = string.Empty; if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["creator"])) { creatorId = HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["creator"]); } if (!string.IsNullOrEmpty(creatorId) && (Marketplace.Marketplace.Creators.ContainsKey(creatorId))) { CreatorInfo creatorInfo = Marketplace.Marketplace.Creators[creatorId]; crumbs.Append(GetHyperLink(creatorInfo.Name, urls.AdminMarketplace("Widgets") + "&creator=" + HttpUtility.UrlEncode(creatorInfo.Id), false)); } int itemId = 0; string item = HttpContext.Current.Request.QueryString["item"]; if (!string.IsNullOrEmpty(item)) { try { itemId = int.Parse(item); } catch { } } if ((itemId != 0) && (widgets.Items.ContainsKey(itemId))) { ItemInfo itemInfo = widgets.Items[itemId]; CategoryInfo categoryInfo = itemInfo.Category; if (categoryInfo != null) { crumbs.Append(GetHyperLink(categoryInfo.Name, urls.AdminMarketplace("Widgets") + "&category=" + categoryInfo.Id.ToString(), true)); crumbs.Append(GetHyperLink(itemInfo.Name, urls.AdminMarketplaceItem("Widgets", itemInfo.Id), false)); } } break; case Section.ThemeMarketplace: crumbs.Append(GetHyperLink("All Themes", urls.AdminMarketplace("Themes"), true)); CatalogInfo themeCatalog = Marketplace.Marketplace.Catalogs[CatalogType.Themes]; categoryId = 0; category = HttpContext.Current.Request.QueryString["category"]; if (!string.IsNullOrEmpty(category)) { try { categoryId = int.Parse(category); } catch { } } if ((categoryId != 0) && (themeCatalog.Categories.ContainsKey(categoryId))) { CategoryInfo categoryInfo = themeCatalog.Categories[categoryId]; crumbs.Append(GetHyperLink(categoryInfo.Name, urls.AdminMarketplace("Themes") + "&category=" + categoryInfo.Id.ToString(), false)); } creatorId = string.Empty; if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["creator"])) { creatorId = HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["creator"]); } if (!string.IsNullOrEmpty(creatorId) && (Marketplace.Marketplace.Creators.ContainsKey(creatorId))) { CreatorInfo creatorInfo = Marketplace.Marketplace.Creators[creatorId]; crumbs.Append(GetHyperLink(creatorInfo.Name, urls.AdminMarketplace("Themes") + "&creator=" + HttpUtility.UrlEncode(creatorInfo.Id), false)); } itemId = 0; item = HttpContext.Current.Request.QueryString["item"]; if (!string.IsNullOrEmpty(item)) { try { itemId = int.Parse(item); } catch { } } if ((itemId != 0) && (themeCatalog.Items.ContainsKey(itemId))) { ItemInfo itemInfo = themeCatalog.Items[itemId]; CategoryInfo categoryInfo = itemInfo.Category; if (categoryInfo != null) { crumbs.Append(GetHyperLink(categoryInfo.Name, urls.AdminMarketplace("Themes") + "&category=" + categoryInfo.Id.ToString(), true)); crumbs.Append(GetHyperLink(itemInfo.Name, urls.AdminMarketplaceItem("Themes", itemInfo.Id), false)); } } break; case Section.PluginMarketplace: crumbs.Append(GetHyperLink("All Plugins", urls.AdminMarketplace("Plugins"), true)); CatalogInfo plugins = Marketplace.Marketplace.Catalogs[CatalogType.Plugins]; categoryId = 0; category = HttpContext.Current.Request.QueryString["category"]; if (!string.IsNullOrEmpty(category)) { try { categoryId = int.Parse(category); } catch { } } if ((categoryId != 0) && plugins.Categories.ContainsKey(categoryId)) { CategoryInfo categoryInfo = plugins.Categories[categoryId]; crumbs.Append(GetHyperLink(categoryInfo.Name, urls.AdminMarketplace("Plugins") + "&category=" + categoryInfo.Id.ToString(), false)); } creatorId = string.Empty; if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["creator"])) { creatorId = HttpUtility.UrlDecode(HttpContext.Current.Request.QueryString["creator"]); } if (!string.IsNullOrEmpty(creatorId) && (Marketplace.Marketplace.Creators.ContainsKey(creatorId))) { CreatorInfo creatorInfo = Marketplace.Marketplace.Creators[creatorId]; crumbs.Append(GetHyperLink(creatorInfo.Name, urls.AdminMarketplace("Plugins") + "&creator=" + HttpUtility.UrlEncode(creatorInfo.Id), false)); } itemId = 0; item = HttpContext.Current.Request.QueryString["item"]; if (!string.IsNullOrEmpty(item)) { try { itemId = int.Parse(item); } catch { } } if ((itemId != 0) && (plugins.Items.ContainsKey(itemId))) { ItemInfo itemInfo = plugins.Items[itemId]; CategoryInfo categoryInfo = itemInfo.Category; if (categoryInfo != null) { crumbs.Append(GetHyperLink(categoryInfo.Name, urls.AdminMarketplace("Plugins") + "&category=" + categoryInfo.Id.ToString(), true)); crumbs.Append(GetHyperLink(itemInfo.Name, urls.AdminMarketplaceItem("Plugins", itemInfo.Id), false)); } } break; // more breadcrumb logic here, add a value to the enum } crumbs.Append("</div>"); return(crumbs.ToString()); }
private void SaveMediaItems(IAudio audio) { try { var artist = audio.GetArtist(securityContext, mediaFactory, mediaItemRepository); mediaItemRepository.Save(new List <IArtist> { artist }); tagRepository.Save(artist.GetTags()); var album = audio.GetAlbum(securityContext, mediaFactory, mediaItemRepository, artist); mediaItemRepository.Save(new List <IAlbum> { album }); tagRepository.Save(album.GetTags()); var track = audio.GetTrack(securityContext, mediaFactory, mediaItemRepository, audioStreamFactory, artist, album); mediaItemRepository.Save(new List <ITrack> { track }); tagRepository.Save(track.GetTags()); var trackDate = track.FromDate > DateTime.MinValue ? track.FromDate : track.ToDate; if (album.FromDate == DateTime.MinValue && trackDate != DateTime.MinValue) { var identityInfo = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, trackDate, trackDate, album.Number); var sizeInfo = new SizeInfo(album.Duration, album.Height, album.Width); var creatorInfo = new CreatorInfo(album.Creator, album.CreatorName); var catalogInfo = new CatalogInfo(album.Catalog, album.CatalogName); var targetInfo = new TargetInfo(album.Target, album.TargetType); var userInfo = new UserInfo(album.User, album.UserName); var thumbnailInfo = new ThumbnailInfo(album.Thumbnail, album.ThumbnailData); album = new Album(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo); mediaItemRepository.Save(new List <IAlbum> { album }); } //if (album.ToDate == DateTime.MinValue && track.ToDate != DateTime. if (!HasDefaultThumbnail(track)) { if (HasDefaultThumbnail(album)) { //var fromDate = album.FromDate; //if (album.FromDate == DateTime.MinValue || album.FromDate == DateTime.MaxValue) //{ // fromDate = track.ToDate != DateTime.MinValue && track.ToDate != DateTime.MaxValue ? // track.ToDate // : track.FromDate; //} var number = album.Number; if (album.Name.Contains("#") && !album.Name.EndsWith("#")) { var suffix = album.Name.Substring(album.Name.LastIndexOf('#') + 1).Trim(); uint.TryParse(suffix, out number); } else if (album.Name.Contains("(") && !album.Name.EndsWith("(")) { var suffix = album.Name.Substring(album.Name.LastIndexOf("(") + 1); var cleaned = System.Text.RegularExpressions.Regex.Replace(suffix, "[^0-9]", string.Empty); uint.TryParse(cleaned, out number); } var identityInfo = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, album.FromDate, album.ToDate, number); var sizeInfo = new SizeInfo(album.Duration, album.Height, album.Width); var creatorInfo = new CreatorInfo(album.Creator, album.CreatorName); var catalogInfo = new CatalogInfo(album.Catalog, album.CatalogName); var targetInfo = new TargetInfo(album.Target, album.TargetType); var userInfo = new UserInfo(album.User, album.UserName); var thumbnailInfo = new ThumbnailInfo(track.Thumbnail, track.ThumbnailData); var updated = new Album(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo); mediaItemRepository.Save(new List <IAlbum> { updated }); } } } catch (Exception ex) { logger.Error(" SaveMediaItems", ex); } }