示例#1
0
        public bool ValidateRegistrationNumber()
        {
            bool result = false;

            if (App.Current.Properties.ContainsKey("apitoken"))
            {
                CustomerVehicle obj_CustomerVehicle = new CustomerVehicle();
                obj_CustomerVehicle.CustomerID              = CustomerID;
                obj_CustomerVehicle.CustomerVehicleID       = 0;
                obj_CustomerVehicle.CustomerVehicleMapperID = 0;
                obj_CustomerVehicle.RegistrationNumber      = txtRegNumber.Text.Trim();

                var json    = JsonConvert.SerializeObject(obj_CustomerVehicle);
                var content = new StringContent(json, Encoding.UTF8, "application/json");
                dal_Vehicle = new DALVehicle();
                OCustomerVehicle resultObj = dal_Vehicle.ValidateRegistrationNumber(Convert.ToString(App.Current.Properties["apitoken"]), obj_CustomerVehicle);

                if (resultObj.CustomerVehicleID != 0)
                {
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
 public MyPasses()
 {
     InitializeComponent();
     ShowLoading(true);
     dal_Vehicle = new DALVehicle();
     dal_Pass    = new DALPass();
     GetListOfPassesByCustomerID();
     ShowLoading(false);
 }
示例#3
0
 public MyVehicles()
 {
     InitializeComponent();
     ShowLoading(true);
     dal_Vehicle = new DALVehicle();
     GetListOfCustomerVehicleWithType(VehicleTypeCodes.TwoWheelerTypeID);
     lblmyvehicle.Text = "My Bikes";
     VehicleTypeID     = VehicleTypeCodes.TwoWheelerTypeID;
     ShowLoading(false);
 }
        public ExtendSession(CustomerParkingSlotDetails customerParkingSlotDetails)
        {
            InitializeComponent();
            ShowLoading(true);
            objCustomerParkingSlotDetails = customerParkingSlotDetails;
            VehicleTypeID          = customerParkingSlotDetails.VehicleTypeID;
            CustomerID             = customerParkingSlotDetails.CustomerID;
            CustomerVehicleID      = customerParkingSlotDetails.CustomerVehicleID;
            CustomerParkingSlotID  = customerParkingSlotDetails.CustomerParkingSlotID;
            LocationParkingLotID   = customerParkingSlotDetails.LocationParkingLotID;
            LocationParkingLotName = customerParkingSlotDetails.LocationParkingLotName;
            dal_LocationParkingLot = new DALLocationParkingLots();
            dal_Customer           = new DALCustomer();
            dal_Vehicle            = new DALVehicle();
            dal_Pass = new DALPass();

            objCustomerParkingSlotDetails.LotOpenCloseTime = ("(" +
                                                              objCustomerParkingSlotDetails.LotOpeningTime + " - " +
                                                              objCustomerParkingSlotDetails.LotClosingTime + ")").ToLower();

            if (VehicleTypeID == Convert.ToInt32(VehicleTypeCodes.TwoWheelerTypeID))
            {
                imgVehicle.Source = "resource://InstaConsumer.Resources." + VehicleTypeCodes.TwoWheelerGreenSpots;
            }
            else if (VehicleTypeID == Convert.ToInt32(VehicleTypeCodes.FourWheelerTypeID))
            {
                imgVehicle.Source = "resource://InstaConsumer.Resources." + VehicleTypeCodes.FourWheelerGreenSpots;
            }

            this.BindingContext = objCustomerParkingSlotDetails;

            VehicleTypeID          = customerParkingSlotDetails.VehicleTypeID;
            CustomerID             = customerParkingSlotDetails.CustomerID;
            CustomerVehicleID      = customerParkingSlotDetails.CustomerVehicleID;
            RegistrationNumber     = customerParkingSlotDetails.RegistrationNumber;
            CustomerParkingSlotID  = customerParkingSlotDetails.CustomerParkingSlotID;
            LocationID             = customerParkingSlotDetails.LocationID;
            LocationParkingLotID   = customerParkingSlotDetails.LocationParkingLotID;
            LocationParkingLotName = customerParkingSlotDetails.LocationParkingLotName;
            dal_LocationParkingLot = new DALLocationParkingLots();
            dal_Customer           = new DALCustomer();
            dal_Vehicle            = new DALVehicle();
            dal_Pass = new DALPass();

            ParkingBayRange = customerParkingSlotDetails.ParkingBayRange;
            ParkingBayID    = customerParkingSlotDetails.ParkingBayID;
            Duration        = 1;
            IsFullDay       = false;
            ShowLoading(false);
        }
 public VerifyOTP(string phoneNumber, int customerID, string newOrExisting, string name)
 {
     InitializeComponent();
     ShowLoading(true);
     dal_Vehicle         = new DALVehicle();
     PhoneNumber         = phoneNumber;
     CustomerID          = customerID;
     NewORExisting       = newOrExisting;
     Name                = name;
     lblDisplayText.Text = "Please enter OTP sent to +91 " + phoneNumber;
     SendOTP(phoneNumber, customerID);
     InsertOTP();
     ShowLoading(false);
 }
示例#6
0
        public BuyAPass(OCustomerVehicle obj_OCustomerVehicle)
        {
            InitializeComponent();
            ShowLoading(true);
            dal_Pass                = new DALPass();
            dal_Vehicle             = new DALVehicle();
            dal_Customer            = new DALCustomer();
            dal_LocationParkingLots = new DALLocationParkingLots();

            objOCustomerVehicle = obj_OCustomerVehicle;
            VehicleTypeID       = obj_OCustomerVehicle.VehicleTypeID;
            LocationID          = obj_OCustomerVehicle.LocationID;
            CustomerID          = obj_OCustomerVehicle.CustomerID;

            ShowLoading(false);
        }
示例#7
0
        //Floating Lable Code End

        public UpdateVehicle(OCustomerVehicle customerVehicle)
        {
            InitializeComponent();
            ShowLoading(true);
            dal_Vehicle          = new DALVehicle();
            dal_Customer         = new DALCustomer();
            txtMake.Text         = customerVehicle.Make;
            txtModel.Text        = customerVehicle.Model;
            txtColor.Text        = customerVehicle.Color;
            txtRegNumber.Text    = customerVehicle.RegistrationNumber;
            swtPrimary.IsToggled = customerVehicle.IsPrimaryVehicle;
            swtActive.IsToggled  = customerVehicle.IsActive;

            CustomerVehicleMapperID = customerVehicle.CustomerVehicleMapperID;
            CustomerVehicleID       = customerVehicle.CustomerVehicleID;
            VehicleTypeID           = customerVehicle.VehicleTypeID;
            CustomerID      = customerVehicle.CustomerID;
            VehicleTypeCode = customerVehicle.VehicleTypeCode;

            if (customerVehicle.VehicleTypeCode == "2W")
            {
                svgTwo.Source   = "resource://InstaConsumer.Resources.blue_circle_bike.svg";
                svgFour.Source  = "resource://InstaConsumer.Resources.grey_circle_car.svg";
                VehicleTypeCode = VehicleTypeCodes.TwoWheeler;
            }
            else if (customerVehicle.VehicleTypeCode == "4W")
            {
                svgTwo.Source   = "resource://InstaConsumer.Resources.grey_circle_bike.svg";
                svgFour.Source  = "resource://InstaConsumer.Resources.blue_circle_car.svg";
                VehicleTypeCode = VehicleTypeCodes.FourWheeler;
            }

            ShowLoading(false);

            //Floating Lable Code Start
            lblMake.TranslationX = lblModel.TranslationX = lblColor.TranslationX = lblRegNumber.TranslationX = 10;
            lblMake.FontSize     = lblModel.FontSize = lblColor.FontSize = lblRegNumber.FontSize = _placeholderFontSize;
            lblMake.TextColor    = lblModel.TextColor = lblColor.TextColor = lblRegNumber.TextColor = Color.Gray;

            if (string.IsNullOrEmpty(txtMake.Text))
            {
                TransitionToPlaceholder(true);
            }
            else
            {
                TransitionToTitle(true);
            }
            if (string.IsNullOrEmpty(txtModel.Text))
            {
                TransitionToPlaceholder_Model(true);
            }
            else
            {
                TransitionToTitle_Model(true);
            }
            if (string.IsNullOrEmpty(txtColor.Text))
            {
                TransitionToPlaceholder_Color(true);
            }
            else
            {
                TransitionToTitle_Color(true);
            }
            if (string.IsNullOrEmpty(txtRegNumber.Text))
            {
                TransitionToPlaceholder_RegNumber(true);
            }
            else
            {
                TransitionToTitle_RegNumber(true);
            }

            txtMake.Focus();
            //Floating Lable Code End
        }
示例#8
0
        private async void btn_AddVehicleClicked(object sender, EventArgs e)
        {
            IsOnline = VerifyInternet();

            if (IsOnline)
            {
                ShowLoading(true);
                btnAddVehicle.IsVisible = false;

                if (txtMake.Text == "" || txtMake.Text == null)
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter Brand of your Vehicle", "Ok");
                    return;
                }

                var regexName = new Regex("^[a-zA-Z ]*$");
                if (!regexName.IsMatch(txtMake.Text.Trim()))
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter only alphabets for Vehicle Brand", "Ok");
                    return;
                }

                if (txtModel.Text == "" || txtModel.Text == null)
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter Model of your Vehicle", "Ok");
                    return;
                }

                regexName = new Regex("^[a-zA-Z0-9 ]*$");
                if (!regexName.IsMatch(txtModel.Text.Trim()))
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please do not enter special characters for Vehicle Model", "Ok");
                    return;
                }

                if (txtColor.Text == "" || txtColor.Text == null)
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter Color of your Vehicle", "Ok");
                    return;
                }

                regexName = new Regex("^[a-zA-Z ]*$");
                if (!regexName.IsMatch(txtColor.Text.Trim()))
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please do not enter special characters for Vehicle Color", "Ok");
                    return;
                }

                if (txtRegNumber.Text == "" || txtRegNumber.Text == null)
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter Registration Number of your Vehicle", "Ok");
                    return;
                }

                regexName = new Regex("^[a-zA-Z0-9]*$");
                if (!regexName.IsMatch(txtRegNumber.Text.Trim()))
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please enter only alphabets and numbers in Registration Number", "Ok");
                    return;
                }

                if (ValidRegistrationNumber(txtRegNumber.Text.Trim()))
                {
                    if (ValidateRegistrationNumber())
                    {
                        btnAddVehicle.IsVisible = true;
                        ShowLoading(false);
                        DisplayAlert("", "This Registration Number already exists!", "Ok");
                    }
                    else
                    {
                        CustomerVehicle objCustomerVehicle = new CustomerVehicle();
                        objCustomerVehicle.CustomerID         = CustomerID;
                        objCustomerVehicle.VehicleTypeCode    = VehicleTypeCode;
                        objCustomerVehicle.Make               = txtMake.Text.Trim();
                        objCustomerVehicle.Model              = txtModel.Text.Trim();
                        objCustomerVehicle.Color              = txtColor.Text.Trim();
                        objCustomerVehicle.RegistrationNumber = txtRegNumber.Text.Trim();
                        objCustomerVehicle.IsPrimaryVehicle   = swtPrimary.IsToggled;

                        swtActive.IsToggled         = true;
                        objCustomerVehicle.IsActive = swtActive.IsToggled;

                        if (App.Current.Properties.ContainsKey("apitoken"))
                        {
                            var json    = JsonConvert.SerializeObject(objCustomerVehicle);
                            var content = new StringContent(json, Encoding.UTF8, "application/json");
                            dal_Vehicle = new DALVehicle();
                            OCustomerVehicle resultObj = new OCustomerVehicle();

                            await Task.Run(() =>
                            {
                                resultObj = dal_Vehicle.InsertCustomerVehicle(Convert.ToString(App.Current.Properties["apitoken"]), objCustomerVehicle);
                            });

                            if (resultObj.CustomerVehicleID != 0)
                            {
                                var location = await Geolocation.GetLastKnownLocationAsync();

                                if (location != null)
                                {
                                    Latitude  = (decimal)location.Latitude;
                                    Longitude = (decimal)location.Longitude;
                                }
                                else
                                {
                                    btnAddVehicle.IsVisible = true;
                                    ShowLoading(false);
                                    DisplayAlert("", "Please turn on device location", "Ok");
                                    return;
                                }

                                App.Current.Properties["Vehicle"]            = true;
                                App.Current.Properties["VehicleTypeID"]      = resultObj.VehicleTypeID;
                                App.Current.Properties["CustomerID"]         = CustomerID;
                                App.Current.Properties["CustomerVehicleID"]  = resultObj.CustomerVehicleID;
                                App.Current.Properties["RegistrationNumber"] = objCustomerVehicle.RegistrationNumber;
                                btnAddVehicle.IsVisible = true;
                                await Application.Current.SavePropertiesAsync();

                                //await Navigation.PushAsync(new MasterPage(objLocationParkingLotFilter));
                                await Navigation.PushAsync(new Home(null, CustomerID));

                                ShowLoading(false);
                            }
                        }
                    }
                }
                else
                {
                    btnAddVehicle.IsVisible = true;
                    ShowLoading(false);
                    DisplayAlert("", "Please provide valid vehicle Registration Number ", "Ok");
                }
            }
            else
            {
                DisplayAlert("", "Please check your network connectivity", "Ok");
                return;
            }
        }