public void CheckAvailibility(List <SeatDetails> seatDetails) { lock (_sycnRoot) { try { IStagecraftOrganizingCallbackService callbackChannel = OperationContext.Current.GetCallbackChannel <IStagecraftOrganizingCallbackService>(); if (!_callbackChannels.Contains(callbackChannel)) { _callbackChannels.Add(callbackChannel); } //this.RequestUpdatedSeatList(); for (Int32 i = _callbackChannels.Count - 1; i >= 0; i--) { if (((ICommunicationObject)_callbackChannels[i]).State != CommunicationState.Opened) { _callbackChannels.RemoveAt(i); continue; } try { _callbackChannels[i].NotifyToCheckAvailabiltyOfSeats(seatDetails); } catch (Exception ex) { _callbackChannels.RemoveAt(i); CustomExpMsg customMsg = new CustomExpMsg("Service threw exception while communicating on Callback Channel: " + _callbackChannels[i].GetHashCode()); throw new FaultException <CustomExpMsg>(customMsg, new FaultReason(customMsg.ErrorMsg), new FaultCode("Sender")); } } } catch (ApplicationException ex) { CustomExpMsg customMsg = new CustomExpMsg(ex.Message); throw new FaultException <CustomExpMsg>(customMsg, new FaultReason(customMsg.ErrorMsg), new FaultCode("Sender")); } } }
public void DeleteBookedSeat(Int32 userId, SeatDetails seatDetails) { lock (_sycnRoot) { try { IStagecraftOrganizingCallbackService callbackChannel = OperationContext.Current.GetCallbackChannel <IStagecraftOrganizingCallbackService>(); if (!_callbackChannels.Contains(callbackChannel)) { _callbackChannels.Add(callbackChannel); } for (Int32 i = _callbackChannels.Count - 1; i >= 0; i--) { if (((ICommunicationObject)_callbackChannels[i]).State != CommunicationState.Opened) { _callbackChannels.RemoveAt(i); continue; } try { _callbackChannels[i].SendBookedSeatDetailsToDelete(userId, seatDetails); } catch (Exception ex) { _callbackChannels.RemoveAt(i); CustomExpMsg customMsg = new CustomExpMsg("Service threw exception while communicating on Callback Channel: " + _callbackChannels[i].GetHashCode()); throw new FaultException <CustomExpMsg>(customMsg, new FaultReason(customMsg.ErrorMsg), new FaultCode("Sender")); } } } catch (ApplicationException ex) { CustomExpMsg customMsg = new CustomExpMsg(ex.Message); throw new FaultException <CustomExpMsg>(customMsg, new FaultReason(customMsg.ErrorMsg), new FaultCode("Sender")); } } }
public void Disconnect() { IStagecraftOrganizingCallbackService callbackChannel = OperationContext.Current.GetCallbackChannel <IStagecraftOrganizingCallbackService>(); try { lock (_sycnRoot) { if (_callbackChannels.Remove(callbackChannel)) { Console.WriteLine("Removed Callback Channel: {0}", callbackChannel.GetHashCode()); } } } catch (Exception ex) { CustomExpMsg customMsg = new CustomExpMsg(ex.Message); throw new FaultException <CustomExpMsg>(customMsg, new FaultReason(customMsg.ErrorMsg), new FaultCode("Sender")); } }
public void Connect() { try { IStagecraftOrganizingCallbackService callbackChannel = OperationContext.Current.GetCallbackChannel <IStagecraftOrganizingCallbackService>(); lock (_sycnRoot) { if (!_callbackChannels.Contains(callbackChannel)) { _callbackChannels.Add(callbackChannel); //Console.WriteLine("Added Callback Channel: {0}", callbackChannel.GetHashCode()); //callbackChannel.SendUpdatedSeatingList(_seatingList); } } } catch (Exception ex) { CustomExpMsg customMsg = new CustomExpMsg(ex.Message); throw new FaultException <CustomExpMsg>(customMsg, new FaultReason(customMsg.ErrorMsg), new FaultCode("Sender")); } }