コード例 #1
0
ファイル: HomePageVM.cs プロジェクト: zorasdangol/ParkingApp
        public async void ExecuteStampCommand()
        {
            try
            {
                if (PIN == null || POUT == null)
                {
                    DependencyService.Get <IMessage>().ShortAlert("No Vehicle to exit");
                    return;
                }
                if (POUT.PID == 0 || PIN.PID == 0)
                {
                    DependencyService.Get <IMessage>().ShortAlert("No vehicle entered to exit.");
                    return;
                }

                var ans = await App.Current.MainPage.DisplayAlert("Confirm", "Are you sure to Exit Vehicle?", "Yes", "No");

                if (!ans)
                {
                    return;
                }

                POUT.SESSION_ID    = GlobalClass.User.Session;
                POUT.STAFF_BARCODE = "STAMP";
                var transferData = new BarCodeTransfer()
                {
                    barcode = Barcode, Vouchers = Vouchers, mDiscount = mDiscount, PIN = PIN, POUT = POUT, Session = GlobalClass.User.Session
                };
                var res = await ParkingDetailsConnection.SaveStaffOrStampPOUT(transferData);

                if (res.status == "ok")
                {
                    DependencyService.Get <IMessage>().ShortAlert("Vehicle exited Successfully");
                    POUT      = new ParkingOut();
                    PIN       = new ParkingIn();
                    Vouchers  = new List <Voucher>();
                    mDiscount = new MemberDiscount();
                }
                else if (res.status == "error")
                {
                    DependencyService.Get <IMessage>().ShortAlert(res.Message);
                }
            }
            catch (Exception ex)
            {
                DependencyService.Get <IMessage>().ShortAlert(ex.Message);
            }
        }
コード例 #2
0
ファイル: HomePageVM.cs プロジェクト: zorasdangol/ParkingApp
        public async void ExecuteStaffCommand()
        {
            try
            {
                //IsStaffBarcode = false;
                if (string.IsNullOrEmpty(StaffBarcode))
                {
                    DependencyService.Get <IMessage>().ShortAlert("Invalid Barcode. Please Try Again");
                    return;
                }

                POUT.SESSION_ID    = GlobalClass.User.Session;
                POUT.STAFF_BARCODE = StaffBarcode;
                var transferData = new BarCodeTransfer()
                {
                    barcode = Barcode, Vouchers = Vouchers, mDiscount = mDiscount, PIN = PIN, POUT = POUT, Session = GlobalClass.User.Session
                };
                var res = await ParkingDetailsConnection.SaveStaffOrStampPOUT(transferData);

                if (res.status == "ok")
                {
                    IsStaffBarcode = false;
                    DependencyService.Get <IMessage>().ShortAlert("Vehicle exited Successfully");
                    POUT      = new ParkingOut();
                    PIN       = new ParkingIn();
                    Vouchers  = new List <Voucher>();
                    mDiscount = new MemberDiscount();
                }
                else if (res.status == "error")
                {
                    DependencyService.Get <IMessage>().ShortAlert(res.Message);
                }
            }
            catch (Exception ex)
            {
                DependencyService.Get <IMessage>().ShortAlert(ex.Message);
            }
        }