Exemplo n.º 1
0
        protected void ValidateCommonParamsAndSetOrg(UMDialPlanIdParameter dpParam, UMIPGatewayIdParameter gwParam, out Guid dpGuid, out Guid gwGuid, out string dpName, out string gwName)
        {
            dpGuid = Guid.Empty;
            gwGuid = Guid.Empty;
            dpName = string.Empty;
            gwName = string.Empty;
            if (dpParam == null && gwParam == null)
            {
                return;
            }
            IConfigurationSession session        = this.CreateSessionToResolveConfigObjects(false);
            OrganizationId        organizationId = null;

            if (dpParam != null)
            {
                UMDialPlan umdialPlan = (UMDialPlan)base.GetDataObject <UMDialPlan>(dpParam, session, null, new LocalizedString?(Strings.NonExistantDialPlan(dpParam.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(dpParam.ToString())));
                dpGuid         = umdialPlan.Guid;
                dpName         = umdialPlan.Name;
                organizationId = umdialPlan.OrganizationId;
            }
            if (gwParam != null)
            {
                UMIPGateway umipgateway = (UMIPGateway)base.GetDataObject <UMIPGateway>(gwParam, session, null, new LocalizedString?(Strings.NonExistantIPGateway(gwParam.ToString())), new LocalizedString?(Strings.MultipleIPGatewaysWithSameId(gwParam.ToString())));
                gwGuid = umipgateway.Guid;
                gwName = umipgateway.Name;
                if (organizationId != null && !organizationId.Equals(umipgateway.OrganizationId))
                {
                    base.WriteError(new InvalidParameterException(Strings.MismatchedOrgInDPAndGW(dpParam.ToString(), gwParam.ToString())), ErrorCategory.InvalidArgument, null);
                }
                else
                {
                    organizationId = umipgateway.OrganizationId;
                }
            }
            if (this.Organization != null)
            {
                organizationId != null;
            }
            if (organizationId != null)
            {
                base.CurrentOrganizationId = organizationId;
            }
        }
Exemplo n.º 2
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            UMHuntGroup           umhuntGroup = (UMHuntGroup)base.PrepareDataObject();
            IConfigurationSession session     = (IConfigurationSession)base.DataSession;
            UMDialPlanIdParameter umdialPlan  = this.UMDialPlan;
            UMDialPlan            umdialPlan2 = (UMDialPlan)base.GetDataObject <UMDialPlan>(umdialPlan, session, this.RootId, new LocalizedString?(Strings.NonExistantDialPlan(umdialPlan.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(umdialPlan.ToString())));

            umhuntGroup.UMDialPlan = umdialPlan2.Id;
            if (umdialPlan2.URIType == UMUriType.SipName && !VariantConfiguration.InvariantNoFlightingSnapshot.UM.HuntGroupCreationForSipDialplans.Enabled)
            {
                base.WriteError(new CannotCreateHuntGroupForHostedSipDialPlanException(), ErrorCategory.InvalidOperation, umhuntGroup);
            }
            UMIPGatewayIdParameter umipgateway  = this.UMIPGateway;
            UMIPGateway            umipgateway2 = (UMIPGateway)base.GetDataObject <UMIPGateway>(umipgateway, session, this.RootId, new LocalizedString?(Strings.NonExistantIPGateway(umipgateway.ToString())), new LocalizedString?(Strings.MultipleIPGatewaysWithSameId(umipgateway.ToString())));
            bool flag = false;

            foreach (UMHuntGroup umhuntGroup2 in umipgateway2.HuntGroups)
            {
                if (umhuntGroup2.PilotIdentifier == umhuntGroup.PilotIdentifier)
                {
                    flag = true;
                    break;
                }
            }
            if (flag)
            {
                HuntGroupAlreadyExistsException exception = new HuntGroupAlreadyExistsException(umipgateway2.Name, umhuntGroup.PilotIdentifier);
                base.WriteError(exception, ErrorCategory.InvalidArgument, null);
            }
            else
            {
                umhuntGroup.SetId(umipgateway2.Id.GetChildId(base.Name));
            }
            TaskLogger.LogExit();
            return(umhuntGroup);
        }