Esempio n. 1
0
        public async void GoToPayment(string type, string billId)
        {
            //MoneyPayModel money = paymentVM.MoneyModel;

            if (paymentVM.FinishPayment(orderinfo, tableId, cus, paymentVM.MoneyModel, type, billId))
            {
                System.Windows.Forms.MessageBox.Show("Thanh toán thành công");
                // send api to backend
                ApiBackendService apiBackend = new ApiBackendService();
                await apiBackend.SendApiToBackend(orderinfo.Id);

                // return table page
                IRES_Globals.Cashier.MemoryAction.Instance = null;
                ViewModel.Cashier.Common.BreadCrumbViewModel.Instance.RemovePos("Bàn");
                Switcher.Switch(new TablePage());
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Có sự cố xảy ra!!! Vui lòng kiểm tra lại");
            }
        }
Esempio n. 2
0
        public async void GotoMomopayment(int idTable)
        {
            MoMoPayment momoRequest = new MoMoPayment();

            BillViewModel billVM = new BillViewModel(idTable, 0, 0);
            string        billId = "BILL_" + DateTime.Now.ToString("yyyyMMddHHmmssffff");
            int           result = momoRequest.GoToMomoPayment(billVM.MoneyDetail.TotalPay, billId);

            if (result == 1) // thanh toan thanh cong
            {
                PaymentViewModel paymentVM = new PaymentViewModel(billVM.MoneyDetail.TotalPay);
                if (paymentVM.FinishPayment(billVM.OrderInfo, idTable, billVM.CustomerInfo, paymentVM.MoneyModel, "", billId))
                {
                    //  System.Windows.Forms.MessageBox.Show("Thanh toan thành công");
                    // send api to backend
                    ApiBackendService apiBackend = new ApiBackendService();
                    await apiBackend.SendApiToBackend(billVM.OrderInfo.Id);

                    //  MessageBox.Show("Thanh toan thanh cong");

                    // return table page
                    IRES_Globals.Cashier.MemoryAction.Instance = null;
                    ViewModel.Cashier.Common.BreadCrumbViewModel.Instance.RemovePos("Bàn");
                    Switcher.Switch(new TablePage());
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Có sự cố xảy ra!!! Vui lòng kiểm tra lại");
                }
            }
            else if (result == -1) // thanh toan that bai
            {
                MessageBox.Show("Thanh toan momo that bai, vui long kiem tra lai");
            }
            else if (result == 0) // khong bat browser
            {
            }
        }