private async void social_login() { loadingbar.IsRunning = true; loadingbar.IsEnabled = true; using (var cl = new HttpClient()) { var formcontent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>(Constants.OWNER_EMAIL, Preferences.Get(Constants.OWNER_EMAIL, "")), new KeyValuePair <string, string>(Constants.OWNER_NAME, Preferences.Get(Constants.OWNER_NAME, "")), new KeyValuePair <string, string>(Constants.OWNER_REGIST_FROM, Preferences.Get(Constants.OWNER_REGIST_FROM, "")), new KeyValuePair <string, string>(Constants.DEVICE_TOKEN, Preferences.Get(Constants.DEVICE_TOKEN, "")) }); try { var request = await cl.PostAsync(Constants.SERVER_SOCIAL_LOGIN_URL, formcontent); request.EnsureSuccessStatusCode(); var response = await request.Content.ReadAsStringAsync(); ResponseMsg resultMsg = JsonConvert.DeserializeObject <ResponseMsg>(response); if (resultMsg.resp.Equals("success")) { ResponseData resultData = JsonConvert.DeserializeObject <ResponseData>(response); App.owner_bonus = resultData.owner_data.owner_bonus; App.owner_ID = resultData.owner_data.owner_id; App.owner_name = resultData.owner_data.owner_name; App.owner_kana = resultData.owner_data.owner_kana; App.owner_nickname = resultData.owner_data.owner_nickname; App.owner_phone1 = resultData.owner_data.owner_phone1; App.owner_phone2 = resultData.owner_data.owner_phone2; App.owner_email = resultData.owner_data.owner_email; App.owner_password = resultData.owner_data.owner_password; App.owner_address = resultData.owner_data.owner_address; App.owner_postal_address = resultData.owner_data.owner_postal_address; App.owner_memo = resultData.owner_data.owner_memo; App.owner_estate_id = resultData.owner_data.owner_estate_id; App.owner_type = resultData.owner_data.owner_type; App.owner_profile = resultData.owner_data.owner_profile; App.owner_license = resultData.owner_data.owner_license; App.programm_fee = resultData.program_fee; App.income_rate = resultData.income_rate; App.minimum_rental_income = resultData.agency_fee; var estate_num = resultData.owner_data.owner_estate_data.Length; App.estate_num = estate_num; if (estate_num != 0) { App.repair_reserve = 0; App.rental_income = 0; App.admin_expense = 0; App.agency_fee = 0; Global.Buildings = new List <BuildingInfo>(); for (int i = 0; i < estate_num; i++) { if (string.IsNullOrEmpty(resultData.owner_data.owner_estate_data[i].estate_image_url)) { building_img_url = "noimage.png"; } else { building_img_url = Constants.ESTATE_IMAGE_URL_PREFIX + resultData.owner_data.owner_estate_data[i].estate_image_url; } Global.Buildings.Add(new BuildingInfo { building_id = resultData.owner_data.owner_estate_data[i].estate_id, building_name = resultData.owner_data.owner_estate_data[i].estate_name, rental_income = Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_rent), admin_expense = Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_admin_expense), agency_fee = Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_agency_fee), repair_reserve = Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_repair_reserve), estate_image_url = building_img_url, estate_loan_repay = resultData.owner_data.owner_estate_data[i].estate_loan_repay, estate_loan_amount = resultData.owner_data.owner_estate_data[i].estate_loan_amount, estate_yearly_profit = resultData.owner_data.owner_estate_data[i].estate_yearly_profit, estate_repay_period = resultData.owner_data.owner_estate_data[i].estate_repay_period, estate_property_tax = resultData.owner_data.owner_estate_data[i].estate_property_tax, program_fee = App.programm_fee, zero_status = resultData.owner_data.owner_estate_data[i].estate_zero_status }); App.rental_income += Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_rent); App.admin_expense += Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_admin_expense); App.repair_reserve += Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_repair_reserve); App.agency_fee += Convert.ToInt32(resultData.owner_data.owner_estate_data[i].estate_agency_fee); } } var prefecture_num = resultData.prefecture_data.Length; if (prefecture_num > 0) { Global.prefectures = new List <Prefectures>(); for (int i = 0; i < prefecture_num; i++) { Prefectures temp_prefecture = new Prefectures(); temp_prefecture.prefecture_name = resultData.prefecture_data[i].prefecture_name; temp_prefecture.prefecture_id = resultData.prefecture_data[i].prefecture_id; temp_prefecture.city = new List <City>(); var city_num = resultData.city_data.Length; if (city_num > 0) { for (int j = 0; j < city_num; j++) { if (temp_prefecture.prefecture_id == resultData.city_data[j].prefecture_id) { City temp_city = new City(); temp_city.city_name = resultData.city_data[j].city_name; temp_prefecture.city.Add(temp_city); } } } Global.prefectures.Add(temp_prefecture); } } loadingbar.IsRunning = false; loadingbar.IsEnabled = false; await Navigation.PushAsync(new TabPage()); Navigation.RemovePage(this); } else { loadingbar.IsRunning = false; loadingbar.IsEnabled = false; await DisplayAlert("", resultMsg.resp, "はい"); Navigation.RemovePage(this); } } catch { loadingbar.IsRunning = false; loadingbar.IsEnabled = false; await DisplayAlert("", Constants.NETWORK_ERROR, "はい"); Navigation.RemovePage(this); } } }
private void PopulatePrefectures() { // 1. Sarcelles Prefectures.Add(new Prefecture("95_SARCELLES", "95 - Sarcelles", @"https://www.val-doise.gouv.fr/booking/create/5260/1", new GenericPrefectureRequestor() { TargetURL = @"https://www.val-doise.gouv.fr/booking/create/5260/0" })); // 2. Bobigny Prefectures.Add(new Prefecture("93_BOBIGNY", "93 - Bobigny", @"https://www.seine-saint-denis.gouv.fr/booking/create/9829/1", new GenericPrefectureRequestor() { TargetURL = @"https://www.seine-saint-denis.gouv.fr/booking/create/9829/0" })); // 3. Le Raincy Prefectures.Add(new Prefecture("93_RAINCY", "93 - Le Raincy", @"https://www.seine-saint-denis.gouv.fr/booking/create/10317/1", new GenericPrefectureRequestor() { TargetURL = @"https://www.seine-saint-denis.gouv.fr/booking/create/10317/0" })); // 4. Nanterre Prefectures.Add(new Prefecture("92_NANTERRE", "92 - Nanterre", @"https://www.hauts-de-seine.gouv.fr/booking/create/12491/1", new GenericPrefectureRequestor() { TargetURL = @"https://www.hauts-de-seine.gouv.fr/booking/create/12491" })); // 5. Paris - VPF13 Prefectures.Add(new Prefecture("75_VPF13", "75 - VPF-13", @"https://pprdv.interieur.gouv.fr/booking/create/948/1", new GenericPrefectureRequestor() { TargetURL = @"https://pprdv.interieur.gouv.fr/booking/create/948/0" })); // 6. Paris - VPF17 Prefectures.Add(new Prefecture("75_VPF17", "75 - VPF-17", @"https://pprdv.interieur.gouv.fr/booking/create/953/1", new GenericPrefectureRequestor() { TargetURL = @"https://pprdv.interieur.gouv.fr/booking/create/953/0" })); // 7. Paris - SAL13 Prefectures.Add(new Prefecture("75_SAL13", "75 - SAL-13", @"https://pprdv.interieur.gouv.fr/booking/create/885/4", new ParisPrefectureRequestor() { TargetURL = @"https://pprdv.interieur.gouv.fr/booking/create/885/4" })); // 8. Paris - SAL17 Prefectures.Add(new Prefecture("75_SAL17", "75 - SAL-17", @"https://pprdv.interieur.gouv.fr/booking/create/876/4", new ParisPrefectureRequestor() { TargetURL = @"https://pprdv.interieur.gouv.fr/booking/create/876/4" })); // 9. Paris - ALGR Prefectures.Add(new Prefecture("75_ALGR", "75 - ALGR", @"https://pprdv.interieur.gouv.fr/booking/create/957/1", new ParisPrefectureRequestor() { TargetURL = @"https://pprdv.interieur.gouv.fr/booking/create/957/1" })); // 5. Creteil /*Prefectures.Add(new Prefecture("94_CRETEIL", * "94 - Creteil", * @"https://rdv-etrangers-94.interieur.gouv.fr/eAppointmentpref94/element/jsp/specific/pref94.jsp", * new CreteilPrefectureRequestor(), * 75));*/ }