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);
        }
Exemple #2
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);
        }
        public SessionHomeReceipt(CustomerParkingSlotDetails customerParkingSlotDetails)
        {
            this.IsBusy = true;
            InitializeComponent();
            dal_Customer           = new DALCustomer();
            dal_LocationParkingLot = new DALLocationParkingLots();

            if (customerParkingSlotDetails != null)
            {
                objCustomerParkingSlotDetails = customerParkingSlotDetails;
                lblLotName.Text = customerParkingSlotDetails.ApplicationTypeID == Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"]) ? customerParkingSlotDetails.LocationParkingLotName + " - PASS CHECK IN" : customerParkingSlotDetails.LocationParkingLotName;
                lblAddress.Text = customerParkingSlotDetails.Address;
                lblFrom.Text    = customerParkingSlotDetails.From.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                lblTo.Text      = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                string fromdatesplit = lblFrom.Text.Split(',')[0];
                string fromtimesplit = lblFrom.Text.Split(',')[1];
                lblFrom.Text     = fromdatesplit;
                lblFromTime.Text = fromtimesplit;
                string toDatesplit = lblTo.Text.Split(',')[0];
                string toTimesplit = lblTo.Text.Split(',')[1];
                lblTo.Text                 = toDatesplit;
                lblToTime.Text             = toTimesplit;
                lblRegistrationNumber.Text = customerParkingSlotDetails.RegistrationNumber;
                lblModel.Text              = customerParkingSlotDetails.Model;

                App.Current.Properties["CustomerParkingSlotID"] = customerParkingSlotDetails.CustomerParkingSlotID;
                App.Current.Properties["UserName"]     = customerParkingSlotDetails.CustomerName;
                App.Current.Properties["PhoneNumber"]  = customerParkingSlotDetails.CustomerPhoneNumber;
                App.Current.Properties["Email"]        = customerParkingSlotDetails.CustomerEmail;
                App.Current.Properties["CustomerID"]   = customerParkingSlotDetails.CustomerID;
                App.Current.Properties["ProfileImage"] = customerParkingSlotDetails.CustomerProfileImage;

                if (customerParkingSlotDetails.ApplicationTypeID == Convert.ToInt32(App.Current.Properties["PassApplicationTypeID"]))
                {
                    stkParkingFee.IsVisible  = false;
                    lblLotName.HeightRequest = 45;
                }
                else
                {
                    stkParkingFee.IsVisible = true;
                    // lblLotName.HeightRequest = 10;
                    lblParkingFee.Text = customerParkingSlotDetails.PaidAmount;

                    TimeSpan t_duration = (customerParkingSlotDetails.To - customerParkingSlotDetails.From);
                    int      d_duration = Convert.ToInt32(Math.Round(t_duration.TotalHours));

                    lblPaymentType.Text = " Paid for " + d_duration + " hour (Via " + customerParkingSlotDetails.PaymentTypeName + ")";
                }

                OrderID.Text      = "ID : #" + customerParkingSlotDetails.CustomerParkingSlotID;
                imgVehicle.Source = customerParkingSlotDetails.VehicleImage;
                currentTime       = DateTime.Now;
                ActualEndTime     = Convert.ToDateTime(customerParkingSlotDetails.To);

                DisabledParking.Source = customerParkingSlotDetails.DisabledParking;
                EvCharging.Source      = customerParkingSlotDetails.EvCharging;
                CoveredParking.Source  = customerParkingSlotDetails.CoveredParking;
                BikeWash.Source        = customerParkingSlotDetails.BikeWash;
                CarWash.Source         = customerParkingSlotDetails.CarWash;
                Mechanic.Source        = customerParkingSlotDetails.Mechanic;

                lblWarning.Text     = "'" + Convert.ToString(customerParkingSlotDetails.ViolationWarningCount) + "' Warning(s) Completed";
                lblOverStayFee.Text = customerParkingSlotDetails.Price == 0 ? "0" : Convert.ToString(decimal.Truncate(customerParkingSlotDetails.Price));
                lblClampFee.Text    = customerParkingSlotDetails.ClampFee == 0 ? "0" : Convert.ToString(decimal.Truncate(customerParkingSlotDetails.ClampFee));
                lblTotal.Text       = Convert.ToDecimal(customerParkingSlotDetails.Price) + Convert.ToDecimal(customerParkingSlotDetails.ClampFee) == 0 ? "0" :
                                      Convert.ToString(decimal.Truncate((Convert.ToDecimal(customerParkingSlotDetails.Price) + Convert.ToDecimal(customerParkingSlotDetails.ClampFee))));
                lblClampReason.Text = customerParkingSlotDetails.ClampReason;

                if (customerParkingSlotDetails.IsClamp)
                {
                    stkSupervisor.IsVisible   = true;
                    stkClampWarning.IsVisible = true;
                    IsClamp = customerParkingSlotDetails.IsClamp;
                    SupervisorPhoneNumber = customerParkingSlotDetails.PhoneNumber;
                    lblSupervisor.Text    = customerParkingSlotDetails.SupervisorName;
                    lblPhoneNumber.Text   = customerParkingSlotDetails.PhoneNumber;
                }

                if (ActualEndTime < currentTime)
                {
                    lblSpotExpiry.Text     = "Spot Expired At";
                    lblExpiryTime.Text     = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                    lblExpiryTime.FontSize = 20;
                }
                else
                {
                    TimeSpan duration      = ActualEndTime - currentTime;
                    long     durationTicks = Math.Abs(duration.Ticks / TimeSpan.TicksPerMillisecond);
                    long     hours         = durationTicks / (1000 * 60 * 60);
                    long     minutes       = (durationTicks - (hours * 60 * 60 * 1000)) / (1000 * 60);

                    lblExpiryTime.Text = hours.ToString("00 h") + " : " + minutes.ToString("00 m");
                }

                Device.StartTimer(TimeSpan.FromSeconds(60), (Func <bool>)(() =>
                {
                    currentTime = DateTime.Now;
                    if (ActualEndTime < currentTime)
                    {
                        lblSpotExpiry.Text     = "Spot Expired At";
                        lblExpiryTime.Text     = customerParkingSlotDetails.To.ToString("d MMM yyyy, hh:mm tt", CultureInfo.CreateSpecificCulture("en-US"));
                        lblExpiryTime.FontSize = 20;
                        return(false);
                    }
                    else
                    {
                        TimeSpan duration  = ActualEndTime - currentTime;
                        long durationTicks = Math.Abs(duration.Ticks / TimeSpan.TicksPerMillisecond);
                        long hours         = durationTicks / (1000 * 60 * 60);
                        long minutes       = (durationTicks - (hours * 60 * 60 * 1000)) / (1000 * 60);

                        lblExpiryTime.Text = hours.ToString("00 h") + " : " + minutes.ToString("00 m");
                    }
                    return(true); // True = Repeat again, False = Stop the timer
                }));

                GenerateAPIToken();
                this.IsBusy = false;
            }
        }