Пример #1
0
        public VoipPhone UpdateSettings(string numberId, string greeting, string holdUp, string wait, VoiceMail voiceMail, WorkingHours workingHours, bool? allowOutgoingCalls, bool? record, string alias)
        {
            if (!CRMSecurity.IsAdmin) throw CRMSecurity.CreateSecurityException();

            var dao = DaoFactory.GetVoipDao();
            var number = dao.GetNumber(numberId).NotFoundIfNull();

            number.Alias = Update.IfNotEmptyAndNotEquals(number.Alias, alias);
            number.Settings.GreetingAudio = Update.IfNotEmptyAndNotEquals(number.Settings.GreetingAudio, greeting);
            number.Settings.HoldAudio = Update.IfNotEmptyAndNotEquals(number.Settings.HoldAudio, holdUp);
            number.Settings.VoiceMail = Update.IfNotEmptyAndNotEquals(number.Settings.VoiceMail, voiceMail);
            number.Settings.WorkingHours = Update.IfNotEmptyAndNotEquals(number.Settings.WorkingHours, workingHours);

            if (!string.IsNullOrEmpty(wait))
            {
                number.Settings.Queue.WaitUrl = wait;
            }

            if (allowOutgoingCalls.HasValue)
            {
                number.Settings.AllowOutgoingCalls = allowOutgoingCalls.Value;
                if (!number.Settings.AllowOutgoingCalls)
                {
                    number.Settings.Operators.ForEach(r => r.AllowOutgoingCalls = false);
                }
            }

            if (record.HasValue)
            {
                number.Settings.Record = record.Value;
                if (!number.Settings.Record)
                {
                    number.Settings.Operators.ForEach(r => r.Record = false);
                }
            }

            dao.SaveOrUpdateNumber(number);

            return number;
        }
Пример #2
0
 protected bool Equals(WorkingHours other)
 {
     return Enabled.Equals(other.Enabled) && From.Equals(other.From) && To.Equals(other.To);
 }
Пример #3
0
 protected bool Equals(WorkingHours other)
 {
     return(Enabled.Equals(other.Enabled) && From.Equals(other.From) && To.Equals(other.To));
 }