private void BindData()
        {
            if (DetailedEntity.Entity.Ped == null || !DetailedEntity.Entity.Ped.IsValid())
            {
                return;
            }
            if (!BindNeeded)
            {
                return;
            }
            BindNeeded = false;
            if (DetailedEntity.Entity.IsLicenseValid)
            {
                labeled_license_status.Component.Text = "Valid";
            }
            else
            {
                labeled_license_status.Component.Warn(DetailedEntity.Entity.LicenseStateString);
            }


            if (DetailedEntity.Entity.IsAgent)
            {
                labeled_owner_alert.Component.Warn("Individual is a federal agent");
                labeled_owner_alert.Show();
            }
            else if (DetailedEntity.Entity.IsCop)
            {
                labeled_owner_alert.Component.Warn("Individual is a police officer");
                labeled_owner_alert.Show();
            }
            else
            {
                labeled_owner_alert.Hide();
            }

            if (!String.IsNullOrWhiteSpace(DetailedEntity.Entity.VehicleAlert))
            {
                labeled_alpr.Component.SetText(DetailedEntity.Entity.VehicleAlert);
                labeled_alpr.Show();
            }
            else
            {
                labeled_alpr.Hide();
            }

            cb_action.AddItem("Select One", "Placeholder", QuickActions.PLACEHOLDER);
            cb_action.AddItem("Blip (30 sec)", "Blip", QuickActions.BLIP_VEHICLE);
            cb_action.AddItem("Create Traffic Citation", "TrafficCitation", QuickActions.CREATE_TRAFFIC_CITATION);
            cb_action.AddItem("Create Arrest Report", "ArrestReport", QuickActions.CREATE_ARREST_REPORT_FOR_DRIVER);

            labeled_age.Component.Text          = DetailedEntity.Entity.AgeString;
            labeled_first_name.Component.Text   = DetailedEntity.Entity.FirstName;
            labeled_last_name.Component.Text    = DetailedEntity.Entity.LastName;
            labeled_home_address.Component.Text = Owner.GetHomeAddress();
            labeled_dob.Component.Text          = DetailedEntity.Entity.DOBString;
            if (DetailedEntity.Entity.IsWanted)
            {
                labeled_wanted_status.Component.Warn("Wanted");
            }
            else
            {
                labeled_wanted_status.Component.SetText("None");
            }
            labeled_times_stopped.Component.Text = DetailedEntity.Entity.TimesStopped.ToString();

            labeled_vehicle_model.Component.Text   = Vehicle.Model.Name;
            labeled_vehicle_license.Component.Text = Vehicle.LicensePlate;
            if (ComputerPlusEntity.PersonaType == PersonaTypes.BPS)
            {
                if (BritishPolicingFunctions.IsVehicleRegistered(DetailedEntity.Entity.RawVehiclePersona))
                {
                    labeled_vehicle_registration_status.Component.SetText("No");
                }
                else
                {
                    labeled_vehicle_registration_status.Component.Warn("Yes");
                }
                Function.LogDebug("set labeled_vehicle_registration_status");

                if (BritishPolicingFunctions.IsVehicleInsured(DetailedEntity.Entity.RawVehiclePersona))
                {
                    labeled_vehicle_insurance_status.Component.SetText("Yes");
                }
                else
                {
                    labeled_vehicle_insurance_status.Component.Warn("No");
                }
                Function.LogDebug("set labeled_vehicle_insurance_status");

                if (BritishPolicingFunctions.DoesVehicleHaveMOT(DetailedEntity.Entity.RawVehiclePersona))
                {
                    labeled_vehicle_extra_1.Component.SetText("Yes");
                }
                else
                {
                    labeled_vehicle_extra_1.Component.Warn("No");
                }
                Function.LogDebug("set labeled_vehicle_extra_1");

                if (BritishPolicingFunctions.DoesVehicleHaveSORN(DetailedEntity.Entity.RawVehiclePersona))
                {
                    labeled_vehicle_extra_2.Component.SetText("Yes");
                }
                else
                {
                    labeled_vehicle_extra_2.Component.Warn("No");
                }
                Function.LogDebug("set labeled_vehicle_extra_2");

                if (BritishPolicingFunctions.IsPedInsuredToDriveVehicle(DetailedEntity.Entity.RawPedPersona, DetailedEntity.Entity.RawVehiclePersona))
                {
                    labeled_ped_extra_1.Component.SetText("Yes");
                }
                else
                {
                    labeled_ped_extra_1.Component.Warn("No");
                }

                Function.LogDebug("set labeled_ped_extra_1");
            }
            else if (Function.IsTrafficPolicerRunning())
            {
                var insuranceStatus = TrafficPolicerFunction.GetVehicleInsuranceStatus(Vehicle);
                if (insuranceStatus == EVehicleStatus.Valid)
                {
                    labeled_vehicle_insurance_status.Component.SetText("Valid");
                }
                else if (insuranceStatus == EVehicleStatus.Expired)
                {
                    labeled_vehicle_insurance_status.Component.Warn("Expired");
                }
                else
                {
                    labeled_vehicle_insurance_status.Component.Warn("None");
                }

                var registrationStatus = TrafficPolicerFunction.GetVehicleRegistrationStatus(Vehicle);
                if (registrationStatus == EVehicleStatus.Valid)
                {
                    labeled_vehicle_registration_status.Component.SetText("Valid");
                }
                else if (registrationStatus == EVehicleStatus.Expired)
                {
                    labeled_vehicle_registration_status.Component.Warn("Expired");
                }
                else
                {
                    labeled_vehicle_registration_status.Component.Warn("None");
                }
            }
            else
            {
                labeled_vehicle_insurance_status.Hide();
                labeled_vehicle_registration_status.Hide();
            }
        }
Ejemplo n.º 2
0
        private void BindData()
        {
            if (!BindNeeded)
            {
                return;
            }
            BindNeeded = false;
            if (DetailedEntity.Entity.IsLicenseValid)
            {
                labeled_license_status.Component.Text = "Valid";
            }
            else
            {
                labeled_license_status.Component.Warn(DetailedEntity.Entity.LicenseStateString);
            }


            if (DetailedEntity.Entity.IsAgent)
            {
                labeled_owner_alert.Component.Warn("Individual is a federal agent");
                labeled_owner_alert.Show();
            }
            else if (DetailedEntity.Entity.IsCop)
            {
                labeled_owner_alert.Component.Warn("Individual is a police officer");
                labeled_owner_alert.Show();
            }
            else
            {
                labeled_owner_alert.Hide();
            }

            if (!String.IsNullOrWhiteSpace(DetailedEntity.Entity.VehicleAlert))
            {
                labeled_alpr.Component.SetText(DetailedEntity.Entity.VehicleAlert);
                labeled_alpr.Show();
            }
            else
            {
                labeled_alpr.Hide();
            }

            cb_action.AddItem("Select One", "Placeholder", QuickActions.PLACEHOLDER);
            cb_action.AddItem("Blip (30 sec)", "Blip", QuickActions.BLIP_VEHICLE);
            cb_action.AddItem("Create Traffic Citation", "TrafficCitation", QuickActions.CREATE_TRAFFIC_CITATION);
            cb_action.AddItem("Create Arrest Report", "ArrestReport", QuickActions.CREATE_ARREST_REPORT_FOR_DRIVER);


            labeled_age.Component.Text          = DetailedEntity.Entity.AgeString;
            labeled_first_name.Component.Text   = DetailedEntity.Entity.FirstName;
            labeled_last_name.Component.Text    = DetailedEntity.Entity.LastName;
            labeled_home_address.Component.Text = Owner.GetHomeAddress();
            labeled_dob.Component.Text          = DetailedEntity.Entity.DOBString;
            if (DetailedEntity.Entity.IsWanted)
            {
                labeled_wanted_status.Component.Warn("Wanted");
            }
            else
            {
                labeled_wanted_status.Component.SetText("None");
            }
            labeled_times_stopped.Component.Text = DetailedEntity.Entity.TimesStopped.ToString();

            labeled_vehicle_model.Component.Text   = Vehicle.Model.Name;
            labeled_vehicle_license.Component.Text = Vehicle.LicensePlate;
            if (ComputerPlusEntity.PersonaType == PersonaTypes.BPS)
            {
                Function.LogDebug(String.Format("Null check is {0} is type {1}", DetailedEntity.Entity.RawPedPersona == null, DetailedEntity.Entity.RawPedPersona is British_Policing_Script.BritishPersona));
                var driverPersona  = (British_Policing_Script.BritishPersona)DetailedEntity.Entity.RawPedPersona;
                var vehiclePersona = (British_Policing_Script.VehicleRecords)DetailedEntity.Entity.RawVehiclePersona;
                Function.LogDebug("Got vehicle persona");
                Function.LogDebug(String.Format("vehiclePersona null {0}| labeled_vehicle_registration_status null {1} | labeled_vehicle_registration_status.Component null {2}", vehiclePersona == null, labeled_vehicle_registration_status, labeled_vehicle_registration_status.Component));
                if (vehiclePersona.IsTaxed)
                {
                    labeled_vehicle_registration_status.Component.SetText("No");
                }
                else
                {
                    labeled_vehicle_registration_status.Component.Warn("Yes");
                }
                Function.LogDebug("set labeled_vehicle_registration_status");


                if (vehiclePersona.Insured)
                {
                    labeled_vehicle_insurance_status.Component.SetText("Yes");
                }
                else
                {
                    labeled_vehicle_insurance_status.Component.Warn("No");
                }
                Function.LogDebug("set labeled_vehicle_insurance_status");

                if (vehiclePersona.HasMOT)
                {
                    labeled_vehicle_extra_1.Component.SetText("Yes");
                }
                else
                {
                    labeled_vehicle_extra_1.Component.Warn("No");
                }
                Function.LogDebug("set labeled_vehicle_extra_1");

                if (vehiclePersona.HasSORN)
                {
                    labeled_vehicle_extra_2.Component.SetText("Yes");
                }
                else
                {
                    labeled_vehicle_extra_2.Component.Warn("No");
                }
                Function.LogDebug("set labeled_vehicle_extra_2");

                if (driverPersona.IsInsuredToDriveVehicle(vehiclePersona))
                {
                    labeled_ped_extra_1.Component.SetText("Yes");
                }
                else
                {
                    labeled_ped_extra_1.Component.Warn("No");
                }

                Function.LogDebug("set labeled_ped_extra_1");
            }
            else if (Function.IsTrafficPolicerRunning())
            {
                if (TrafficPolicerFunction.GetVehicleInsuranceStatus(Vehicle) == EVehicleStatus.Valid)
                {
                    labeled_vehicle_insurance_status.Component.SetText("Valid");
                }
                else
                {
                    labeled_vehicle_insurance_status.Component.Warn("Expired");
                }

                if (TrafficPolicerFunction.GetVehicleRegistrationStatus(Vehicle) == EVehicleStatus.Valid)
                {
                    labeled_vehicle_registration_status.Component.SetText("Valid");
                }
                else
                {
                    labeled_vehicle_registration_status.Component.Warn("Expired");
                }
            }
            else
            {
                labeled_vehicle_insurance_status.Hide();
                labeled_vehicle_registration_status.Hide();
            }
        }