Пример #1
0
        private void searchOrderBtn_Click(object sender, RoutedEventArgs e)
        {
            string seatIDStr = seatIDTxt.Text.Trim();

            bool success = int.TryParse(seatIDStr, out seatID);

            if (!success)
            {
                errorLbl.Text = "Seat ID is not a number";
            }
            else
            {
                errorLbl.Text = "";
                OrderMediator mediator      = new OrderMediator();
                Order         customerOrder = mediator.getOrderBySeat(seatID);

                if (customerOrder == null)
                {
                    errorLbl.Text = "Seat is empty!";
                    return;
                }
                var orderDetail = mediator.getAllOrderDetail(customerOrder.orderID);
                orderDetailView.ItemsSource = orderDetail;

                totalPrice                 = mediator.getTotalPrice(customerOrder.orderID);
                tax                        = ((totalPrice * 10) / 100);
                totalPriceTxt.Text         = "Total Price = \t\tRp. " + totalPrice.ToString();
                taxTxt.Text                = "Tax = \t\t\tRp. " + tax.ToString();
                totalPriceAfterTaxTxt.Text = "Total Price After Tax = \tRp. " + (totalPrice + tax).ToString();
            }
        }
Пример #2
0
        private void orderIDTxt_TextChanged(object sender, TextChangedEventArgs e)
        {
            string orderIDStr = orderIDTxt.Text.Trim();
            int    orderID;

            bool success = int.TryParse(orderIDStr, out orderID);

            if (!success && orderIDTxt.Text != "")
            {
                errorLbl.Text = "Order ID is not a number";
            }
            else
            {
                errorLbl.Text = "";
                OrderMediator mediator = new OrderMediator();
                if (mediator.getOrder(orderID) == null)
                {
                    orderDetailView.ItemsSource = null;
                    return;
                }
                orderDetailView.ItemsSource = mediator.getAllOrderDetail(orderID);
            }
        }