Пример #1
0
        public async Task GetSelectedVehicleDetails(CustomerVehicle selectedVehicle)
        {
            try
            {
                string IsPassInOverstay = string.Empty;
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    User    objloginuser = (User)App.Current.Properties["LoginUser"];
                    DALPass dal_Pass     = new DALPass();

                    objResultCustomerVehiclePass = dal_Pass.GetCustomerVehicleDetailsByVehicle(Convert.ToString(App.Current.Properties["apitoken"]), selectedVehicle);
                    if (objResultCustomerVehiclePass != null)
                    {
                        IsPassInOverstay = VerifyPassVehicleCheckInStatus(objResultCustomerVehiclePass.CustomerVehicleID.VehicleTypeID.VehicleTypeCode, objResultCustomerVehiclePass.CustomerVehicleID.RegistrationNumber);
                        if (IsPassInOverstay == string.Empty)
                        {
                            entryCustomerName.Text       = objResultCustomerVehiclePass.CustomerVehicleID.CustomerID.Name;
                            entryPhoneNumber.Text        = objResultCustomerVehiclePass.CustomerVehicleID.CustomerID.PhoneNumber;
                            entryRegistrationNumber.Text = objResultCustomerVehiclePass.CustomerVehicleID.RegistrationNumber;
                            labelNFCCardAmount.Text      = objResultCustomerVehiclePass.PassPriceID.CardPrice == 0 ? "0.00" : " ( ₹ " + objResultCustomerVehiclePass.PassPriceID.CardPrice.ToString("N2") + " EXTRA )";
                            BtnChoosePass.IsEnabled      = true;

                            // Verify Customer Vehicle Type
                            imgCustomerVehcileType.Source = objResultCustomerVehiclePass.CustomerVehicleID.VehicleTypeID.VehicleIcon;
                            if (objResultCustomerVehiclePass.PassPriceID.PassTypeID.PassTypeCode.ToUpper() == "WP" || objResultCustomerVehiclePass.PassPriceID.PassTypeID.PassTypeCode.ToUpper() == "EP")
                            {
                                slNFC.IsVisible = false;
                            }
                            else
                            {
                                slNFC.IsVisible = true;
                            }
                            if (objResultCustomerVehiclePass.PassPriceID.PassTypeID.PassTypeCode.ToUpper() == "EP")
                            {
                                string alertmsg = objResultCustomerVehiclePass.CustomerVehicleID.RegistrationNumber + ": " + objResultCustomerVehiclePass.PassPriceID.PassTypeID.PassTypeName + "Unable to renew,Please contact Admin";
                                await DisplayAlert("Alert", alertmsg, "Ok");

                                BtnChoosePass.IsEnabled = false;
                            }
                        }
                        else
                        {
                            await DisplayAlert("Alert", "Please clear due amount to Buy/Renew Pass", "Ok");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("", "" + ex, "Ok");
            }
        }
        public async Task GetSelectedVehicleDetails(CustomerVehicle selectedVehicle)
        {
            try
            {
                ShowLoading(true);
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    User objloginuser = (User)App.Current.Properties["LoginUser"];
                    dal_Pass = new DALPass();
                    await Task.Run(() =>
                    {
                        objResultCustomerVehiclePass = dal_Pass.GetCustomerVehicleDetailsByVehicle(Convert.ToString(App.Current.Properties["apitoken"]), selectedVehicle);
                    });

                    if (objResultCustomerVehiclePass != null && objResultCustomerVehiclePass.CustomerVehiclePassID != 0)
                    {
                        entryCustomerName.Text       = objResultCustomerVehiclePass.CustomerVehicleID.CustomerID.Name;
                        entryPhoneNumber.Text        = objResultCustomerVehiclePass.CustomerVehicleID.CustomerID.PhoneNumber;
                        entryRegistrationNumber.Text = objResultCustomerVehiclePass.CustomerVehicleID.RegistrationNumber;

                        // Verify Customer Vehicle Type
                        imgCustomerVehcileType.Source = objResultCustomerVehiclePass.CustomerVehicleID.VehicleTypeID.VehicleIcon;
                        if (objResultCustomerVehiclePass.PassPriceID.PassTypeID.PassTypeCode.ToUpper() == "WP")
                        {
                            slContinue.IsVisible             = false;
                            stlayoutNFCCardPayment.IsVisible = false;
                            await DisplayAlert("Alert", "NFC card not valid  for this Pass type.", "Ok");
                        }
                        if (objResultCustomerVehiclePass.CardNumber != null && objResultCustomerVehiclePass.CardNumber != "")
                        {
                            await DisplayAlert("Alert", "This vehicle already has NFC card.", "Ok");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Alert", "No records found,Please contact Admin.", "Ok");
                    }
                }
                ShowLoading(false);
            }
            catch (Exception ex)
            {
                ShowLoading(false);
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ActivatePassPage.xaml.cs", "", "GetSelectedVehicleDetails)");
            }
        }