Пример #1
0
 public void EnqueueChangedAppointment(ChangedAppointment changedAppointment)
 {
     if (!changedAppointmentQueue.Any(x => x != null && x.OrganizerAddress == changedAppointment.OrganizerAddress))
     {
         changedAppointmentQueue.Enqueue(changedAppointment);
         logger.Info("Changed appointment added to its concurrent queue successfully");
     }
 }
Пример #2
0
        private void MyReceiveCompleted(Object source, ReceiveCompletedEventArgs asyncResult)
        {
            // Connect to the queue.
            mq = (MessageQueue)source;
            try
            {
                Message              msg = mq.EndReceive(asyncResult.AsyncResult);
                PendingBooking       pb  = null;
                UpdatedBooking       ub  = null;
                BlockBooking         bb  = null;
                ChangedAppointment   ca  = null;
                CancelledAppointment cancelledAppointment = null;
                string label = (string)msg.Label;
                logger.Info("label created fine"); //temp changes should be removed
                if (label == "pending")
                {
                    msg.Formatter = new XmlMessageFormatter(new Type[] { typeof(PendingBooking) });
                    logger.Info("pending formatter  created fine");//temp changes should be removed
                    pb = (PendingBooking)msg.Body;
                    logger.Info("#STPendingSAR# " + pb.MeetingKey + " " + DateTime.UtcNow.Ticks);
                    logger.Info("pendingbookin conversion  created fine");          //temp changes should be removed
                                                                                    // Display the message information on the screen.
                    logger.Info("pendingbooking meeting key" + pb.MeetingKey);      //temp changes should be removed
                    logger.Info("PendingBookingList Status " + PendingBookingList); //temp changes should be removed
                    logger.Info("#STPendingSAEN# " + pb.MeetingKey + " " + DateTime.UtcNow.Ticks);
                    EnqueuePendingBooking(pb);
                }
                else if (label == "update")
                {
                    msg.Formatter = new XmlMessageFormatter(new Type[] { typeof(UpdatedBooking) });
                    logger.Info("update formatter  created fine");  //temp changes should be removed
                    ub = (UpdatedBooking)msg.Body;
                    logger.Info("update conversion  created fine"); //temp changes should be removed
                                                                    // Display the message information on the screen.
                    EnqueueUpdatedMSSBooking(ub);
                }
                else if (label == "Create Appointment" || label == "Update Appointment")
                {
                    msg.Formatter = new XmlMessageFormatter(new Type[] { typeof(ChangedAppointment) });
                    logger.Info("Appointment formatter  created fine");  //temp changes should be removed
                    ca = (ChangedAppointment)msg.Body;
                    logger.Info("Appointment conversion  created fine"); //temp changes should be removed

                    EnqueueChangedAppointment(ca);
                }
                else if (label == "Delete Appointment")
                {
                    logger.Info("start reading deleted appointment");
                    msg.Formatter = new XmlMessageFormatter(new Type[] { typeof(CancelledAppointment) });
                    logger.Info("Appointment formatter  created fine");
                    cancelledAppointment = (CancelledAppointment)msg.Body;
                    logger.Info("Appointment conversion  created fine");

                    EnqueueCancelledAppointment(cancelledAppointment);
                }
                else if (label == "blockbooking")
                {
                    msg.Formatter = new XmlMessageFormatter(new Type[] { typeof(BlockBooking) });
                    logger.Info("Block booking formatter created successfully");
                    bb = (BlockBooking)msg.Body;
                    logger.Info("Block booking conversion was successful"); //temp log
                    EnqueueBlockBooking(bb);
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error in ReceiveComplete Event : Block Booking - Exception = " + ex.StackTrace + " " + ex.Message);
            }
            mq.BeginReceive();
        }