Beispiel #1
0
        private async void BtnGeneratePassReceipt_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    ShowLoading(true);
                    CustomerVehiclePass resultPass = null;
                    await Task.Run(() =>
                    {
                        resultPass = dal_CustomerPass.CreateCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerDayPass);
                    });

                    if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                    {
                        await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok");

                        await Navigation.PushAsync(new PassPaymentReceiptPage(resultPass));
                    }
                    else
                    {
                        await DisplayAlert("Alert", "Fail to crated pass ,Please contact Admin", "Ok");
                    }
                    ShowLoading(false);
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "DayPassPaymentConfirmationPage.xaml.cs", "", "BtnGeneratePassReceipt_Clicked");
            }
        }
Beispiel #2
0
        private async void BtnGeneratePassReceipt_Clicked(object sender, EventArgs e)
        {
            try
            {
                btnGeneratePassReceipt.IsVisible = false;
                CustomerVehiclePass    resultPass             = null;
                PassPaymentReceiptPage PassPaymentReceiptPage = null;
                ShowLoading(true);
                if (DeviceInternet.InternetConnected())
                {
                    if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                    {
                        decimal passAmount = (objCustomerweeklyPass.TotalAmount == null || objCustomerweeklyPass.TotalAmount == 0) ? (objCustomerweeklyPass.Amount + objCustomerweeklyPass.DueAmount) : (objCustomerweeklyPass.TotalAmount + objCustomerweeklyPass.DueAmount);
                        if (Convert.ToDecimal(entryCashReceived.Text) >= passAmount)
                        {
                            await Task.Run(() =>
                            {
                                resultPass = dal_CustomerPass.CreateCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerweeklyPass);
                                if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                                {
                                    PassPaymentReceiptPage = new PassPaymentReceiptPage(resultPass);
                                }
                            });

                            if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                            {
                                await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok");

                                await Navigation.PushAsync(PassPaymentReceiptPage);
                            }
                            else
                            {
                                await DisplayAlert("Alert", "Payment Failed,Please contact Admin", "Ok");
                            }
                        }
                        else
                        {
                            btnGeneratePassReceipt.IsVisible = true;
                            await DisplayAlert("Alert", "Please enter valid pass amount.", "Ok");
                        }
                        ShowLoading(false);
                    }
                }
                else
                {
                    ShowLoading(false);
                    await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "WeeklyPassPaymentConfirmationPage.xaml.cs", "", "BtnGeneratePassReceipt_Clicked");
            }
        }
Beispiel #3
0
        private async void BtnGeneratePassReceipt_Clicked(object sender, EventArgs e)
        {
            try
            {
                CustomerVehiclePass    resultPass             = null;
                PassPaymentReceiptPage PassPaymentReceiptPage = null;
                if (DeviceInternet.InternetConnected())
                {
                    if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                    {
                        await Task.Run(() =>
                        {
                            resultPass = dal_CustomerPass.CreateCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerweeklyPass);
                            if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                            {
                                PassPaymentReceiptPage = new PassPaymentReceiptPage(resultPass);
                            }
                        });

                        if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                        {
                            await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok");

                            await Navigation.PushAsync(PassPaymentReceiptPage);
                        }
                        else
                        {
                            await DisplayAlert("Alert", "Payment Failed,Please contact Admin", "Ok");
                        }
                    }
                }
                else
                {
                    await DisplayAlert("Alert", "Please check your Internet connection", "Ok");
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "WeeklyPassPaymentConfirmationPage.xaml.cs", "", "BtnGeneratePassReceipt_Clicked");
            }
        }
Beispiel #4
0
        private async void BtnGeneratePass_Clicked(object sender, EventArgs e)
        {
            try
            {
                CustomerVehiclePass resultPass = null;
                string existingnfcCardVehcile  = string.Empty;
                btnGeneratePass.IsVisible = false;
                ShowLoading(true);
                if (entryCashReceived.Text != null && entryCashReceived.Text != "0")
                {
                    decimal passAmount = (objInputMonthlyPass.TotalAmount == null || objInputMonthlyPass.TotalAmount == 0) ? (objInputMonthlyPass.Amount + objInputMonthlyPass.DueAmount) : (objInputMonthlyPass.TotalAmount + objInputMonthlyPass.DueAmount);
                    if (Convert.ToDecimal(entryCashReceived.Text) >= passAmount)
                    {
                        if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                        {
                            existingnfcCardVehcile = dal_CustomerPass.IsValidNFCCard(Convert.ToString(App.Current.Properties["apitoken"]), labelNFCCard.Text, objInputMonthlyPass.CustomerVehicleID.RegistrationNumber);
                            if (existingnfcCardVehcile == string.Empty)
                            {
                                if (App.Current.Properties.ContainsKey("MultiSelectionLocations"))
                                {
                                    List <Location> lstMultiLication = (List <Location>)App.Current.Properties["MultiSelectionLocations"];
                                    if (!string.IsNullOrEmpty(labelNFCCard.Text))
                                    {
                                        objInputMonthlyPass.CardNumber = labelNFCCard.Text;
                                    }
                                    else if (!string.IsNullOrEmpty(labelBARCode.Text))
                                    {
                                        objInputMonthlyPass.CardNumber = labelBARCode.Text;
                                    }

                                    objInputMonthlyPass.BarCode    = labelBARCode.Text;
                                    objInputMonthlyPass.IsMultiLot = true;
                                    VMMultiStationCustomerVehiclePass objvmMultiStations = new VMMultiStationCustomerVehiclePass();
                                    objvmMultiStations.CustomerVehiclePassID = objInputMonthlyPass;
                                    objvmMultiStations.LocationID            = lstMultiLication;
                                    await Task.Run(() =>
                                    {
                                        resultPass = dal_CustomerPass.CreateMultiStationCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objvmMultiStations);
                                    });

                                    if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                                    {
                                        await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok");

                                        await Navigation.PushAsync(new PassPaymentReceiptPage(resultPass));

                                        btnGeneratePass.IsVisible = true;
                                    }
                                    else
                                    {
                                        btnGeneratePass.IsVisible = true;
                                        await DisplayAlert("Alert", "Pass creation failed,Please contact Admin", "Ok");
                                    }
                                }
                                else
                                {
                                    await Task.Run(() =>
                                    {
                                        objInputMonthlyPass.BarCode = labelBARCode.Text;
                                        if (!string.IsNullOrEmpty(labelNFCCard.Text))
                                        {
                                            objInputMonthlyPass.CardNumber = labelNFCCard.Text;
                                        }
                                        else if (!string.IsNullOrEmpty(labelBARCode.Text))
                                        {
                                            objInputMonthlyPass.CardNumber = labelBARCode.Text;
                                        }

                                        resultPass = dal_CustomerPass.CreateCustomerPass(Convert.ToString(App.Current.Properties["apitoken"]), objInputMonthlyPass);
                                    });

                                    if (resultPass != null && resultPass.CustomerVehiclePassID != 0)
                                    {
                                        StopNFCListening();
                                        await DisplayAlert("Alert", "Vehicle Pass created successfully", "Ok");

                                        await Navigation.PushAsync(new PassPaymentReceiptPage(resultPass));

                                        btnGeneratePass.IsVisible = true;
                                    }
                                    else
                                    {
                                        btnGeneratePass.IsVisible = true;
                                        await DisplayAlert("Alert", "Pass creation failed,Please contact Admin", "Ok");
                                    }
                                }
                            }
                            else
                            {
                                ShowLoading(false);
                                btnGeneratePass.IsVisible = true;
                                await DisplayAlert("Alert", "NFC Card already assigned to " + existingnfcCardVehcile + "", "Ok");
                            }
                        }
                    }
                    else
                    {
                        btnGeneratePass.IsVisible = true;
                        await DisplayAlert("Alert", "Please enter valid pass amount.", "Ok");
                    }
                }
                ShowLoading(false);
            }
            catch (Exception ex)
            {
                btnGeneratePass.IsVisible = true;
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "MonthlyPassCashPaymentPage.xaml.cs", "", "BtnGeneratePassReceipt_Clicked");
            }
        }