Ejemplo n.º 1
0
        /// <summary>
        /// Execute BillCommand
        /// </summary>
        /// <param name="item">Selected item to be processed.</param>
        private void ExecuteBillCommand(Order item)
        {
            try
            {
                if (this.MessageBoxService.ShowYesNo(
                        "Would you like to bill order \"" + item.Code + "\"?",
                        CustomDialogIcons.Question) == CustomDialogResults.Yes)
                {
                    KeyPadViewModel viewModel = new KeyPadViewModel("Cash");

                    bool?result = this.UIVisualizerService.ShowDialog("KeyPadPopup", viewModel);

                    if (result.HasValue && result.Value)
                    {
                        item.Cash = Convert.ToInt64(viewModel.ReturnedValue);

                        if (item.Change < 0)
                        {
                            MessageBoxService.ShowInformation(
                                "Payment for order " + item.Code + " is not enough !!! Please pay greater amount! Thank you.");
                        }
                        else
                        {
                            (ModelManager as IOrderManager).BillOrder(GlobalObjects.SystemUser, item);
                            //SelectedItem = this.Items[0];
                        }

                        // refresh item list
                        this.ExecuteRefreshCommand();
                        // refresh table list
                        RefreshTablesCommand.Execute(null);
                    }
                }
            }
            catch (Exception ex)
            {
                this.MessageBoxService.ShowError(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Execute ServiceChargeCommand
        /// </summary>
        /// <param name="item">Selected item to be processed.</param>
        private void ExecuteServiceChargeCommand(Order item)
        {
            try
            {
                KeyPadViewModel viewModel = new KeyPadViewModel("Service Charge");
                bool?           result    = UIVisualizerService.ShowDialog("KeyPadPopup", viewModel);

                if (result.HasValue && result.Value)
                {
                    item.ServiceCharge = Convert.ToInt64(viewModel.ReturnedValue);
                    (ModelManager as IOrderManager).UpdateServiceCharge(item);

                    // refresh item list
                    this.ExecuteRefreshCommand();
                    // refresh table list
                    RefreshTablesCommand.Execute(null);
                }
            }
            catch (Exception ex)
            {
                this.MessageBoxService.ShowError(this.GetType().FullName + System.Reflection.MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }