private void OnMQReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) { try { if (_cts.IsCancellationRequested) { return; } System.Messaging.Message mqMsg = null; TEvnt data = default(TEvnt); var mq = (sender as System.Messaging.MessageQueue); mqMsg = mq.EndReceive(e.AsyncResult); data = (TEvnt)mqMsg.Body; this.OnEventReceived(data); if (_cts.IsCancellationRequested) { return; } mq.BeginReceive(); } catch (Exception ex) { this.Logger.Error(string.Format("Error during {0}.Subscribe(), in ReceiveCompleted Handler", this.GetType().Name), ex); } }
public object Read(System.Messaging.Message message) { if (message == null) { throw new ArgumentNullException("message"); } if (message.BodyType != bodyType) { throw new InvalidOperationException("InvalidTypeDeserialization"); } Stream bodyStream = message.BodyStream; string msg = string.Empty; using (StreamReader reader = new StreamReader(bodyStream)) { msg = reader.ReadToEnd(); } if (message.BodyStream.CanSeek) { message.BodyStream.Position = 0L; } return(Newtonsoft.Json.JsonConvert.DeserializeObject(msg, _settings)); }
public void Dequeue(ref T t) { t = default(T); #if !__USE_MSMQ System.Threading.Monitor.Enter(_lockobj); #endif if (this.Count > 0) { Logger.NLogger.Info("Receiving type {0}", typeof(T).Name); #if __USE_MSMQ System.Messaging.Message mes = null; try { mes = this.MessageQueue.Receive(new TimeSpan(0, 0, 3)); t = (T)mes.Body; } catch (Exception ex) { Logger.NLogger.ErrorException(string.Empty, ex); } finally { } #else t = (T)base.Dequeue(); #endif } #if !__USE_MSMQ System.Threading.Monitor.Exit(_lockobj); #endif }
public void messageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) { manualResetEvent.Reset(); System.Messaging.Message completeMessage = null; System.IO.FileStream fileStream = null; System.IO.StreamWriter streamWriter = null; string fileName = null; byte[] bytes = new byte[2500000]; string xmlstr = string.Empty; try { // Receive the message completeMessage = this.messageQueue.EndReceive(e.AsyncResult); completeMessage.BodyStream.Read(bytes, 0, bytes.Length); System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding(); long len = completeMessage.BodyStream.Length; int intlen = Convert.ToInt32(len); xmlstr = ascii.GetString(bytes, 0, intlen); } catch (Exception ex0) { //Error converting message to string } }
/// <summary> /// Convert TMessage. /// Input: TMessage Out: System Message /// </summary> /// <param name="TMessage">kubemq Message</param> /// <returns>System.Messaging.Message</returns> public static System.Messaging.Message ConvertToSystemMessage(KubeMQ.MSMQSDK.Messages.Message Tmessage) { string FormatterType = string.Empty; System.Messaging.Message InnerMessage = new System.Messaging.Message(Tmessage.Body); InnerMessage.Label = Tmessage.Label ?? string.Empty; InnerMessage.BodyType = Tmessage.BodyType; if (Tmessage.Formatter != null) { MicrosoftFormatter microsoftFormatter = Tmessage.Formatter as MicrosoftFormatter; if (microsoftFormatter != null) { FormatterType = microsoftFormatter.FormatterName ?? string.Empty; } } switch (FormatterType) { case "ActiveXMessageFormatter": InnerMessage.Formatter = new System.Messaging.ActiveXMessageFormatter(); break; case "BinaryMessageFormatter": InnerMessage.Formatter = new System.Messaging.BinaryMessageFormatter(); break; default: InnerMessage.Formatter = new System.Messaging.XmlMessageFormatter(); break; } return(InnerMessage); }
public void Msmq_Receive() { var msmq = DistributedApplication.ClusterChannel as MsmqChannelProvider; // init: purge queues msmq._receiveQueue.Purge(); for (var i = 0; i < msmq._sendQueues.Count; i++) { var sendqueue = msmq._sendQueues[i]; sendqueue.Purge(); } // send a single message to the receive queue and check if it gets received and executed var message = new TestAction(); var clusterMemberInfo = new ClusterMemberInfo(); clusterMemberInfo.InstanceID = Guid.NewGuid().ToString(); // ensures message percieved as coming from other source message.SenderInfo = clusterMemberInfo; Stream messageStream = new BinaryMessageFormatter().Serialize(message); var m = new System.Messaging.Message(messageStream); m.TimeToBeReceived = TimeSpan.FromSeconds(RepositoryConfiguration.MessageRetentionTime); m.Formatter = new System.Messaging.BinaryMessageFormatter(); _messageReceivedEvent = new AutoResetEvent(false); msmq._receiveQueue.Send(m); // send message to receivequeue // test for execution: _messageReceived should be set to true var received = _messageReceivedEvent.WaitOne(3000); Assert.IsTrue(received, "Distributed action was not received/executed within 3 seconds"); }
public static void Write(Log log) { switch (ConfigurationManager.AppSettings["Logging.Destination"].ToLower()) { case Logger.DATABASE_LOGSINK: log.Save(); break; case Logger.MSMQ_LOGSINK: string destinationQ = ConfigurationManager.AppSettings["Logging.MSMQ.Queue.Path"]; // publish the request to the appropriate message queue System.Messaging.MessageQueue mq = new System.Messaging.MessageQueue(destinationQ); System.Messaging.Message msg = new System.Messaging.Message(); msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(Log) }); msg.Body = log; msg.Priority = System.Messaging.MessagePriority.Normal; msg.Recoverable = true; msg.Label = log.LogType.GetType().Name; mq.Send(msg); break; default: log.Save(); break; } }
public static void Write(Log log) { switch (Foundation.Common.Util.ConfigUtil.GetAppSetting("Logging.Destination").ToLower()) { case Logger.DATABASE_LOGSINK: LoggingService.Save(log); break; case Logger.MSMQ_LOGSINK: string destinationQ = Foundation.Common.Util.ConfigUtil.GetAppSetting("Logging.MSMQ.Queue.Path"); // publish the request to the appropriate message queue System.Messaging.MessageQueue mq = new System.Messaging.MessageQueue(destinationQ); System.Messaging.Message msg = new System.Messaging.Message(); msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(blogEngine.Shared.Logging.Log) }); msg.Body = log; msg.Priority = System.Messaging.MessagePriority.Normal; msg.Recoverable = true; msg.Label = log.LogType.GetType().Name; mq.Send(msg); break; default: LoggingService.Save(log); break; } }
/// <summary> /// Attempt to resend events stored in a Message Queue /// </summary> private void ResendRequests() { if (offlineModeEnabled) { var allSent = false; var messageEnumerator = backupEmitter.Queue.GetMessageEnumerator2(); // Stop removing messages when there are none left to remove // or the buffer is full (as the buffer will then be flushed, // causing another call to ResendRequests) while (!allSent && (buffer.Count < bufferSize)) { allSent = true; // The call to RemoveCurrent halts the MessageEnumerator2, // so this loop only removes a single message while (messageEnumerator.MoveNext()) { allSent = false; System.Messaging.Message evt = messageEnumerator.RemoveCurrent(); Input(jss.Deserialize <Dictionary <string, string> >(evt.Body.ToString())); } } } }
public IMessage CreateMessage() { var result = new System.Messaging.Message(); result.Priority = System.Messaging.MessagePriority.Normal; result.Recoverable = true; return new MSMQMessageWrapper(result); }
public void messageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) { manualResetEvent.Reset(); System.Messaging.Message completeMessage = null; System.IO.FileStream fileStream = null; System.IO.StreamWriter streamWriter = null; string fileName = null;
private DistributedLuceneActivity.LuceneActivityDistributor CheckLucMessage(System.Messaging.Message recvmessage) { var formatter = new BinaryMessageFormatter(); var lucmessage = formatter.Deserialize(recvmessage.Body as Stream) as DistributedLuceneActivity.LuceneActivityDistributor; var recactivity = lucmessage.Activity as TestLuceneActivity; Assert.IsTrue(recactivity != null, "Received message differs from message that was sent."); // check if we received the message that we have sent return(lucmessage); }
public static MessageInfo DeserializeExtension(this MSMQMessage message) { var bf = new BinaryFormatter(); var ms = new MemoryStream(message.Extension); var extension = (MessageInfo)bf.Deserialize(ms); return(extension); }
public MessageQueueMessage(System.Messaging.Message message, MessageDirectionEnum direction) { this.m_Message = message; this.m_MessageBody = (MessageBody)message.Body; this.m_Label = message.Label; this.m_Direction = direction; this.m_MessageDate = DateTime.Now; }
public MessageQueueMessage(System.Messaging.Message message, MessageDirectionEnum direction) { this.m_Message = message; this.m_MessageBody = (MessageBody)message.Body; this.m_Label = message.Label; this.m_Direction = direction; this.m_MessageDate = DateTime.Now; }
private void sendMessage_Click(object sender, EventArgs e) { System.Messaging.Message theMessage = new System.Messaging.Message(txtMessage.Text); theMessage.Label = txtName.Text; if (highPriority.Checked) theMessage.Priority = System.Messaging.MessagePriority.Highest; else theMessage.Priority = System.Messaging.MessagePriority.Normal; helpRequestQueue.Send(theMessage); DisplayMessages(); }
public void SetProperties() { messageMock.Expect("set_AcknowledgeType", AcknowledgeTypes.FullReachQueue); SystemMessage m = TestUtils.CreateMessage(iMessage); m.AcknowledgeType = SystemAcknowledgeTypes.FullReachQueue; messageMock.Verify(); }
/// <summary> /// Convert SystemMessage. /// Input: SystemMessage Out: TMessage /// </summary> /// <param name="systemMessage"></param> /// <returns></returns> public static KubeMQ.MSMQSDK.Messages.Message ConvertFromSystemMessage(System.Messaging.Message systemMessage) { KubeMQ.MSMQSDK.Messages.Message TMessage = new KubeMQ.MSMQSDK.Messages.Message(); byte[] myBinary = new byte[systemMessage.BodyStream.Length]; systemMessage.BodyStream.Read(myBinary, 0, (int)systemMessage.BodyStream.Length); TMessage.BodyStream = myBinary; // TMessage.Body = systemMessage.Body ?? string.Empty; TMessage.Label = systemMessage.Label ?? string.Empty; TMessage.Formatter = SetFormatter(systemMessage.Formatter != null ? systemMessage.Formatter.ToString() : "XmlMessageFormatter"); TMessage.Id = systemMessage.Id ?? "0"; return(TMessage); }
public System.Messaging.Message Receive(TimeSpan timeout) { BasicDeliverEventArgs rbMsg = null; if (consumer.Queue.Dequeue((int)timeout.TotalMilliseconds, out rbMsg)) { var memStr = new MemoryStream(rbMsg.Body); var msg = new System.Messaging.Message(new BinaryFormatter().Deserialize(memStr)); return(msg); } return(null); }
private void OrderReceived(object sender, System.Messaging.ReceiveCompletedEventArgs e) { System.Messaging.XmlMessageFormatter formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(WorkOrder) }); System.Messaging.Message msg = messageQueueVehiclesToAssemble.EndReceive(e.AsyncResult); msg.Formatter = formatter; WorkOrder workOrder = msg.Body as WorkOrder; // start waiting for the next message messageQueueVehiclesToAssemble.BeginReceive(); FireMessage(workOrder); }
// Provides an event handler for the ReceiveCompleted event. private void MessageReceived(Object source, ReceiveCompletedEventArgs asyncResult) { if (!this.formIsClosed) { // End the asynchronous receive operation. System.Messaging.Message msg = messageQueue.EndReceive(asyncResult.AsyncResult); // Display the message information on the screen. listBoxControl1.Items.Add(msg.Body.ToString()); counter++; labelControl1.Text = String.Format("Total messages received {0}", counter.ToString()); // Start receiving the next message messageQueue.BeginReceive(TimeSpan.FromSeconds(15)); } }
private void LockReleaseRequestMessageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) { System.Messaging.Message receivedMessage = this.m_LockReleaseRequestQueue.EndReceive(e.AsyncResult); MessageQueueMessage receviedMessageQueueMessage = new MessageQueueMessage(receivedMessage, MessageDirectionEnum.Received); this.m_MessageCollection.Add(receviedMessageQueueMessage); this.m_LockReleaseRequestQueue.BeginReceive(); if (RequestReceived != null) { this.RequestReceived(this, new UI.CustomEventArgs.MessageReturnEventArgs(receivedMessage)); } }
public bool CanRead(System.Messaging.Message message) { if (message == null) { throw new ArgumentNullException("message"); } if (message.BodyType != bodyType) { return(false); } return(true); }
public void SendLockReleaseRequest(Business.Test.AccessionOrder accessionOrder) { LockReleaseRequestMessageBody messageBody = new LockReleaseRequestMessageBody(accessionOrder.MasterAccessionNo, accessionOrder.LockAquiredByUserName, accessionOrder.LockAquiredByHostName, accessionOrder.TimeLockAquired.Value); System.Messaging.Message message = new System.Messaging.Message(messageBody); message.ResponseQueue = new System.Messaging.MessageQueue(Environment.MachineName + "\\" + LockReleaseResponseQueueName); System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(messageBody.LockAquiredByHostName + "\\" + LockReleaseRequestQueueName); queue.Send(message); MessageQueueMessage messageQueueMessage = new MessageQueueMessage(message, MessageDirectionEnum.Sent); this.m_MessageCollection.Insert(0, messageQueueMessage); }
public void StartRequestReceived(System.Messaging.Message message) { if (this.m_DialogIsActive == false) { MessagingDialog messagingDialog = new MessagingDialog(); this.m_PageNavigator = messagingDialog.PageNavigator; messagingDialog.Closed += MessagingDialog_Closed; AppMessaging.LockRequestReceivedPage lockRequestReceivedPage = new AppMessaging.LockRequestReceivedPage(message); messagingDialog.PageNavigator.Navigate(lockRequestReceivedPage); messagingDialog.Show(); this.m_DialogIsActive = true; } }
/// <summary> /// Finds a list item which holds a message. /// </summary> /// <param name="message">Message to search for.</param> /// <returns>Message which contains the message if found, else null</returns> private MessageListViewItem FindListItem(System.Messaging.Message message) { MessageListViewItem result = null; foreach (ListViewItem item in messagesListView.Items) { MessageListViewItem messageItem = item as MessageListViewItem; if (messageItem != null && messageItem.Message == message) { result = messageItem; break; } } return(result); }
public LockRequestReceivedPage(System.Messaging.Message message) { this.m_Message = message; MessageBody messageBody = (MessageBody)message.Body; this.m_LockAquiredByUserName = messageBody.LockAquiredByUserName; this.m_LockAquiredByHostName = messageBody.LockAquiredByHostName; this.m_MasterAccessionNo = messageBody.MasterAccessionNo; this.m_TimeLockAquired = messageBody.TimeLockAquired; InitializeComponent(); DataContext = this; AppMessaging.MessageQueues.Instance.ResponseReceived += Instance_ResponseReceived; this.StartCountDownTimer(); }
public T Dequeue() { T body = default(T); System.Messaging.Message mes = null; try { mes = this.MessageQueue.Receive(new TimeSpan(0, 0, 3)); body = (T)mes.Body; } finally { } return(body); }
public LockRequestReceivedPage(System.Messaging.Message message) { this.m_Message = message; MessageBody messageBody = (MessageBody)message.Body; this.m_LockAquiredByUserName = messageBody.LockAquiredByUserName; this.m_LockAquiredByHostName = messageBody.LockAquiredByHostName; this.m_MasterAccessionNo = messageBody.MasterAccessionNo; this.m_TimeLockAquired = messageBody.TimeLockAquired; InitializeComponent(); DataContext = this; AppMessaging.MessageQueues.Instance.ResponseReceived += Instance_ResponseReceived; this.StartCountDownTimer(); }
/// <summary> /// Sends a message to the specified message queue. /// </summary> /// <param name="queue">The message queue.</param> /// <param name="payload">The message payload to send.</param> public static System.Messaging.Message SendMessage <T>(this MessageQueue queue, T payload) { var message = new Message <T>(Guid.NewGuid(), HeaderCollection.Empty, payload); var serializer = new BinarySerializer(); using (var msmqMessage = new System.Messaging.Message()) using (var memoryStream = new MemoryStream()) { serializer.Serialize(memoryStream, message, message.GetType()); msmqMessage.BodyStream = memoryStream; msmqMessage.Recoverable = true; queue.Send(msmqMessage); return(queue.PeekById(msmqMessage.Id)); } }
static void Main(string[] args) { try { System.Messaging.MessageQueue Queue; Queue = new System.Messaging.MessageQueue(@"FormatName:DIRECT=TCP:172.26.230.2\ptest1"); System.Messaging.Message Msg; Msg = new System.Messaging.Message(); Msg.Formatter = new System.Messaging.BinaryMessageFormatter(); Msg.Body = "Testing 3 times"; Queue.Send(Msg); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private void messagesListView_MouseMove(object sender, MouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) { // If the mouse moves outside the rectangle, start the drag. if (_dragBoxFromMouseDown != Rectangle.Empty && !_dragBoxFromMouseDown.Contains(e.X, e.Y)) { System.Messaging.Message[] messages = new System.Messaging.Message[messagesListView.SelectedItems.Count]; for (int i = 0; i < messagesListView.SelectedItems.Count; i++) { messages[i] = ((MessageListViewItem)messagesListView.SelectedItems[i]).Message; } MessageDragContainer messageDragContainer = new MessageDragContainer(_qSetQueueItem, messages); messagesListView.DoDragDrop(messageDragContainer, DragDropEffects.Move); } } }
static void Main(string[] args) { try { System.Messaging.MessageQueue Queue; Queue = new System.Messaging.MessageQueue(@"FormatName:DIRECT=TCP:172.26.230.2\ptest1"); System.Messaging.Message Msg; Msg = new System.Messaging.Message(); Msg.Formatter = new System.Messaging.BinaryMessageFormatter(); Msg.Body = "Testing 3 times"; Queue.Send(Msg); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public void WillMoveMessageToPoisonQueueIfUnableToDeserializeMessage() { var message = new System.Messaging.Message("Invalid Message") { Recoverable = true }; testQueue.Send(message); using (new MessageReceiver <String>(TestMessageQueue.Path, new BinarySerializer(), messageProcessor)) { testQueue.SendMessage("Valid Message"); messageProcessor.ProcessMessages(count: 1); } using (var poisonQueue = TestMessageQueue.Create("poison")) Assert.NotNull(poisonQueue.PeekById(message.Id)); }
private void TestIndexDocumentSending(DistributedLuceneActivity sendmsg) { // purge queues var msmq = DistributedApplication.ClusterChannel as MsmqChannelProvider; msmq._receiveQueue.Purge(); for (var i = 0; i < msmq._sendQueues.Count; i++) { var sendqueue = msmq._sendQueues[i]; sendqueue.Purge(); } // distribute message sendmsg.Distribute(); // grab message from send queue System.Messaging.Message recvmessage = null; try { recvmessage = msmq._sendQueues[0].Receive(TimeSpan.FromSeconds(3)); } catch (System.Messaging.MessageQueueException mex) { if (mex.MessageQueueErrorCode == System.Messaging.MessageQueueErrorCode.IOTimeout) { Assert.Fail("Receiving test message from remote queue timed out."); } } // check if message received is the one we have sent var lucmessage = CheckLucMessage(recvmessage); // simulate receiving/processing by calling OnMessageReceived _activityProcessedEvent = new AutoResetEvent(false); var remotedMessageStream = HackMessageAsRemote(lucmessage); msmq.OnMessageReceived(remotedMessageStream); // wait for message to be processed var processed = _activityProcessedEvent.WaitOne(3000); Assert.IsTrue(processed, "Lucene activity was not processed within 3 seconds"); }
private void LockReleaseResponseMessageQueue_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e) { System.Messaging.Message message = this.m_LockReleaseResponseQueue.EndReceive(e.AsyncResult); MessageBody messageBody = (MessageBody)message.Body; MessageQueueMessage messageQueueMessage = new MessageQueueMessage(message, MessageDirectionEnum.Received); this.m_MessageCollection.Add(messageQueueMessage); this.m_LockReleaseResponseQueue.BeginReceive(); if (this.AquireLock != null) { this.AquireLock(messageBody.MasterAccessionNo, new EventArgs()); } if (ResponseReceived != null) { this.ResponseReceived(this, new UI.CustomEventArgs.MessageReturnEventArgs(message)); } }
public bool EnviarMensaje(Eventos evt, string xmlParams) { bool retVal = false; System.Messaging.Message msg = new System.Messaging.Message(); msg.Body = new objMensaje(evt, xmlParams); try { msgQueue.Send(msg); retVal = true; } catch (Exception ex) { Console.WriteLine(ex.Message + " " + ex.InnerException.Message); } return(retVal); }
private void messagesListView_MouseMove(object sender, MouseEventArgs e) { if ((e.Button & MouseButtons.Left) == MouseButtons.Left) { // If the mouse moves outside the rectangle, start the drag. if (_dragBoxFromMouseDown != Rectangle.Empty && !_dragBoxFromMouseDown.Contains(e.X, e.Y)) { System.Messaging.Message[] messages = new System.Messaging.Message[messagesListView.SelectedItems.Count]; for (int i = 0; i < messagesListView.SelectedItems.Count; i ++) { messages[i] = ((MessageListViewItem)messagesListView.SelectedItems[i]).Message; } MessageDragContainer messageDragContainer = new MessageDragContainer(_qSetQueueItem, messages); messagesListView.DoDragDrop(messageDragContainer, DragDropEffects.Move); } } }
private void button10_Click(object sender, EventArgs e) { try { if (checkBox1.Checked) { System.IO.File.Delete("LDM.txt"); System.IO.File.Copy(@"\\192.168.1.173\exported\LDM.txt", "LDM.txt"); } } catch (Exception) { throw; } Broker b = new Broker(); String CsOG = ""; buginLDM = b.FillListBoxLDM(b.LoadOccupation("LDM")); listBox1.DataSource = null; foreach (var item in buginLDM) { listBox1.Items.Add("LDM " + item.FlightIdentifier); //comboBox1.DataSource = b.Updater(item, item, 1); XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; if (item.MessageIdentifier == "Departure") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDayOfDepartureDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", item.PassengerAdults, new XAttribute("propertyName", "local_vzr_econom")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "local_rb_econom")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Departure")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Departure")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "local_vb_econom")) ) ) ) ); } else if (item.MessageIdentifier == "Arrival") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", item.PassengerAdults, new XAttribute("propertyName", "sop adults arrival")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "sop_arr_child")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Arrival")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Arrival")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "weight+lug_arr")) ) ) ) ); } string queuePath = textBox3.Text; messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; //messageQueue1.Send(testMgs); comboBox2.Items.Add(root.ToString()); listBox2.Items.Add(root.ToString()); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update LDM Flight: " + CsOG); b.CloseReader(); toolStripStatusLabel1.Text = "Last Update LDM Arrivals " + DateTime.Now.ToString(); }
private void button8_Click(object sender, EventArgs e) { try { if (checkBox1.Checked) { // FTPClient ftp = new FTPClient("192.168.2.213", "sitatex", "asd123"); // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "MVT.txt"); //System.IO.File.Delete("MVT.txt"); //System.IO.File.Copy(@"\\192.168.1.173\exported\MVT.txt", "MVT.txt"); } } catch (Exception) { throw; } Broker b = new Broker(); String CsOG = ""; buginDeparture = b.FillListBox(b.LoadOccupation("MVT")); listBox1.DataSource = null; foreach (var item in buginDeparture) { listBox1.Items.Add(item.FlightNumber); //comboBox1.DataSource = b.Updater(item, item, 1); XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", "Arrival"), new XElement(ad + "AirlineDesignator", item.FlightNumber.Substring(0,2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightNumber.Substring(2,item.FlightNumber.Length - 2 )), new XElement(ad + "ScheduledDate", b.FilterDate(Convert.ToDateTime(item.EstimatedTimeOfArrival), "start").ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", Convert.ToDateTime(item.EstimatedTimeOfArrival).ToString(), new XAttribute("propertyName", "arrival_estimated")), new XElement(am + "Update", b.FilterDate(Convert.ToDateTime(item.AirborneTime), "time").ToString("HHmm"), new XAttribute("propertyName", "R1_ATD")) ) ) ) ); string queuePath = textBox3.Text; messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; messageQueue1.Send(testMgs); comboBox2.Items.Add(root.ToString()); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update Flight MVT: " + CsOG); b.CloseReader(); toolStripStatusLabel2.Text = "Last Update MVT Arrivals " + DateTime.Now.ToString(); }
private void syncFFM() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("FFM.txt", AppDomain.CurrentDomain.BaseDirectory + "FFM.txt"); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<FFM> buginFFM = new List<FFM>(); Broker b = new Broker(); String CsOG = ""; buginFFM = b.FillListBoxFFM(b.LoadOccupation("FFM")); foreach (var item in buginFFM) { //comboBox1.DataSource = b.Updater(item, item, 1); XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; if (item.MessageIdentifier == "Departure") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDayOfDepartureDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", item.Pieces, new XAttribute("propertyName", "sogp_cargo_count_departure")), new XElement(am + "Update", Math.Round(Convert.ToDouble(item.Weight)), new XAttribute("propertyName", "SOP Cargo Weight Departure")) ) ) ) ); } else if (item.MessageIdentifier == "Arrival") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", new XElement(am + "Update", item.Pieces, new XAttribute("propertyName", "sogp_cargo_count_arrival")), new XElement(am + "Update", Math.Round(Convert.ToDouble(item.Weight)), new XAttribute("propertyName", "SOP Cargo Weight Arrival")), new XElement(am + "TableValueUpdate", new XAttribute("propertyName", "AA_AWB1")) ) ) ) ); for (int i = 1; i < item.FieldArray + 1; i++) { XElement track = new XElement(ad + "Row", new XElement(ad + "Value", item.PiecesArr[i], new XAttribute("propertyName", "Oryn")), new XElement(ad + "Value", item.WeightArr[i], new XAttribute("propertyName", "Weight")), new XElement(ad + "Value", item.AirlineAWBIdentificationArr[i] + "-" + item.AwbSerialNumberArr[i], new XAttribute("propertyName", "AWB_Numbers")), new XElement(ad + "Value", item.VolumeCodeArr[i], new XAttribute("propertyName", "Measument_TYPE")), new XElement(ad + "Value", item.VolumeArr[i], new XAttribute("propertyName", "Mea_Values")), new XElement(ad + "Value", item.AwbOriginArr[i], new XAttribute("propertyName", "Origin_IATA")), new XElement(ad + "Value", item.AwbDestinationArr[i], new XAttribute("propertyName", "Destination_IATA")), new XElement(ad + "Value", item.ShipmentDescriptionCodeArr[i], new XAttribute("propertyName", "AWB Types")), new XElement(ad + "Value", item.GoodsArr[i], new XAttribute("propertyName", "Remarks")) ); root.Element(am + "Content").Element(am + "FlightUpdateRequest").Element(am + "FlightUpdates").Element(am + "TableValueUpdate").Add(track); } } messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update FFM Flight: " + CsOG); b.CloseReader(); this.timerKezegi = "PTM"; }
public MessageListViewItem (System.Messaging.Message message) { _message = message; }
public MessageListViewItem (System.Messaging.Message message, string text) : base(text) { _message = message; }
private void syncLDM() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt"); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<LDM> buginLDM = new List<LDM>(); Broker b = new Broker(); String CsOG = ""; buginLDM = b.FillListBoxLDM(b.LoadOccupation("LDM")); foreach (var item in buginLDM) { XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; if (item.MessageIdentifier == "Departure") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDayOfDepartureDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", item.PassengerAdults, new XAttribute("propertyName", "local_vzr_econom")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "local_rb_econom")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Departure")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Departure")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "local_vb_econom")) ) ) ) ); } else if (item.MessageIdentifier == "Arrival") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", item.PassengerAdults, new XAttribute("propertyName", "sop adults arrival")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "sop_arr_child")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Arrival")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Arrival")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "weight+lug_arr")) ) ) ) ); } messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); //Мониторингке кажетти мәліметтер b.WriteMonitoring(item.FlightIdentifier + " " + (item.MessageIdentifier == "Arrival" ? b.LDMDiffDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd") + " Arrival" : b.LDMDayOfDepartureDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd") + " Departure")); } b.WriteMyLOG("Update LDM Flight: " + CsOG); b.CloseReader(); this.timerKezegi = "FFM"; }
private void picture1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if ((e.Button!=MouseButtons.Left) || (e.X <= 0) || (e.Y <= 0)) return; Util.line lineToDraw = new Util.line(); lineToDraw.XFrom=iLastX; lineToDraw.YFrom=iLastY; lineToDraw.XTo=e.X; lineToDraw.YTo=e.Y; AddLine(lineToDraw,picture1Graphics); iLastX=e.X; iLastY=e.Y; if (qFriend == null) return; System.Messaging.Message SendMsg; SendMsg = new System.Messaging.Message(); SendMsg.Formatter = new ActiveXMessageFormatter(); SendMsg.Priority=MessagePriority.Normal; SendMsg.Body=HP.LineToString(lineToDraw.XFrom, lineToDraw.YFrom, lineToDraw.XTo, lineToDraw.YTo); SendMsg.Label=lineToDraw.XFrom.ToString()+","+ lineToDraw.YFrom.ToString()+" To "+ lineToDraw.XTo.ToString()+","+ lineToDraw.YTo.ToString(); SendMsg.Recoverable = radioSendRec.Checked; qFriend.Send(SendMsg); }
private void SendLiteFSU() { List<SelectedFlights> flightList = new List<SelectedFlights>(); Broker b = new Broker(); flightList = b.FillListBoxSelectedFlightsFFMfromAMS("FSULITE", 1); String CsOG = ""; foreach (var item in flightList) { List<FFM> ffmList = new List<FFM>(); ffmList = b.FillListBoxFFMfromAMS(item); //Толтырамыз string text1, copyEmail, emailCC; text1 = b.LoadFFMBlank("fsu_lite_blank_email"); emailCC = ""; copyEmail = ""; string[] split; if (item.Email.Contains(",")) { split = item.Email.Split(','); for (int i = 1; i < split.Length; i++) { emailCC = emailCC + "," + split[i]; } copyEmail = split[0]; emailCC = emailCC.Substring(1, emailCC.Length - 1); //Үтірді өшіру } else if (item.Email.Equals("")) continue; else copyEmail = item.Email; text1 = text1.Replace("PS102", item.FlightIdentifier); text1 = text1.Replace("27MAY", item.FlightSDO.ToString("ddMMM").ToUpper()); text1 = text1.Replace("1930", item.FlightSTO.ToString("HHmm")); text1 = text1.Replace("URGAU", item.Registration); text1 = text1.Replace("[DESTINATION]", item.Destination); text1 = text1.Replace("[CARGOCOUNT]", item.CountCargo.ToString()); text1 = text1.Replace("[CARGOWEIGHT]", item.WeightCargo.ToString()); text1 = text1.Replace("[MAILCOUNT]", item.CountMail.ToString()); text1 = text1.Replace("[MAILWEIGHT]", item.WeightMail.ToString()); string textFFM = ""; foreach (var itemf in ffmList) //555-92050641SVOTSE/T5K38MC0.53/COURIER CARGO/ XPS { textFFM = textFFM + itemf.AwbSerialNumber + itemf.Origin + itemf.Destination + "/T" + itemf.Pieces + "K" + itemf.Weight + "MC" + itemf.Volume + "/" + itemf.Goods + Environment.NewLine; if (itemf.ShipmentDescriptionCode.Trim().Length > 0) { textFFM = textFFM + itemf.ShipmentDescriptionCode + Environment.NewLine; } } text1 = text1.Replace("[text]", textFFM); text1 = text1 + "LAST"; b.WriteMyLOG("SEND Flight FSULITE: Start send email"); //Жібереміз Почтамен try { SendMail(_SmtpServer, _SysMail, _SysMailPassword, copyEmail, emailCC, "FSU LITE TSE", text1); } catch (Exception e) { b.WriteMyLOG("SEND Flight FSULITE:" + e); } XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", "Departure"), new XElement(ad + "AirlineDesignator", item.CIata, new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightNumber), new XElement(ad + "ScheduledDate", item.FlightSDO.ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", new XElement(am + "Update", "True", new XAttribute("propertyName", "KC_LITE_FSU")) ) ) )); messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("SEND Flight FSULITE: " + CsOG); b.CloseReader(); this.timerKezegi = "FSU14"; // eventLog1.WriteEntry("SUCCESS Updated Send FFM"); }
public void WillMoveMessageToPoisonQueueIfUnableToDeserializeMessage() { var message = new System.Messaging.Message("Invalid Message") { Recoverable = true }; testQueue.Send(message); using (new MessageReceiver<String>(TestMessageQueue.Path, new BinarySerializer(), messageProcessor)) { testQueue.SendMessage("Valid Message"); messageProcessor.ProcessMessages(count: 1); } using (var poisonQueue = TestMessageQueue.Create("poison")) Assert.NotNull(poisonQueue.PeekById(message.Id)); }
private void scanMVT() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("MVT.txt", AppDomain.CurrentDomain.BaseDirectory + "MVT.txt"); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<MVTDeparture> buginDeparture = new List<MVTDeparture>(); // eventLog1.WriteEntry("Created buginDeparture"); Broker b = new Broker(); // eventLog1.WriteEntry("Created Broker"); String CsOG = ""; buginDeparture = b.FillListBox(b.LoadOccupation("MVT")); foreach (var item in buginDeparture) { XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", "Arrival"), new XElement(ad + "AirlineDesignator", item.FlightNumber.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightNumber.Substring(2, item.FlightNumber.Length - 2)), new XElement(ad + "ScheduledDate", b.FilterDate(Convert.ToDateTime(item.EstimatedTimeOfArrival), "start").ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", Convert.ToDateTime(item.EstimatedTimeOfArrival).ToString(), new XAttribute("propertyName", "arrival_estimated")), new XElement(am + "Update", b.FilterDate(Convert.ToDateTime(item.AirborneTime), "time").ToString("HHmm"), new XAttribute("propertyName", "R1_ATD")) ) ) ) ); messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update Flight MVT: " + CsOG); b.CloseReader(); this.timerKezegi = "LDM"; // eventLog1.WriteEntry("SUCCESS Updated"); }
public void SendLockReleaseResponse(System.Messaging.Message requestMessage, bool releaseLock) { MessageBody receivedMessageBody = (MessageBody)requestMessage.Body; LockReleaseResponseMessageBody responseMessageBody = new LockReleaseResponseMessageBody(receivedMessageBody, releaseLock); if(releaseLock == true) if (this.ReleaseLock != null) this.ReleaseLock(receivedMessageBody.MasterAccessionNo, new EventArgs()); System.Messaging.Message responseMessage = new System.Messaging.Message(responseMessageBody); requestMessage.ResponseQueue.Send(responseMessage); MessageQueueMessage responseMessageQueueMessage = new MessageQueueMessage(responseMessage, MessageDirectionEnum.Sent); this.m_MessageCollection.Add(responseMessageQueueMessage); }
public void SendLockReleaseRequest(Business.Test.AccessionOrder accessionOrder) { LockReleaseRequestMessageBody messageBody = new LockReleaseRequestMessageBody(accessionOrder.MasterAccessionNo, accessionOrder.LockAquiredByUserName, accessionOrder.LockAquiredByHostName, accessionOrder.TimeLockAquired.Value); System.Messaging.Message message = new System.Messaging.Message(messageBody); message.ResponseQueue = new System.Messaging.MessageQueue(Environment.MachineName + "\\" + LockReleaseResponseQueueName); System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(messageBody.LockAquiredByHostName + "\\" + LockReleaseRequestQueueName); queue.Send(message); MessageQueueMessage messageQueueMessage = new MessageQueueMessage(message, MessageDirectionEnum.Sent); this.m_MessageCollection.Insert(0, messageQueueMessage); }
private void SendFFM() { List<SelectedFlights> flightList = new List<SelectedFlights>(); Broker b = new Broker(); flightList = b.FillListBoxSelectedFlightsFFMfromAMS("FFM", 1); String CsOG = ""; foreach (var item in flightList) { List<FFM> ffmList = new List<FFM>(); ffmList = b.FillListBoxFFMfromAMS(item); //Толтырамыз string text1; text1 = b.LoadFFMBlank("ffm_blank"); text1 = text1.Replace("TSEAPXH", item.TypeBADDRESS); text1 = text1.Replace("PS102", item.FlightIdentifier); text1 = text1.Replace("27MAY", item.FlightSDO.ToString("ddMMM").ToUpper()); text1 = text1.Replace("1930", item.FlightSTO.ToString("HHmm")); text1 = text1.Replace("URGAU", item.Registration); text1 = text1.Replace("[DESTINATION]", item.Destination); string textFFM = ""; foreach (var itemf in ffmList) //555-92050641SVOTSE/T5K38MC0.53/COURIER CARGO/ XPS { textFFM = textFFM + itemf.AwbSerialNumber + itemf.Origin + itemf.Destination+ "/T" + itemf.Pieces + "K" + itemf.Weight + "MC" + itemf.Volume + "/" + itemf.Goods + Environment.NewLine; if (itemf.ShipmentDescriptionCode.Trim().Length > 0) { textFFM = textFFM + itemf.ShipmentDescriptionCode + Environment.NewLine; } } text1 = text1.Replace("[text]", textFFM); text1 = text1 + "LAST"; //Cақтаймыз SaveFFM(text1, "FFM2"); //Жібереміз try { FTPClient ftp = new FTPClient(_RemoteHostFids, _RemoteLoginFids, _RemotePasswordFids); // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt"); string[] array1 = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.SND"); foreach (string name in array1) { Console.WriteLine(name); byte pervyi = 1; while (true) { try { ftp.UploadFile(name); break; } catch (Exception e) { if (pervyi == 1) { eventLog1.WriteEntry("Работа остановилась связи копированием " + e.ToString()); pervyi = 2; } Thread.Sleep(10000); } } if (pervyi == 2) eventLog1.WriteEntry("Работа возобновилась"); File.Delete(name); } } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); throw; } XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", "Departure"), new XElement(ad + "AirlineDesignator", item.CIata, new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightNumber), new XElement(ad + "ScheduledDate", item.FlightSDO.ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", new XElement(am + "Update", "True", new XAttribute("propertyName", "ffm_is_send")) ) ) )); messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("SEND Flight FFM: " + CsOG); b.CloseReader(); this.timerKezegi = "FSULITE"; // eventLog1.WriteEntry("SUCCESS Updated Send FFM"); }
private void SendFSU() { List<SelectedFlights> flightList = new List<SelectedFlights>(); Broker b = new Broker(); flightList = b.FillListBoxSelectedFlightsFFMfromAMS("FSU14", 1); int sou = 0; String CsOG = ""; foreach (var selF in flightList) { List<FFM> ffmList = new List<FFM>(); ffmList = b.FillListBoxFFMfromAMS(selF); //Толтырамыз string text1 = ""; sou = 0; string textFFM, copyEmail, emailCC = ""; foreach (var item in ffmList) //555-92050641SVOTSE/T5K38MC0.53/COURIER CARGO/ XPS { textFFM = ""; sou++; text1 = ""; text1 = b.LoadFFMBlank("fsu_blank"); text1 = text1.Replace("TSEAPXH", selF.TypeBADDRESS); //text1 = text1.Replace("[EMAIL]", selF.EmailCargo); text1 = text1.Replace("PS102", selF.FlightIdentifier); text1 = text1.Replace("27MAY", selF.FlightSDO.ToString("ddMMM").ToUpper()); text1 = text1.Replace("[DESTINATION]", selF.Destination); text1 = text1.Replace("[CARGOCOUNT]", item.Pieces.ToString()); text1 = text1.Replace("[CARGOWEIGHT]", item.Weight.ToString()); text1 = text1.Replace("[FSA89]", selF.TypeTimeIndicator.ToString()); text1 = text1.Replace("[TIME_DEP]", selF.DepTime.ToString()); text1 = text1.Replace("[TIME_ARR]", selF.ArrTime.ToString()); text1 = text1.Replace("[FSA72]", selF.DayChangeIndicator.ToString()); textFFM = textFFM + Environment.NewLine + item.AwbSerialNumber + item.Origin + item.Destination + "/T" + item.Pieces + "K" + item.Weight; text1 = text1.Replace("[FSUAWB]", textFFM); //Cақтаймыз SaveFFM(text1, "FSU14-" + Convert.ToString(sou)); if (selF.EmailCargo.Length > 0) { b.WriteMyLOG("SEND Flight FSU: Start send email"); //Жібереміз Почтамен emailCC = ""; copyEmail = ""; string[] split; if (selF.EmailCargo.Contains(",")) { split = selF.EmailCargo.Split(','); for (int i = 1; i < split.Length; i++) { emailCC = emailCC + "," + split[i]; } copyEmail = split[0]; emailCC = emailCC.Substring(1, emailCC.Length - 1); //Үтірді өшіру } else if (selF.EmailCargo.Equals("")) continue; else copyEmail = selF.EmailCargo; b.WriteMyLOG("SEND Flight FSU: copyEmail:" + copyEmail + " emailCC:" + emailCC); try { SendMail(_SmtpServer, _SysMail, _SysMailPassword, copyEmail, emailCC, "FSU TSE", text1.Substring(text1.IndexOf("FSU/14"), text1.Length - text1.IndexOf("FSU/14"))); } catch (Exception e) { b.WriteMyLOG("SEND Flight FSU:" + e); } } } //Жібереміз try { FTPClient ftp = new FTPClient(_RemoteHostFids, _RemoteLoginFids, _RemotePasswordFids); // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt"); string[] array1 = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.SND"); foreach (string name in array1) { Console.WriteLine(name); byte pervyi = 1; while (true) { try { ftp.UploadFile(name); break; } catch (Exception e) { if (pervyi == 1) { eventLog1.WriteEntry("Работа остановилась связи копированием " + e.ToString()); pervyi = 2; } Thread.Sleep(10000); } } if (pervyi == 2) eventLog1.WriteEntry("Работа возобновилась"); File.Delete(name); } } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); throw; } XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", "Departure"), new XElement(ad + "AirlineDesignator", selF.CIata, new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", selF.FlightNumber), new XElement(ad + "ScheduledDate", selF.FlightSDO.ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", new XElement(am + "Update", "True", new XAttribute("propertyName", "FSU")) ) ) )); messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("SEND Flight FSU14 count(" + Convert.ToString(sou) +")" + CsOG); b.CloseReader(); this.timerKezegi = "LDM"; }
/// <summary> /// Constructs object, setting required properties. /// </summary> /// <param name="qsetMessageQueue">The queue set queue item which the message belongs to.</param> /// <param name="process">Process associated with the event.</param> /// <param name="message">Message being selected.</param> public SelectedMessageChangedEventArgs (QSetQueueItem qsetQueueItem, System.Messaging.Message message) : base() { _message = message; _qsetQueueItem = qsetQueueItem; }
public MessageListViewItem (System.Messaging.Message message, ListViewItem.ListViewSubItem[] subItems, int imageIndex) : base(subItems, imageIndex) { _message = message; }
/// <summary> /// Sends the message to all recipients. /// </summary> /// <param name="keepWindowOpen">Set to true to keep the window open, else the window will close.</param> private void SendMessage(bool keepWindowOpen) { System.Messaging.Message[] messages = null; bool success = false; try { //check the license allows the operation if (_license.ValidateFeatureUse(_mode == Mode.NewMessage ? Licensing.Feature.NewMessage : Licensing.Feature.FowardMessage)) { //generate an array of all target queues System.Messaging.MessageQueue[] messageQueues = new System.Messaging.MessageQueue[recipientsListView.Items.Count]; for (int i = 0; i < recipientsListView.Items.Count; i ++) { messageQueues[i] = (System.Messaging.MessageQueue)((QSetQueueItem)recipientsListView.Items[i].Tag).QSetMessageQueue; } //create a new message, or prepare existing ones, to send to recipients if (_mode == Mode.NewMessage) { //create the message from the releavent source messages = new System.Messaging.Message[1] {new System.Messaging.Message()}; FillMessageBody(messages[0]); messages[0].Label = labelTextBox.Text; //set message options messages[0].Recoverable = optionsRecoverableMenuItem.Checked; messages[0].UseAuthentication = optionsUseAuthenticationMenuItem.Checked; messages[0].UseDeadLetterQueue = optionsUseDeadLetterQueueMenuItem.Checked; messages[0].UseEncryption = optionsUseEncryptionMenuItem.Checked; messages[0].UseJournalQueue = optionsUseJournalQueueMenuItem.Checked; messages[0].UseTracing = optionsUseTracingMenuItem.Checked; messages[0].Priority = GetSelectedMessagePriority(); } else { //prepare existing messages... messages = new System.Messaging.Message[messagesListView.Items.Count]; for (int i = 0; i < messagesListView.Items.Count; i ++) { messages[i] = _queueTaskManager.DuplicateMessage(_sourceQueueItem.QSetMessageQueue, ((System.Messaging.Message)messagesListView.Items[i].Tag).Id); } } if (keepWindowOpen) Cursor = Cursors.WaitCursor; else this.Hide(); //send the messages foreach (System.Messaging.Message message in messages) _queueTaskManager.BulkSend(messageQueues, message, Convert.ToInt32(numberOfCopiesComboBoxItem.ComboBox.Text)); success = true; } } catch (Exception exc) { MessageBox.Show( this, string.Format("Encountered an error while preparing to send message:\n\n{0}", exc.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { if (_mode == Mode.NewMessage && messages != null) foreach (System.Messaging.Message message in messages) message.Dispose(); Cursor = Cursors.Default; if (!keepWindowOpen && success) { DialogResult = DialogResult.OK; this.Close(); } } }
public MessageListViewItem (System.Messaging.Message message, string[] items, int imageIndex, Color foreColor, Color backColor, Font font) : base(items, imageIndex, foreColor, backColor, font) { _message = message; }
public MSMQMessageWrapper(System.Messaging.Message message) { m_Message = message; }
public MessageListViewItem (System.Messaging.Message message, string text, int imageIndex) : base(text, imageIndex) { _message = message; }
// // Characters drawing // private void textChars_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (qFriend == null) return; System.Messaging.Message SendMsg; SendMsg = new System.Messaging.Message(); SendMsg.Formatter = new ActiveXMessageFormatter(); SendMsg.Priority=MessagePriority.AboveNormal; SendMsg.Body=e.KeyChar.ToString(); SendMsg.Label="Key: "+e.KeyChar.ToString(); SendMsg.Recoverable = radioSendRec.Checked; qFriend.Send(SendMsg); }
private void syncPTM() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("PTM.txt", AppDomain.CurrentDomain.BaseDirectory + "PTM.txt"); //File.Copy(@"\\192.168.1.173\exported\LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt",true); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<PTM> buginPTM = new List<PTM>(); Broker b = new Broker(); String CsOG = ""; buginPTM = b.FillListBoxPTM(b.LoadOccupation("PTM")); foreach (var item in buginPTM) { //listBox1.Items.Add("ptm " + item.ToString()); XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; if (item.MessageIdentifier == "Departure") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDayOfDepartureDate(item.FlightDate.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", item.Bags, new XAttribute("propertyName", "sogp_cargo_count_departure")), new XElement(am + "Update", Math.Round(Convert.ToDouble(item.Weight)), new XAttribute("propertyName", "SOP Cargo Weight Departure")) ) ) ) ); } else if (item.MessageIdentifier == "Arrival") { root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", Convert.ToInt32(item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2))), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.FlightDate.Substring(0, 2), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", new XElement(am + "Update", item.Passenger, new XAttribute("propertyName", "ARR_TRANS_PASS")), //Darkhan new XElement(am + "Update", item.TranzitDomesticPAX, new XAttribute("propertyName", "TranzitDomesticPax")), new XElement(am + "Update", item.TranzitInternationalPAX, new XAttribute("propertyName", "TranzitInternationalPax")), new XElement(am + "Update", item.Bags, new XAttribute("propertyName", "ARR_TRANS_BAGS")), new XElement(am + "Update", Math.Round(Convert.ToDouble(item.Weight)), new XAttribute("propertyName", "ARR_TRANS_BAG_WEIGHT")) ) ) ) ); } //messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update PTM Flight: " + CsOG); b.CloseReader(); this.timerKezegi = "FFMS"; }