Exemplo n.º 1
0
        private void CreateHuntgroup(UMDialPlan dp)
        {
            UMHuntGroup umhuntGroup = new UMHuntGroup();

            umhuntGroup.UMDialPlan = dp.Id;
            AdName     adName       = new AdName("CN", Strings.DefaultUMHuntGroupName.ToString());
            ADObjectId descendantId = this.DataObject.Id.GetDescendantId(new ADObjectId(adName.ToString(), Guid.Empty));

            base.WriteVerbose(Strings.AttemptingToCreateHuntgroup);
            umhuntGroup.SetId(descendantId);
            if (base.CurrentOrganizationId != null)
            {
                umhuntGroup.OrganizationId = base.CurrentOrganizationId;
            }
            else
            {
                umhuntGroup.OrganizationId = base.ExecutingUserOrganizationId;
            }
            base.DataSession.Save(umhuntGroup);
        }
Exemplo n.º 2
0
        protected override void InternalValidate()
        {
            Dictionary <Guid, bool> dictionary = new Dictionary <Guid, bool>();

            TaskLogger.LogEnter();
            base.InternalValidate();
            if (!base.HasErrors)
            {
                this.rootOrgConfigSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 123, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs");
                if (this.DialPlan != null)
                {
                    IEnumerable <UMDialPlan> objects = this.DialPlan.GetObjects <UMDialPlan>(null, this.rootOrgConfigSession);
                    using (IEnumerator <UMDialPlan> enumerator = objects.GetEnumerator())
                    {
                        if (!enumerator.MoveNext())
                        {
                            base.WriteError(new LocalizedException(Strings.NonExistantDialPlan(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan);
                        }
                        this.adResults = enumerator.Current;
                        if (enumerator.MoveNext())
                        {
                            base.WriteError(new LocalizedException(Strings.MultipleDialplansWithSameId(this.DialPlan.ToString())), ErrorCategory.InvalidData, this.DialPlan);
                        }
                    }
                    UMDialPlan dialPlan = (UMDialPlan)this.adResults;
                    if (Utility.DialPlanHasIncompatibleServers(dialPlan, this.rootOrgConfigSession, dictionary))
                    {
                        this.WriteWarning(Strings.InvalidServerVersionInDialPlan(((UMDialPlan)this.adResults).Name));
                    }
                }
                else
                {
                    if (this.IPGateway != null)
                    {
                        IEnumerable <UMIPGateway> objects2 = this.IPGateway.GetObjects <UMIPGateway>(null, this.rootOrgConfigSession);
                        using (IEnumerator <UMIPGateway> enumerator2 = objects2.GetEnumerator())
                        {
                            if (!enumerator2.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.NonExistantIPGateway(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway);
                            }
                            this.adResults = enumerator2.Current;
                            if (enumerator2.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.MultipleIPGatewaysWithSameId(this.IPGateway.ToString())), ErrorCategory.InvalidData, this.IPGateway);
                            }
                        }
                        if (CommonConstants.UseDataCenterCallRouting)
                        {
                            goto IL_36F;
                        }
                        UMIPGateway umipgateway = (UMIPGateway)this.adResults;
                        using (MultiValuedProperty <UMHuntGroup> .Enumerator enumerator3 = umipgateway.HuntGroups.GetEnumerator())
                        {
                            while (enumerator3.MoveNext())
                            {
                                UMHuntGroup umhuntGroup = enumerator3.Current;
                                if (umhuntGroup.UMDialPlan != null && !dictionary.ContainsKey(umhuntGroup.UMDialPlan.ObjectGuid))
                                {
                                    dictionary[umhuntGroup.UMDialPlan.ObjectGuid] = true;
                                    IConfigurationSession tenantOrTopologyConfigurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(this.DomainController, true, ConsistencyMode.FullyConsistent, ADSessionSettings.FromAllTenantsOrRootOrgAutoDetect(umhuntGroup.UMDialPlan), 189, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\um\\GetUMActiveCalls.cs");
                                    UMDialPlan            dialPlan2 = tenantOrTopologyConfigurationSession.Read <UMDialPlan>(umhuntGroup.UMDialPlan);
                                    if (Utility.DialPlanHasIncompatibleServers(dialPlan2, this.rootOrgConfigSession, dictionary))
                                    {
                                        this.WriteWarning(Strings.InvalidServerVersionInGateway(umipgateway.Name));
                                    }
                                }
                            }
                            goto IL_36F;
                        }
                    }
                    if (this.Server != null)
                    {
                        IEnumerable <Server> objects3 = this.Server.GetObjects <Server>(null, this.rootOrgConfigSession);
                        using (IEnumerator <Server> enumerator4 = objects3.GetEnumerator())
                        {
                            if (!enumerator4.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.NonExistantServer(this.Server.ToString())), ErrorCategory.InvalidData, this.Server);
                            }
                            this.adResults = enumerator4.Current;
                            if (enumerator4.MoveNext())
                            {
                                base.WriteError(new LocalizedException(Strings.MultipleServersWithSameId(this.Server.ToString())), ErrorCategory.InvalidData, this.Server);
                            }
                        }
                        Server target = (Server)this.adResults;
                        this.ValidateServerIsCompatible(target);
                    }
                    else if (this.InstanceServer != null)
                    {
                        Server target2 = (Server)this.InstanceServer.DataObject;
                        this.ValidateServerIsCompatible(target2);
                    }
                }
            }
IL_36F:
            TaskLogger.LogExit();
        }