public void AddTimedRoute(string context, string name, string condition, bool performOnFail, sCallTime start, sCallTime?end, sDomainExtensionPair extensionNumber) { lock (_lock) { Hashtable ht = StoredConfiguration; ArrayList cont = new ArrayList(); if (ht.ContainsKey(context)) { cont = (ArrayList)ht[context]; ht.Remove(context); } Hashtable pln = new Hashtable(); pln.Add(_NAME_FIELD_ID, name); pln.Add(_CONDITION_FIELD_ID, condition); pln.Add(_PERFORM_ON_FAIL_FIElD_ID, performOnFail); pln.Add(_START_FIELD_ID, start.ToString()); if (end.HasValue) { pln.Add(_END_FIELD_ID, end.Value.ToString()); } pln.Add(_TYPE_FIELD_ID, VacationRouteRedirectTypes.PhoneExtension); pln.Add(_EXTENSION_FIELD_ID, extensionNumber.ToString()); cont.Add(pln); ht.Add(context, cont); StoredConfiguration = ht; } }
public new bool Update() { bool ret = true; try { base.Update(); sDomainExtensionPair[] extensions = new sDomainExtensionPair[Extensions.Length]; for (int x = 0; x < Extensions.Length; x++) { extensions[x] = new sDomainExtensionPair(Extensions[x].Number, Extensions[x].Domain.Name); } ConfigurationController.RegisterChangeCall( typeof(HuntGroupPlan), new ADialPlan.sUpdateConfigurationsCall( "UpdateHuntGroup", new NameValuePair[] { new NameValuePair("context", Context.Name), new NameValuePair("extension", OriginalNumber), new NameValuePair("newExtension", Number), new NameValuePair("sequential", RingSequential), new NameValuePair("extensions", extensions) } ), new IEvent[] { new GenericEvent("HuntGroupUpdated", new NameValuePair[] { new NameValuePair("Context", Context.Name), new NameValuePair("Number", OriginalNumber), new NameValuePair("NewNumber", Number) }) } ); } catch (Exception e) { Log.Error(e); EventController.TriggerEvent(new ErrorOccuredEvent(e)); ret = false; } return(ret); }
public new bool Update() { bool ret = true; try { base.Update(); sDomainExtensionPair[] extensions = new sDomainExtensionPair[Extensions.Length]; for (int x = 0; x < Extensions.Length; x++) { extensions[x] = new sDomainExtensionPair(Extensions[x].Number, Extensions[x].Domain.Name); } ConfigurationController.RegisterChangeCall( typeof(IntercomPlan), new ADialPlan.sUpdateConfigurationsCall( "UpdateIntercom", new NameValuePair[] { new NameValuePair("context", Context.Name), new NameValuePair("intercomExtension", OriginalNumber), new NameValuePair("newIntercomExtension", Number), new NameValuePair("oneWay", OneWay), new NameValuePair("extensions", extensions) } ), new IEvent[] { new GenericEvent("IntercomUpdated", new NameValuePair[] { new NameValuePair("Number", Number), new NameValuePair("DomainName", Domain.Current.Name) }) } ); } catch (Exception e) { Log.Error(e); EventController.TriggerEvent(new ErrorOccuredEvent(e)); ret = false; } return(ret); }
protected void UpdateVacationRoute(string context, string extension, DateTime originalStartDate, DateTime startDate, DateTime endDate, bool endWithVoicemail, sDomainExtensionPair bridgeExtension) { lock (_lock) { Hashtable ht = StoredConfiguration; ArrayList cont = new ArrayList(); if (ht.ContainsKey(context)) { cont = (ArrayList)ht[context]; ht.Remove(context); } Hashtable vcr; for (int x = 0; x < cont.Count; x++) { vcr = (Hashtable)cont[x]; if (((string)vcr[_OWNING_EXTENSION_FIELD_ID] == extension) && (((DateTime)vcr[_OWNING_EXTENSION_FIELD_ID]).Ticks == originalStartDate.Ticks)) { cont.RemoveAt(x); break; } } vcr = new Hashtable(); vcr.Add(_OWNING_EXTENSION_FIELD_ID, extension); vcr.Add(_START_DATE_FIELD_ID, startDate); vcr.Add(_END_DATE_FIELD_ID, endDate); vcr.Add(_END_WITH_VM_FIELD_ID, endWithVoicemail); vcr.Add(_TYPE_FIELD_ID, VacationRouteRedirectTypes.PhoneExtension); vcr.Add(_BRIDGE_EXTENSION_FIELD_ID, extension); ht.Add(context, cont); StoredConfiguration = ht; } }
protected void AddVacationRoute(string context, string extension, DateTime startDate, DateTime endDate, bool endWithVoicemail, sDomainExtensionPair bridgeExtension) { lock (_lock) { Hashtable ht = StoredConfiguration; ArrayList cont = new ArrayList(); if (ht.ContainsKey(context)) { cont = (ArrayList)ht[context]; ht.Remove(context); } Hashtable vcr = new Hashtable(); vcr.Add(_OWNING_EXTENSION_FIELD_ID, extension); vcr.Add(_START_DATE_FIELD_ID, startDate); vcr.Add(_END_DATE_FIELD_ID, endDate); vcr.Add(_END_WITH_VM_FIELD_ID, endWithVoicemail); vcr.Add(_TYPE_FIELD_ID, VacationRouteRedirectTypes.PhoneExtension); vcr.Add(_BRIDGE_EXTENSION_FIELD_ID, extension); ht.Add(context, cont); StoredConfiguration = ht; } }