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 void UpdateTimedRoute(string context, string originalName, string name, string condition, bool performOnFail, sCallTime start, sCallTime?end, string audioFile) { lock (_lock) { Hashtable ht = StoredConfiguration; ArrayList cont = new ArrayList(); if (ht.ContainsKey(context)) { cont = (ArrayList)ht[context]; ht.Remove(context); } for (int x = 0; x < cont.Count; x++) { Hashtable ext = (Hashtable)cont[x]; if (ext[_NAME_FIELD_ID].ToString() == originalName) { cont.RemoveAt(x); break; } } ht.Add(context, cont); 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.PlayFile); pln.Add(_AUDIO_FILE_FIELD_ID, audioFile); cont.Add(pln); ht.Add(context, cont); StoredConfiguration = ht; } }