Exemplo n.º 1
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            UMAutoAttendant umautoAttendant = (UMAutoAttendant)base.PrepareDataObject();

            umautoAttendant.SetId((IConfigurationSession)base.DataSession, base.Name);
            UMDialPlanIdParameter umdialPlan  = this.UMDialPlan;
            UMDialPlan            umdialPlan2 = (UMDialPlan)base.GetDataObject <UMDialPlan>(umdialPlan, this.GetDialPlanSession(), null, new LocalizedString?(Strings.NonExistantDialPlan(umdialPlan.ToString())), new LocalizedString?(Strings.MultipleDialplansWithSameId(umdialPlan.ToString())));

            umautoAttendant.SetDialPlan(umdialPlan2.Id);
            this.dialPlan = umdialPlan2;
            if (base.HasErrors)
            {
                return(null);
            }
            if (base.Fields.IsModified("DTMFFallbackAutoAttendant"))
            {
                UMAutoAttendantIdParameter dtmffallbackAutoAttendant = this.DTMFFallbackAutoAttendant;
                if (dtmffallbackAutoAttendant != null)
                {
                    this.fallbackAA = (UMAutoAttendant)base.GetDataObject <UMAutoAttendant>(dtmffallbackAutoAttendant, base.DataSession, null, new LocalizedString?(Strings.NonExistantAutoAttendant(dtmffallbackAutoAttendant.ToString())), new LocalizedString?(Strings.MultipleAutoAttendantsWithSameId(dtmffallbackAutoAttendant.ToString())));
                    umautoAttendant.DTMFFallbackAutoAttendant = this.fallbackAA.Id;
                }
                else
                {
                    umautoAttendant.DTMFFallbackAutoAttendant = null;
                }
            }
            TaskLogger.LogExit();
            return(umautoAttendant);
        }
Exemplo n.º 2
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            UMDialPlan umdialPlan = (UMDialPlan)base.PrepareDataObject();

            if (base.HasErrors)
            {
                return(null);
            }
            if (base.Fields.IsModified("ContactRecipientContainer") && base.Fields.IsModified("ContactAddressList"))
            {
                base.WriteError(new InvalidALParameterException(), ErrorCategory.NotSpecified, null);
                TaskLogger.LogExit();
                return(null);
            }
            if (base.Fields.IsModified("CountryOrRegionCode"))
            {
                if (string.IsNullOrEmpty(this.CountryOrRegionCode))
                {
                    base.WriteError(new InvalidParameterException(Strings.EmptyCountryOrRegionCode), ErrorCategory.InvalidArgument, null);
                }
                else
                {
                    umdialPlan.CountryOrRegionCode = this.CountryOrRegionCode;
                }
            }
            if (base.Fields.IsModified("ContactRecipientContainer"))
            {
                OrganizationalUnitIdParameter contactRecipientContainer = this.ContactRecipientContainer;
                if (contactRecipientContainer != null)
                {
                    bool useConfigNC = this.ConfigurationSession.UseConfigNC;
                    this.ConfigurationSession.UseConfigNC = false;
                    ADConfigurationObject adconfigurationObject = (ADConfigurationObject)base.GetDataObject <ExchangeOrganizationalUnit>(contactRecipientContainer, this.ConfigurationSession, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.ContactRecipientContainer.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.ContactRecipientContainer.ToString())));
                    this.ConfigurationSession.UseConfigNC = useConfigNC;
                    if (!base.HasErrors)
                    {
                        umdialPlan.ContactAddressList = adconfigurationObject.Id;
                    }
                }
                else
                {
                    umdialPlan.ContactAddressList = null;
                }
            }
            if (base.Fields.IsModified("ContactAddressList"))
            {
                AddressListIdParameter contactAddressList = this.ContactAddressList;
                if (contactAddressList != null)
                {
                    IEnumerable <AddressBookBase> objects = contactAddressList.GetObjects <AddressBookBase>(null, this.ConfigurationSession);
                    using (IEnumerator <AddressBookBase> enumerator = objects.GetEnumerator())
                    {
                        if (enumerator.MoveNext())
                        {
                            umdialPlan.ContactAddressList = (ADObjectId)enumerator.Current.Identity;
                        }
                        goto IL_19C;
                    }
                }
                umdialPlan.ContactAddressList = null;
            }
IL_19C:
            if (umdialPlan.ContactScope != CallSomeoneScopeEnum.AddressList)
            {
                umdialPlan.ContactAddressList = null;
            }
            if (base.Fields.IsModified("UMAutoAttendant"))
            {
                UMAutoAttendantIdParameter umautoAttendant = this.UMAutoAttendant;
                if (umautoAttendant != null)
                {
                    UMAutoAttendant umautoAttendant2 = (UMAutoAttendant)base.GetDataObject <UMAutoAttendant>(umautoAttendant, this.ConfigurationSession, null, new LocalizedString?(Strings.NonExistantAutoAttendant(umautoAttendant.ToString())), new LocalizedString?(Strings.MultipleAutoAttendantsWithSameId(umautoAttendant.ToString())));
                    if (!base.HasErrors)
                    {
                        umdialPlan.UMAutoAttendant = umautoAttendant2.Id;
                    }
                }
                else
                {
                    umdialPlan.UMAutoAttendant = null;
                }
            }
            TaskLogger.LogExit();
            return(umdialPlan);
        }