protected override void OnLoad(EventArgs e) { base.OnLoad(e); m_UserContext = UserContext.Current; if (!Page.IsPostBack) { MasterDataSet.CustomUrlRow row = null; if (m_UserContext.InstanceId != Guid.Empty) { row = CustomUrlProvider.GetCustomUrl(m_UserContext.OrganizationId, m_UserContext.InstanceId); } if (row == null) { row = CustomUrlProvider.GetCustomUrlByOrganizationId(m_UserContext.OrganizationId); } if (row != null) { VanityUrlTextBox.Text = row.PartialCustomUrl.ToLowerInvariant(); FullVanityUrlTextBox.Text = row.FullCustomUrl.ToLowerInvariant(); } if (ShowFullVanityUrl) { TrFullCustomURL.Visible = true; PartialVanityUrlTitle.Visible = true; } } }
protected void SimpleViewSaveButton_Click(object sender, EventArgs e) { if (Page.IsValid) { try { Guid orgId = m_UserContext.OrganizationId; Guid?instId = null; if (m_UserContext.InstanceId != Guid.Empty) { instId = m_UserContext.InstanceId; } MasterDataSet.CustomUrlRow row = null; if (instId.HasValue) { row = CustomUrlProvider.GetCustomUrl(orgId, instId.Value); } if (row == null) { row = CustomUrlProvider.GetCustomUrlByOrganizationId(orgId); } if (row != null) { CustomUrlProvider.UpdateCustomUrl(row.CustomUrlId, ((ShowFullVanityUrl && !string.IsNullOrEmpty(FullVanityUrlTextBox.Text.Trim())) ? FullVanityUrlTextBox.Text.ToLowerInvariant() : null), VanityUrlTextBox.Text.ToLowerInvariant()); } else { CustomUrlProvider.InsertCustomUrl(orgId, instId, ((ShowFullVanityUrl && !string.IsNullOrEmpty(FullVanityUrlTextBox.Text.Trim())) ? FullVanityUrlTextBox.Text.ToLowerInvariant() : null), VanityUrlTextBox.Text.ToLowerInvariant()); } SimpleViewTitleLabel.Text = Resources.CustomUrlsControl_SimpleViewMessageLabel_Text; if (SaveButtonClick != null) { SaveButtonClick(sender, e); } } catch (ConstraintException ex) { BaseControl.ShowError(ex, SimpleErrorPanel); } } }