コード例 #1
0
ファイル: LogOnControl.cs プロジェクト: jy4618272/Common
        private void CheckSignupUser()
        {
            if ((this.OrganizationId == Guid.Empty) || (this.InstanceId == Guid.Empty))
            {
                Guid orgId = Guid.Empty;
                Guid insId = Guid.Empty;
                if (FrameworkConfiguration.Current.WebApplication.CustomUrl.Enabled && m_Organization == null)
                {
                    if (!CustomUrlProvider.IsDefaultVanityUrl(Request.Url.Host))
                    {
                        CustomUrlProvider.ParseHost(Request.Url.Host, ref orgId, ref insId);
                    }
                }

                this.OrganizationId = orgId;
                this.InstanceId     = insId;

                if ((this.OrganizationId == Guid.Empty) || (this.InstanceId == Guid.Empty))
                {
                    return;
                }
            }

            Organization organization = OrganizationProvider.GetOrganization(this.OrganizationId);

            if (organization != null)
            {
                if (organization.Deleted)
                {
                    ShowErrorMessage(Resources.LogOnControl_OrganizationIsDeleted);
                    return;
                }
                else if (!organization.Active)
                {
                    ShowErrorMessage(Resources.LogOnControl_OrganizationIsInactive);
                    return;
                }
            }
            else
            {
                ShowErrorMessage(Resources.LogOnControl_OrganizationIsNotFound);
                return;
            }

            Instance instance = InstanceProvider.GetInstance(this.InstanceId, this.OrganizationId);

            if (instance == null)
            {
                return;
            }

            if (!instance.Active)
            {
                ShowErrorMessage(Resources.LogOnControl_InstanceIsInactive);
                return;
            }

            this.OrganizationId = instance.OrganizationId;
            m_Organization      = organization;
            m_Instance          = instance;

            if (!instance.EnableSignupUser)
            {
                return;
            }

            Guid groupId = GroupProvider.GetGroupIdOfLowestRoleInInstance(instance.OrganizationId, instance.InstanceId);

            if (groupId != Guid.Empty)
            {
                m_MainContainerHeight   = 300;
                SignupUserTable.Visible = true;
            }
            else
            {
                SignupUserButton.CommandArgument = string.Empty;
            }
        }