Beispiel #1
0
        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);
                }
            }
        }