private void OrderButton_Click(object sender, RoutedEventArgs e) { Window OrderWindow = new OrderWindow(); OrderWindow.Show(); this.Close(); }
private void cancelorderButton_Click(object sender, RoutedEventArgs e) { try { if (OrderComBox.SelectedItem == null) { throw new NullReferenceException("please select order to update"); } order = OrderComBox.SelectedValue as BE.Order; this.DataContext = order; bl.UpdateOrderStatus(order, BE.OrderStatus.customer_canceled, DateTime.Now); order = new BE.Order(); MessageBoxResult result = MessageBox.Show("This Order has been canceled. Would you like to update another order?", "Status", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: this.Close(); Window UpdateOrderWindow = new UpdateOrderWindow(); UpdateOrderWindow.Show(); break; case MessageBoxResult.No: this.Close(); Window window = new OrderWindow(); window.Show(); break; } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void UpdateOrderButton_Click(object sender, RoutedEventArgs e) { try { if (OrderComBox.SelectedItem == null) { throw new NullReferenceException("please select order to update"); } order = OrderComBox.SelectedValue as BE.Order; this.DataContext = order; bl.UpdateOrderStatus(order, BE.OrderStatus.email_sent, Convert.ToDateTime(emailDatePicker.SelectedDate)); var itUnit = (from newUnit in bl.GetHostingUnitList() where newUnit.HostingUnitKey == order.HostingUnitKey select newUnit).FirstOrDefault(); var itGuest = (from newGuest in bl.GetGuestList() where newGuest.GuestRequestKey == order.GuestRequestKey select newGuest).FirstOrDefault(); string to = itGuest.MailAddress; string subject = "Your Vacation is Being Scheduled"; string body = string.Format("a vacation is in the process of being scheduled for " + itGuest.PrivateName + " " + itGuest.FamilyName + " for the dates of " + itGuest.EntryDate + " - " + itGuest.ReleaseDate + " at : " + itUnit.HostingUnitName + " which is located in the : " + itUnit.area + " area. Please contact the host directly at: " + itUnit.Owner.PhoneNumber + " to finalize the reservation"); Thread thread = new Thread(() => bl.SendMail(to, subject, body)); thread.Start(); order = new BE.Order(); MessageBoxResult result = MessageBox.Show("An email has been sent. Would you like to update another order?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Question); switch (result) { case MessageBoxResult.Yes: this.Close(); Window UpdateOrderWindow = new UpdateOrderWindow(); UpdateOrderWindow.Show(); break; case MessageBoxResult.No: this.Close(); Window window = new OrderWindow(); window.Show(); break; } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Button_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Are you sure that you are finished?", "Exit", MessageBoxButton.YesNo, MessageBoxImage.Question); switch (result) { case MessageBoxResult.Yes: this.Close(); Window window = new OrderWindow(); window.Show(); break; case MessageBoxResult.No: break; } }
private void AddOrderButton_Click(object sender, RoutedEventArgs e) { try { guestrequest = GuestrequestComboBox.SelectedValue as BE.GuestRequest; if (guestrequest == null) { throw new NullReferenceException("please choose a guest request"); } hostingunit = HostingUnitComboBox.SelectedValue as BE.HostingUnit; if (hostingunit == null) { throw new NullReferenceException("please choose a hosting unit"); } order.GuestRequestKey = guestrequest.GuestRequestKey; order.HostingUnitKey = hostingunit.HostingUnitKey; this.DataContext = order; bl.AddOrder(order.GuestRequestKey, order.HostingUnitKey); order = new BE.Order(); MessageBoxResult result = MessageBox.Show("Thank You, your order has been added. Would you like to add another order?", "Status", MessageBoxButton.YesNo, MessageBoxImage.Information); switch (result) { case MessageBoxResult.Yes: this.Close(); Window AddOrderWindow = new AddOrderWindow(); AddOrderWindow.Show(); break; case MessageBoxResult.No: this.Close(); Window OrderWindow = new OrderWindow(); OrderWindow.Show(); break; } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButton.OK, MessageBoxImage.Error); } }