public void Add(Site site, Label label) { if (string.IsNullOrEmpty(label.UUID)) { label.UUID = UniqueIdGenerator.GetInstance().GetBase32UniqueId(10); } this._labelProvider.Add(label); }
public virtual void Update(Site site, Label @new, Label old) { if (@new.Site == null) { @new.Site = site; } //renew the UUID when UUID is null if (string.IsNullOrEmpty(@new.UUID)) { @new.UUID = UniqueIdGenerator.GetInstance().GetBase32UniqueId(10); } this._labelProvider.Update(@new, old); }
private static string LabelValue(string defaultValue, string key, string category, Site site) { if (string.IsNullOrEmpty(key) && string.IsNullOrEmpty(category)) { return defaultValue; } string editor = null; if (HttpContext.Current != null) { editor = HttpContext.Current.User.Identity.Name; } var labelManager = ServiceFactory.LabelManager; var label = labelManager.Get(site, category, key); string value = defaultValue; if (label == null) { label = new Label(site, category, key, defaultValue) { UtcCreationDate = DateTime.UtcNow, LastestEditor = editor }; labelManager.Add(site, label); } else { value = label.Value; } return value; }
public virtual void Remove(Site site, Label label) { this._labelProvider.Remove(label); }