public Outcome UpdatePageProperty(int portalId, int tabId, TabFields field, string fieldValue) { try { var tab = TabController.Instance.GetTab(tabId, portalId); if (tab == null) { return(new Outcome() { Success = false, ErrorMessage = Constants.ERROR_PAGE_TABID_INVALID }); } if (field == TabFields.Title) { tab.Title = fieldValue; } else if (field == TabFields.Name) { if (string.IsNullOrEmpty(fieldValue)) { return(new Outcome() { Success = false, ErrorMessage = Constants.ERROR_PAGE_NAME_REQUIRED }); } tab.TabName = fieldValue; } else if (field == TabFields.Description) { tab.Description = fieldValue; } else if (field == TabFields.Keywords) { tab.KeyWords = fieldValue; } else if (field == TabFields.Visible) { tab.IsVisible = bool.Parse(fieldValue); } else if (field == TabFields.Indexed) { tab.Indexed = bool.Parse(fieldValue); } else if (field == TabFields.Priority) { float priority = float.Parse(fieldValue); if (priority < 0 || priority > 1) { return(new Outcome() { Success = false, ErrorMessage = Constants.ERROR_PAGE_PRIORITY_RANGE_INVALID }); } priority = (float)Math.Round((Decimal)priority, 1); tab.SiteMapPriority = priority; } else if (field == TabFields.PrimaryURL) { var urlUpdateOutcome = UpdateTabUrl(tab, portalId, fieldValue); if (urlUpdateOutcome.Success == false) { return(urlUpdateOutcome); } } TabController.Instance.UpdateTab(tab); return(new Outcome() { Success = true, ErrorMessage = Constants.SUCCESS_UPDATED }); } catch (Exception ex) { LogError(ex); Exceptions.LogException(ex); return(new Outcome() { Success = false, ErrorMessage = string.Format(Constants.ERROR_FORMAT_UPDATE_VALUE, field.ToString(), ex.Message) }); } }
/// <summary> /// Initializes a new instance of the <see cref="Tab" /> class. /// </summary> public Tab() : base(CLASS_NAME) { mFields = new TabFields(this); }