示例#1
0
        private void ucPlace_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ucPlace ucPlace = sender as ucPlace;

            if (ucPlace != null &&
                ucPlace.IsSittingPlace)
            {
                // Check if the place is available
                if (ucPlace.DataContext == null)
                {
                    ucPlace.OpenCheck();
                }
                else
                {
                    // Check if the place is available
                    if (ucPlace.IsAvailable)
                    {
                        ucPlace.OpenCheck();
                    }
                }

                // Create and open dialog which contains the check bill
                dlgOrderCheck orderCheck = new dlgOrderCheck();

                orderCheck.OnOrderMoved += orderCheck_OnOrderMoved;

                orderCheck.DataContext = ucPlace.DataContext;
                orderCheck.ShowDialog();
            }
        }
示例#2
0
        private void orderCheck_OnOrderMoved(Order order)
        {
            ucPlace MovedPlace = null;

            foreach (ucPlace item in cnvPool.Children)
            {
                if (item.DataContext == order)
                {
                    MovedPlace = item;
                    break;
                }
            }

            dlgPlacesList dlg = new dlgPlacesList(cnvPool.Children, MovedPlace);

            dlg.ShowDialog();

            if (dlg.IsAccpeted)
            {
                if (dlg.ChosenPlace != null)
                {
                    if (dlg.ChosenPlace.IsAvailable)
                    {
                        if (Verify("האם אתה בטוח שאתה רוצה להעביר את ההזמנה לשולחן אחר?"))
                        {
                            dlg.ChosenPlace.MoveDataContext(order);

                            if (MovedPlace != null)
                            {
                                MovedPlace.OpenCheck();
                            }
                        }
                    }
                    else
                    {
                        if (Verify("האם אתה בטוח שאתה למזג בין ההזמנות?"))
                        {
                            dlg.ChosenPlace.MergeDataContext(order);

                            if (MovedPlace != null)
                            {
                                MovedPlace.OpenCheck();
                            }
                        }
                    }
                }
            }
        }