コード例 #1
0
        async void SetUpAccountDetails()
        {
            driver = await client.GetUserProfile(user.id);

            if (driver != null)
            {
                if (driver.result.Count != 0)
                {
                    EmergencyContact emergencyContact       = new EmergencyContact();
                    string           emergencyContactString = SetDataBaseOnDriverProfile(driver.result[0].emergency_contact_name);

                    if (emergencyContactString != null)
                    {
                        emergencyContact = ParseEmergencyContact(emergencyContactString);
                    }

                    if (SetDataBaseOnDriverProfile(driver.result[0].driver_street) == null)
                    {
                        displayAddress = true;
                    }

                    if (SetDataBaseOnDriverProfile(driver.result[0].driver_first_name) != null)
                    {
                        FirstNameEntry.IsEnabled = false;
                    }

                    if (SetDataBaseOnDriverProfile(driver.result[0].driver_last_name) != null)
                    {
                        LastNameEntry.IsEnabled = false;
                    }

                    if (SetDataBaseOnDriverProfile(driver.result[0].driver_street) != null)
                    {
                        double defaultResult = 0;

                        addressToValidate.isValidated = true;
                        addressToValidate.Street      = SetDataBaseOnDriverProfile(driver.result[0].driver_street);

                        if (Double.TryParse(driver.result[0].driver_latitude, out defaultResult))
                        {
                            addressToValidate.Latitude = Double.Parse(driver.result[0].driver_latitude);
                        }

                        if (Double.TryParse(driver.result[0].driver_latitude, out defaultResult))
                        {
                            addressToValidate.Longitude = Double.Parse(driver.result[0].driver_longitude);
                        }


                        addressValidationClient.SetPinOnMap(MapView, new Xamarin.Essentials.Location(addressToValidate.Latitude, addressToValidate.Longitude), addressToValidate.Street);

                        //public void InitializeMap()
                        //{
                        //    map.MapType = MapType.Street;
                        //    Position point = new Position(37.334789, -121.888138);
                        //    var mapSpan = new MapSpan(point, 5, 5);
                        //    map.MoveToRegion(mapSpan);
                        //    map.Pins.Clear();
                        //}
                    }

                    SetEntry(FirstNameEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_first_name));
                    SetEntry(LastNameEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_last_name));
                    SetEntry(EmailEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_email));
                    SetEntry(StreetEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_street));
                    SetEntry(UnitEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_unit));
                    SetEntry(CityEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_city));
                    SetEntry(StateEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_state));
                    SetEntry(ZipcodeEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_zip));
                    SetEntry(ContactFirstNameEntry, SetDataBaseOnDriverProfile(emergencyContact.firstName));
                    SetEntry(ContactLastNameEntry, SetDataBaseOnDriverProfile(emergencyContact.lastName));
                    SetEntry(ContactRelationshipEntry, SetDataBaseOnDriverProfile(driver.result[0].emergency_contact_relationship));
                    SetEntry(CarYearEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_car_year));
                    SetEntry(CarModelEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_car_model));
                    SetEntry(carMakeEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_car_make));
                    SetEntry(InsuranceCarrierEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_insurance_carrier));
                    SetEntry(InsuranceNumberEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_insurance_num));
                    SetEntry(AccountNumberEntry, SetDataBaseOnDriverProfile(driver.result[0].bank_account_info));
                    SetEntry(RoutingNumberEntry, SetDataBaseOnDriverProfile(driver.result[0].bank_routing_info));
                    SetEntry(SSNEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_ssn));
                    SetEntry(DriveLicenseNumberEntry, SetDataBaseOnDriverProfile(driver.result[0].driver_license));
                    OnPhoneTextChanged(PhoneEntry, SetEntry(SetDataBaseOnDriverProfile(driver.result[0].driver_phone_num)));
                    OnPhoneTextChanged(ContactPhoneEntry, SetEntry(SetDataBaseOnDriverProfile(driver.result[0].emergency_contact_phone)));

                    SetPickerDate(InsuranceDatePicker, SetDataBaseOnDriverProfile(driver.result[0].driver_insurance_exp_date));
                    SetPickerDate(DriveLicenseDatePicker, SetDataBaseOnDriverProfile(driver.result[0].driver_license_exp));

                    SetInsuranceImage(SetDataBaseOnDriverProfile(driver.result[0].driver_insurance_picture));

                    SetAvailableBusiness(SetDataBaseOnDriverProfile(driver.result[0].business_id));
                }
            }
        }