Пример #1
0
 public void AddCourseOrder(CourseOrder courseOrder)
 {
     if (CourseOrderAdded != null)
     {
         CourseOrderAdded(courseOrder);
     }
 }
Пример #2
0
        private void buttonSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var order = new CourseOrder
                {
                    Course = new Course()
                    {
                        Title = comboBoxCourses.Text
                    },
                    Customer = new Customer
                    {
                        Company = textCompany.Text,
                        Contact = textContact.Text
                    }
                };

                var factory = new ChannelFactory <ICourseOrderService>("queueEndpoint");
                ICourseOrderService proxy = factory.CreateChannel();
                proxy.AddCourseOrder(order);
                factory.Close();

                MessageBox.Show("Course Order submitted", "Course Order",
                                MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (MessageQueueException ex)
            {
                MessageBox.Show(ex.Message, "Course Order Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 public void AddCourseOrder(CourseOrder courseOrder)
 {
     if (CourseOrderAdded != null)
     {
         CourseOrderAdded(this, new CourseOrderEventArgs(courseOrder));
     }
 }
Пример #4
0
        private void buttonSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CourseOrder order = new CourseOrder();
                order.Course = new Course()
                {
                    Title = comboCourses.SelectionBoxItem.ToString()
                };
                order.Customer = new Customer()
                {
                    Company = textCompany.Text,
                    Contact = textContact.Text
                };

                string queueName = @".\private$\CourseOrder";
                using (MessageQueue queue = new MessageQueue(queueName))
                    using (Message message = new Message(order))
                    {
                        if (checkHighPrio.IsChecked == true)
                        {
                            message.Priority = MessagePriority.High;
                        }
                        message.Recoverable = true;
                        queue.Send(message, String.Format("Course Order {{{0}}}", order.Customer.Company));
                    }
                MessageBox.Show("Course order submitted", "Course Order", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (MessageQueueException ex)
            {
                MessageBox.Show(ex.Message, "Course Order Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void buttonSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var order = new CourseOrder
                {
                    Course = new Course()
                    {
                        Title = comboBoxCourses.Text
                    },
                    Customer = new Customer
                    {
                        Company = textCompany.Text,
                        Contact = textContact.Text
                    }
                };

                var factory = new ChannelFactory<ICourseOrderService>("queueEndpoint");
                ICourseOrderService proxy = factory.CreateChannel();
                proxy.AddCourseOrder(order);
                factory.Close();

                MessageBox.Show("Course Order submitted", "Course Order",
                      MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (MessageQueueException ex)
            {
                MessageBox.Show(ex.Message, "Course Order Error",
                      MessageBoxButton.OK, MessageBoxImage.Error);
            }

        }
        public void AddCourseOrder(CourseOrder courseOrder)
        {
            var courseOrderAdded = CourseOrderAdded;

            if (courseOrderAdded != null)
            {
                courseOrderAdded(this, new CourseOrderEventArgs(courseOrder));
            }
        }
Пример #7
0
        private void buttonProcessOrder_Click(object sender, RoutedEventArgs e)
        {
            CourseOrder courseOrder = listOrders.SelectedItem as CourseOrder;

            courseOrders.Remove(courseOrder);
            listOrders.SelectedIndex     = -1;
            buttonProcessOrder.IsEnabled = false;

            MessageBox.Show("Course order processed", "Course Order Receiver",
                            MessageBoxButton.OK, MessageBoxImage.Information);
        }
        private void buttonSubmit_Click(object sender, RoutedEventArgs e)
        {
         try
         {
            var order = new CourseOrder
            {
                Course = new Course()
                {
                   Title = comboBoxCourses.Text
                },
                Customer = new Customer
                {
                   Company = textCompany.Text,
                   Contact = textContact.Text
                }
            };
             

             // using (MessageQueue queue = new MessageQueue(@".\Private$\CourseOrder"))
             using (MessageQueue queue = new MessageQueue(
                 CourseOrder.CourseOrderQueueName))
            using (var message = new Message(order))
            {
               if (checkBoxPriority.IsChecked == true)
               {
                  message.Priority = MessagePriority.High;
               }
               message.Recoverable = true;
               queue.Send(message, String.Format("Course Order {{{0}}}",
                     order.Customer.Company));
            }

            MessageBox.Show("Course Order submitted", "Course Order",
                  MessageBoxButton.OK, MessageBoxImage.Information);
         }
         catch (MessageQueueException ex)
         {
            MessageBox.Show(ex.Message, "Course Order Error",
                  MessageBoxButton.OK, MessageBoxImage.Error);
         }

        }
        private void buttonSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var order = new CourseOrder
                {
                    Course = new Course()
                    {
                        Title = comboBoxCourses.Text
                    },
                    Customer = new Customer
                    {
                        Company = textCompany.Text,
                        Contact = textContact.Text
                    }
                };

                // using (MessageQueue queue = new MessageQueue(@".\Private$\CourseOrder"))
                using (MessageQueue queue = new MessageQueue(
                           CourseOrder.CourseOrderQueueName))
                    using (var message = new Message(order))
                    {
                        if (checkBoxPriority.IsChecked == true)
                        {
                            message.Priority = MessagePriority.High;
                        }
                        message.Recoverable = true;
                        queue.Send(message, String.Format("Course Order {{{0}}}",
                                                          order.Customer.Company));
                    }

                MessageBox.Show("Course Order submitted", "Course Order",
                                MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (MessageQueueException ex)
            {
                MessageBox.Show(ex.Message, "Course Order Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void listOrders_SelectionChanged(object sender, RoutedEventArgs e)
        {
            LabelIdMapping labelId = listOrders.SelectedItem as LabelIdMapping;

            if (labelId == null)
            {
                return;
            }

            orderQueue.MessageReadPropertyFilter.Priority = true;
            Message message = orderQueue.PeekById(labelId.Id);

            CourseOrder order = message.Body as CourseOrder;

            if (order != null)
            {
                textCourse.Text              = order.Course.Title;
                textCompany.Text             = order.Customer.Company;
                textContact.Text             = order.Customer.Contact;
                buttonProcessOrder.IsEnabled = true;

                if (message.Priority > MessagePriority.Normal)
                {
                    labelPriority.Visibility = Visibility.Visible;
                }
                else
                {
                    labelPriority.Visibility = Visibility.Hidden;
                }
            }
            else
            {
                MessageBox.Show("The selected item is not a course order",
                                "Course Order Receiver", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
 public CourseOrderEventArgs(CourseOrder courseOrder)
 {
     this.CourseOrder = courseOrder;
 }
Пример #12
0
 public CourseOrderEventArgs(CourseOrder courseOrder)
 {
     this.CourseOrder = courseOrder;
 }
Пример #13
0
 public void AddCourseOrder(CourseOrder courseOrder)
 {
     if (CourseOrderAdded != null)
         CourseOrderAdded(this, new CourseOrderEventArgs(courseOrder));
 }