Example #1
0
        private void AddOrderButton_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            client = bl.GetClient(currentRequest.ClientID);
            order  = new BO.Order()
            {
                ClientFirstName = client.Details.FirstName,
                ClientLastName  = client.Details.LastName,
                HostID          = host.Person.Id,
                HostingUnit     = btn.DataContext as BO.HostingUnit,
                GuestRequest    = currentRequest,
                OrderDate       = DateTime.Today,
                Status          = BO.Order_Status.PENDING
            };
            try
            {
                order.Key = bl.AddOrder(order);
                MessageBox.Show("ההזמנה נוצרה בהצלחה");
                myListview.ItemsSource = bl.GetHost(hostID).Orders;
            }
            catch (DuplicateWaitObjectException exception) { MessageBox.Show(exception.Message); }
            catch (MissingMemberException exception) { MessageBox.Show(exception.Message); }
        }
Example #2
0
        private void addOrderButton_Click(object sender, RoutedEventArgs e)//add order
        {
            int         key;
            Button      button = sender as Button;
            HostingUnit unit   = button.DataContext as HostingUnit;
            Order       order  = new Order()
            {
                ClientId        = request.ClientId,
                HostingUnitKey  = unit.Key,
                GuestRequestKey = request.Key,
                HostingUnitName = unit.HostingUnitName,
                //Commission = 10,
                ClientName = unit.HostingUnitName,
                OrderDate  = DateTime.Now,
                Status     = BO.OrderStatus.PROCESSING,
                TotalPrice = (request.LeaveDate - request.EntryDate).Days * unit.PricePerNight,
                HostId     = unit.HostId,
                //CloseDate = DateTime.Now.AddDays(7.0),
                //Key = 0,
                //SentDate = DateTime.Now.AddDays(7.0)
            };

            // this.hostingUnitListView.ItemsSource
            try
            {
                key = bl.AddOrder(order);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                this.Close();
            }
        }