/// <summary> /// Adds the notification endpoint. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="port">The port.</param> public void AddNotificationEndpoint(string endpoint, int port) { lock (lockEndpoints) { //is the notification endpoint exists if (lstNotificationEndpoints.Any(ne => ne.Endpoint.Equals(endpoint) && ne.Port.Equals(port))) { //update the exisiting notification endpoint var elem = lstNotificationEndpoints.First(ne => ne.Endpoint.Equals(endpoint) && ne.Port.Equals(port)); elem.FailedSendOperations = 0; elem.DateReceived = DateTime.Now; } else { //endpoint doesnt exist - add a new endpoint lstNotificationEndpoints.Add(new NotificationEndpoint { FailedSendOperations = 0, DateReceived = DateTime.Now, Endpoint = endpoint, Port = port }); } //Check for clean up notification enpoints CleanUpNotificationEndpoints(); //Save Notification endpoints notificationDataServiceObj.SaveNotificationEndpoints(lstNotificationEndpoints); } }