Ejemplo n.º 1
0
        public void GetViolationVehcileInformation(int customerParkingSlotID)
        {
            if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
            {
                var objresult = dal_Home.GetSelectedParkedVehicleDetails(Convert.ToString(App.Current.Properties["apitoken"]), customerParkingSlotID);
                if (objresult.CustomerParkingSlotID != 0)
                {
                    List <VehicleType> lstVehicleType = new List <VehicleType>();
                    var vehType = new VehicleType()
                    {
                        VehicleTypeID        = 1,
                        VehicleInActiveImage = objresult.CustomerVehicleID.VehicleTypeID.VehicleIcon,
                        VehicleTypeCode      = "2W",
                        VehicleTypeName      = "Two Wheeler"
                    };
                    lstVehicleType.Add(vehType);
                    _vehicleType = new ObservableCollection <VehicleType>(lstVehicleType);

                    if (_vehicleType.Count > 0)
                    {
                        collstviewVehicleTye.ItemsSource = _vehicleType;
                        //collstviewVehicleTye.SelectedItem = _vehicleType[0];
                    }
                }
            }
        }
        private void LoadParkingVehicleDetails(int customerParkingSlotID)
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    objresult = objHome.GetSelectedParkedVehicleDetails(Convert.ToString(App.Current.Properties["apitoken"]), customerParkingSlotID);
                    if (objresult.CustomerParkingSlotID != 0)
                    {
                        labelParkingLocation.Text = objresult.LocationParkingLotID.LocationID.LocationName + "-" + objresult.LocationParkingLotID.LocationParkingLotName;
                        labelBayNumber.Text       = "Bay Number " + objresult.LocationParkingLotID.ParkingBayID.ParkingBayRange;
                        labelCheckInBy.Text       = objresult.CreatedByName + " #" + objresult.UserCode;
                        labelOverstayFrom.Text    = objresult.ExpectedStartTime == null ? null : Convert.ToDateTime(objresult.ExpectedStartTime).ToString("dd MMM yyyy, hh:mm tt");
                        labelOverstayTo.Text      = objresult.ActualEndTime == null?DateTime.Now.ToString("dd MMM yyyy, hh:mm tt") : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy, hh:mm tt");

                        User objloginuser = (User)App.Current.Properties["LoginUser"];
                        if (objloginuser.UserTypeID.UserTypeName.ToUpper() != "Operator".ToUpper())
                        {
                            slFOC.IsVisible = true;
                        }
                        imageVehicleImage.Source       = objresult.CustomerVehicleID.VehicleTypeID.VehicleIcon;
                        labelVehicleDetails.Text       = objresult.CustomerVehicleID.RegistrationNumber;
                        imageParkingFeeImage.Source    = "rupee_black.png";
                        labelParkingFeesDetails.Text   = (objresult.PaidAmount).ToString("N2") + "/-"; //(objresult.Amount+objresult.ExtendAmount).ToString("N2") + "/-";
                        labelPaidDueAmountDetails.Text = "( Parking Amount:" + Math.Abs(objresult.Amount - objresult.PaidDueAmount).ToString("N2") + "/-  " + "Paid Due Amount: " + objresult.PaidDueAmount.ToString("N2") + "/- )";
                        TimeSpan parkingduration = Convert.ToDateTime(objresult.ActualEndTime) - Convert.ToDateTime(objresult.ExpectedStartTime);
                        objresult.Duration = (objresult.Duration == "" || objresult.Duration == string.Empty ? "0" : objresult.Duration);
                        if (objresult.ApplicationTypeID.ApplicationTypeCode == "P")
                        {
                            labelParkingFeesDetails.Text = "Pass Check-In";
                            labelParkingPaymentType.Text = "";
                            imageParkingFeeImage.Source  = "";
                        }
                        else
                        {
                            labelParkingPaymentType.Text = "Paid for " + string.Format(((Math.Abs(parkingduration.Hours) == 0 || Math.Abs(parkingduration.Hours) == 1) ? Convert.ToInt32(objresult.Duration) : parkingduration.Hours) + "hr") + "- By " + objresult.PaymentTypeID.PaymentTypeName;
                        }
                        DateTime?actualendime = objresult.ActualEndTime == null ? DateTime.Now : Convert.ToDateTime(objresult.ActualEndTime);
                        if (actualendime != null)
                        {
                            DateTime CurrentTime = DateTime.Now;
                            TimeSpan t           = CurrentTime - Convert.ToDateTime(actualendime);
                            int      totalHours  = (t.Days > 0 ? t.Hours + (t.Days * 24) : t.Hours);

                            objInputs = new ViolationVehicleFees();
                            objInputs.CustomerParkingSlotId = objresult.CustomerParkingSlotID;
                            objInputs.LocationParkingLotID  = objresult.LocationParkingLotID.LocationParkingLotID;
                            objInputs.ParkingStartTime      = Convert.ToDateTime(actualendime);
                            objInputs.ParkingEndTime        = CurrentTime;
                            objInputs.VehicleTypeCode       = objresult.VehicleTypeID.VehicleTypeCode;
                            if (objresult.ClampFees > 0)
                            {
                                slCheckOut.IsVisible = false;
                                slCash.IsVisible     = true;
                                slEPay.IsVisible     = true;
                                objInputs            = dal_ViolationClamp.GetViolationVehicleCharges(Convert.ToString(App.Current.Properties["apitoken"]), objInputs);
                            }
                            else if ((Convert.ToInt32(t.TotalMinutes) > voilationBasicMinutes))
                            {
                                slCheckOut.IsVisible = false;
                                slCash.IsVisible     = true;
                                slEPay.IsVisible     = true;
                                objInputs            = dal_ViolationClamp.GetViolationVehicleCharges(Convert.ToString(App.Current.Properties["apitoken"]), objInputs);
                            }

                            labelOverstayTimeDetails.Text = "OVERSTAY- " + (objresult.ActualEndTime == null ? "" : Convert.ToDateTime(objresult.ActualEndTime).ToString("hh:mm tt")) + " TO " + DateTime.Now.ToString("hh:mm tt");
                            labelOverstayTime.Text        = string.Format(objInputs.TotalHours + " h : " + t.Minutes + " m");
                            objresult.ExtendAmount        = objInputs.ParkingFee;
                            objresult.Duration            = Convert.ToString(objInputs.TotalHours);
                        }

                        #region Clamp and Warning data loading

                        slVehicleWarning.IsVisible = (objresult.ViolationWarningCount >= 3) ? false : true;

                        checkBoxClampVehicle.IsChecked = objresult.IsClamp;
                        checkBoxClampVehicle.IsChecked = objresult.IsClamp;
                        checkBoxClampVehicle.IsEnabled = !objresult.IsClamp;
                        chkWarning.IsChecked           = objresult.IsWarning;
                        chkWarning.IsEnabled           = !objresult.IsWarning;
                        lblWarningCount.Text           = (objresult.ViolationWarningCount > 3) ? "" : Convert.ToString(objresult.ViolationWarningCount) + " Warning(s) Completed";
                        lblClampFees.Text   = (objresult.ClampFees > 0) ? objresult.ClampFees.ToString("N2") : "0.00";
                        lblParkingFees.Text = objInputs.ParkingFee == 0 ? "0.00" : objInputs.ParkingFee.ToString("N2");
                        lblTotal.Text       = (objresult.ClampFees + objInputs.ParkingFee).ToString("N2");
                        if (objresult.ViolationReasonID.ViolationReasonID != 0)
                        {
                            for (int x = 0; x < lstReasons.Count; x++)
                            {
                                if (lstReasons[x].Reason.ToUpper() == objresult.ViolationReasonID.Reason.ToUpper())
                                {
                                    pickerViolationReason.SelectedIndex = x;
                                    pickerViolationReason.IsEnabled     = false;
                                    checkBoxClampVehicle.IsEnabled      = false;
                                    chkWarning.IsEnabled = false;
                                }
                            }
                        }
                        slPaymentAndExpand.IsVisible = true;
                        frmClampbutton.IsVisible     = false;


                        #endregion
                    }
                    else
                    {
                        DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok");
                    }
                }
            }
            catch (Exception ex)
            {
                ShowLoading(false);
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "OverstayVehicleInformation.xaml.cs", "", "LoadParkingVehicleDetails");
            }
        }
        public void GetViolationVehcileInformation(int customerParkingSlotID)
        {
            try
            {
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    objresult = dal_Home.GetSelectedParkedVehicleDetails(Convert.ToString(App.Current.Properties["apitoken"]), customerParkingSlotID);
                    if (objresult.CustomerParkingSlotID != 0)
                    {
                        User objloginuser = (User)App.Current.Properties["LoginUser"];
                        if (objloginuser.UserTypeID.UserTypeName.ToUpper() != "Operator".ToUpper())
                        {
                            slFOC.IsVisible = true;
                        }
                        if (objresult.VehicleParkingImage != null)
                        {
                            imageViolation.IsVisible = true;
                        }
                        labelParkingLocation.Text = objresult.LocationParkingLotID.LocationID.LocationName + "-" + objresult.LocationParkingLotID.LocationParkingLotName;
                        labelBayNumber.Text       = "Bay Number " + objresult.LocationParkingLotID.ParkingBayID.ParkingBayRange;
                        labelCheckInBy.Text       = objresult.CreatedByName + " #" + objresult.UserCode;
                        labelVehicleDetails.Text  = objresult.CustomerVehicleID.RegistrationNumber;
                        labelValidFrom.Text       = objresult.ExpectedStartTime == null?Convert.ToDateTime(objresult.ActualStartTime).ToString("dd MMM yyyy, hh:mm tt") : Convert.ToDateTime(objresult.ExpectedStartTime).ToString("dd MMM yyyy, hh:mm tt");

                        labelValidTo.Text = objresult.ActualEndTime == null?DateTime.Now.ToString("dd MMM yyyy, hh:mm tt") : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy, hh:mm tt");

                        imageVehicleImage.Source = objresult.CustomerVehicleID.VehicleTypeID.VehicleIcon;

                        DateTime starttime = objresult.ExpectedStartTime == null ? DateTime.Now : Convert.ToDateTime(objresult.ExpectedStartTime);
                        if (starttime != null)
                        {
                            DateTime CurrentTime = DateTime.Now;
                            TimeSpan t           = CurrentTime - starttime;
                            if (t != null)
                            {
                                int totalHours = (t.Days > 0 ? t.Hours + (t.Days * 24) : t.Hours);
                                labelReason.Text = objresult.ViolationReasonID.Reason;
                                ViolationVehicleFees objInputs = new ViolationVehicleFees();
                                objInputs.CustomerParkingSlotId = objresult.CustomerParkingSlotID;
                                objInputs.LocationParkingLotID  = objresult.LocationParkingLotID.LocationParkingLotID;
                                objInputs.ParkingStartTime      = starttime;
                                objInputs.ParkingEndTime        = CurrentTime;
                                objInputs.VehicleTypeCode       = objresult.VehicleTypeID.VehicleTypeCode;

                                //Get Violation Fees Details
                                objInputs               = dal_violation.GetViolationVehicleCharges(Convert.ToString(App.Current.Properties["apitoken"]), objInputs);
                                labelParkingFee.Text    = String.Format("{0:0.#}", objInputs.ParkingFee == 0 ? 0 : objInputs.ParkingFee);
                                objresult.Amount        = objInputs.ParkingFee;
                                objresult.ViolationFees = objInputs.TotalFee == 0 ? 0 : (Convert.ToDecimal(objInputs.TotalFee) - (objInputs.ClampFee));
                                lblWarningCount.Text    = (objresult.ViolationWarningCount > 3) ? "" : Convert.ToString(objresult.ViolationWarningCount) + " Warning(s)";
                                labelClampFee.Text      = String.Format("{0:0.#}", (objresult.IsWarning ? 0 : objresult.ClampFees));
                                labelDueAmount.Text     = String.Format("{0:0.#}", objresult.DueAmount);
                                labelTotalFee.Text      = String.Format("{0:0.#}", (objresult.ViolationFees + objresult.ClampFees + objresult.DueAmount));
                                objresult.Duration      = Convert.ToString(objInputs.TotalHours);
                                labelParkingHours.Text  = "Parked for " + string.Format(objInputs.TotalHours + "h:" + t.Minutes + "m");
                            }
                        }
                    }

                    else
                    {
                        DisplayAlert("Alert", "Vehicle already Checkedout", "Ok");
                    }
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "ViolationVehicleInformation.xaml.cs", "", "GetViolationVehcileInformation");
            }
        }
Ejemplo n.º 4
0
        private void LoadParkedVehicleDetails(int customerParkingLotID)
        {
            try
            {
                string vehicleType = string.Empty;
                if (App.Current.Properties.ContainsKey("LoginUser") && App.Current.Properties.ContainsKey("apitoken"))
                {
                    objresult = objHome.GetSelectedParkedVehicleDetails(Convert.ToString(App.Current.Properties["apitoken"]), customerParkingLotID);
                    if (objresult.CustomerParkingSlotID != 0)
                    {
                        labelParkingLocation.Text = objresult.LocationParkingLotID.LocationID.LocationName + "-" + objresult.LocationParkingLotID.LocationParkingLotName;
                        labelBayNumber.Text       = "Bay Number " + objresult.LocationParkingLotID.ParkingBayID.ParkingBayRange;
                        labelCheckInBy.Text       = objresult.CreatedByName + " #" + objresult.UserCode;

                        labelCheckInFrom.Text       = objresult.ExpectedStartTime == null ? "" : Convert.ToDateTime(objresult.ExpectedStartTime).ToString("dd MMM yyyy, hh:mm tt");
                        labelCheckInTo.Text         = objresult.ActualEndTime == null ? "" : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy, hh:mm tt");
                        imageParkingFeeImage.Source = "rupee_black.png";

                        decimal parkingAmount = objresult.PaidAmount;
                        labelParkingFeesDetails.Text   = parkingAmount.ToString("N2") + "/-";
                        labelPaidDueAmountDetails.Text = "( Parking Amount:" + Math.Abs(objresult.Amount - objresult.PaidDueAmount).ToString("N2") + "/-, " + "Paid Due Amount:" + objresult.PaidDueAmount.ToString("N2") + "/- )";

                        TimeSpan parkingduration = Convert.ToDateTime(objresult.ActualEndTime) - Convert.ToDateTime(objresult.ExpectedStartTime);
                        if (objresult.Duration != "" && objresult.Duration != string.Empty)
                        {
                            var parkhours = ((Math.Abs(parkingduration.Hours) == 0 || Math.Abs(parkingduration.Hours) == 1)) ? Convert.ToInt32(objresult.Duration) : Math.Abs(parkingduration.Hours);
                            labelParkingPaymentType.Text = "Paid for " + string.Format(parkhours + "hr") + " - By " + objresult.PaymentTypeID.PaymentTypeName;
                        }
                        labelVehicleDetails.Text = objresult.CustomerVehicleID.RegistrationNumber;
                        imageVehicleImage.Source = objresult.CustomerVehicleID.VehicleTypeID.VehicleIcon;
                        vehicleType = objresult.CustomerVehicleID.VehicleTypeID.VehicleTypeDisplayName;

                        User objloginuser = (User)App.Current.Properties["LoginUser"];

                        slSpotExpireTimeDisplay.IsVisible = true;
                        slVehicleWarning.IsVisible        = (objresult.ViolationWarningCount >= 3) ? false : true;
                        lblWarningCount.Text      = (objresult.ViolationWarningCount > 3) ? "" : Convert.ToString(objresult.ViolationWarningCount) + " Warning(s) Completed";
                        lblWarningCount.IsVisible = true;
                        imgbtnPrint.IsVisible     = true;
                        if (objloginuser.UserTypeID.UserTypeName.ToUpper() != "Operator".ToUpper())
                        {
                            slFOC.IsVisible = true;
                        }
                        if (objresult.ApplicationTypeID.ApplicationTypeCode == "P")
                        {
                            labelParkingFeesDetails.Text   = "Pass Check-In";
                            labelParkingPaymentType.Text   = "";
                            imageParkingFeeImage.Source    = "";
                            labelPaidDueAmountDetails.Text = "";
                        }
                        if (objresult.StatusID.StatusCode.ToUpper() == "G")
                        {
                            imgbtnPrint.IsVisible             = false;
                            slSpotExpireTimeDisplay.IsVisible = false;
                            slFeesDetails.IsVisible           = false;
                            slFOC.IsVisible                = false;
                            slClamp.IsVisible              = false;
                            chkWarning.IsVisible           = false;
                            slVehicleWarning.IsVisible     = false;
                            labelParkingFeesDetails.Text   = "Free of charge - Government Vehicle";
                            labelParkingPaymentType.Text   = "";
                            labelPaidDueAmountDetails.Text = "";
                            imgGovPhone.Source             = "phone.png";
                            imgGovPhone.HeightRequest      = 20;
                            labelPhoneNumber.Text          = objresult.CustomerID.PhoneNumber;
                            lblWarningCount.IsVisible      = false;
                            if (objresult.GovernmentVehicleImage != null)
                            {
                                imageGovernmentVehicle.Source        = ImageSource.FromStream(() => new MemoryStream(ByteArrayCompressionUtility.Decompress(objresult.GovernmentVehicleImage)));
                                imageGovernmentVehicle.HeightRequest = 150;
                                labelGovImageLocation.Text           = objresult.VehicleImageLottitude + "," + objresult.VehicleImageLongitude + Environment.NewLine + Convert.ToDateTime(objresult.CreatedOn).ToString("dd MMM yyyy");
                            }

                            else
                            {
                                imageGovernmentVehicle.IsVisible     = false;
                                imageGovernmentVehicle.HeightRequest = 0;
                            }
                        }
                        if (objresult.ActualEndTime != null)
                        {
                            DateTime exptendime  = Convert.ToDateTime(objresult.ActualEndTime);
                            DateTime CurrentTime = DateTime.Now;
                            TimeSpan t           = CurrentTime - exptendime;
                            labelSpotExpiresTime.Text = string.Format("{0:%h} h : {0:%m} m", t);
                        }
                        #region Clamp and Warning data loading


                        checkBoxClampVehicle.IsChecked = objresult.IsClamp;
                        checkBoxClampVehicle.IsEnabled = !objresult.IsClamp;
                        chkWarning.IsChecked           = objresult.IsWarning;
                        chkWarning.IsEnabled           = !objresult.IsWarning;
                        slCash.IsVisible    = (objresult.ClampFees > 0) ? true : false;
                        slEPay.IsVisible    = (objresult.ClampFees > 0) ? true : false;
                        lblClampFees.Text   = (objresult.ClampFees > 0) ? objresult.ClampFees.ToString("N2") : "0.00";
                        lblParkingFees.Text = "0.00";
                        lblTotal.Text       = objresult.ClampFees.ToString("N2");
                        if (objresult.StatusID.StatusCode.ToUpper() == "G")
                        {
                            slCheckOut.IsVisible = false;
                            if (objloginuser.UserTypeID.UserTypeName.ToUpper() != "Operator".ToUpper())
                            {
                                slCheckOut.IsVisible  = true;
                                imgbtnPrint.IsVisible = true;
                            }
                        }
                        else
                        {
                            slCheckOut.IsVisible = (objresult.ClampFees > 0) ? false : true;
                        }
                        if (objresult.ViolationReasonID.ViolationReasonID != 0)
                        {
                            for (int x = 0; x < lstReasons.Count; x++)
                            {
                                if (lstReasons[x].ViolationReasonID == objresult.ViolationReasonID.ViolationReasonID)
                                {
                                    pickerViolationReason.SelectedIndex = x;
                                    pickerViolationReason.IsEnabled     = false;
                                    checkBoxClampVehicle.IsEnabled      = false;
                                    chkWarning.IsEnabled = false;
                                }
                            }
                            slClampReason.IsVisible = true;
                        }
                        frmClampbutton.IsVisible     = false;
                        slPaymentAndExpand.IsVisible = true;
                        #endregion
                        try
                        {
                            if (receiptlines != null && receiptlines.Length > 0)
                            {
                                receiptlines[0]  = "\x1B\x21\x08" + "          " + "HMRL PARKING" + "\x1B\x21\x00" + "\n";
                                receiptlines[1]  = "\x1B\x21\x01" + "          " + objresult.LocationParkingLotID.LocationID.LocationName + objresult.LocationParkingLotID.LocationParkingLotName + "\x1B\x21\x00\n";
                                receiptlines[2]  = "" + "\n";
                                receiptlines[3]  = "\x1B\x21\x08" + vehicleType + ":" + objresult.CustomerVehicleID.RegistrationNumber + "\x1B\x21\x00\n";
                                receiptlines[4]  = "\x1B\x21\x01" + (objresult.ActualStartTime == null ? "" : "In:" + Convert.ToDateTime(objresult.ActualStartTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00" + "\n";
                                receiptlines[5]  = "\x1B\x21\x01" + "Paid: Rs" + objresult.Amount.ToString("N2") + "(Up to " + objresult.Duration + " hours)" + "\x1B\x21\x00\n";
                                receiptlines[6]  = "\x1B\x21\x01" + "Valid Till:" + (objresult.ActualEndTime == null ? "" : Convert.ToDateTime(objresult.ActualEndTime).ToString("dd MMM yyyy,hh:mm tt")) + "\x1B\x21\x00\n";
                                receiptlines[7]  = "\x1B\x21\x01" + "Parked at: (Bays)" + objresult.LocationParkingLotID.ParkingBayID.ParkingBayRange + "\x1B\x21\x00\n";
                                receiptlines[8]  = "\x1B\x21\x06" + "Operator Id :" + objresult.UserCode + "\x1B\x21\x00\n";
                                receiptlines[9]  = "\x1B\x21\x01" + "(Supervisor Mobile:" + objresult.SuperVisorID.PhoneNumber + ")" + "\x1B\x21\x00\n";
                                receiptlines[10] = "\x1B\x21\x06" + "Security available " + objresult.LocationParkingLotID.LotOpenTime + "-" + objresult.LocationParkingLotID.LotCloseTime + "\x1B\x21\x00\n";
                                receiptlines[11] = "\x1B\x21\x01" + "We are not responsible for your valuable items like laptop,       wallet,helmet etc." + "\x1B\x21\x00\n";
                                receiptlines[12] = "\x1B\x21\x06" + "GST Number 36AACFZ1015E1ZL" + "\x1B\x21\x00\n";
                                receiptlines[13] = "\x1B\x21\x06" + "Amount includes 18% GST" + "\x1B\x21\x00\n";
                                receiptlines[14] = "" + "\n";
                                receiptlines[15] = "" + "\n";
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                        objresult.CreatedBy = objloginuser.UserID;
                    }
                    else
                    {
                        DisplayAlert("Alert", "Vehicle details unvailable,Please contact Admin", "Ok");
                    }
                }
            }
            catch (Exception ex)
            {
                dal_Exceptionlog.InsertException(Convert.ToString(App.Current.Properties["apitoken"]), "Operator App", ex.Message, "PassCheckInVehicleInformation.xaml.cs", "", "LoadParkedVehicleDetails");
            }
        }