public async void SendSBNotification(string userId, string clientNotificationId) { string url = "https://trolli-194513.appspot.com/Test?id=" + userId; SignupBean bean = null; try { string content = await _client.GetStringAsync(url); List <Dictionary <string, object> > post = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(Convert.ToString(content)); foreach (Dictionary <string, object> ob in post) { Dictionary <string, object> values = JsonConvert.DeserializeObject <Dictionary <string, object> >(Convert.ToString(ob["properties"])); SignupBean obj = new SignupBean() { name = Convert.ToString(values["fullName"]), phoneNumber = Convert.ToString(values["simNumber"]), UUID = Convert.ToString(values["UniqueID"]) }; SendindividualNotification(obj, clientNotificationId); } } catch (Exception ex) { //Exception Class } }
public async void signupPost(SignupBean ob) { try { await _client.PostAsync("https://trolli-194513.appspot.com/registration?fullName=" + ob.name + "&simNumber=" + ob.phoneNumber + "&suburb=" + ob.subrub + "&state=" + ob.states + "&postCode=" + ob.postCodes + "&country=" + ob.country + "&email=" + ob.email + "&userType=" + ob.userType + "&latitude=" + ob.latitude + "&longitude=" + ob.longitude + "&deviceId=" + ob.deviceId, null); } catch (Exception ex) { Log.Warning("Error", ex.ToString()); } }
public async void SignupPost(SignupBean ob) { try { await _client.PostAsync(ApiEndPoints.userRegistrations + "&fullName=" + ob.name + "&simNumber=" + ob.phoneNumber + "&suburb=" + ob.subrub + "&state=" + ob.states + "&postCode=" + ob.postCodes + "&country=" + ob.country + "&email=" + ob.email + "&userType=" + ob.userType + "&latitude=" + ob.latitude + "&longitude=" + ob.longitude + "&deviceId=" + ob.deviceId + "&UUID=" + ob.UUID + "&rewardCard1=" + ob.rewardCard1 + "&rewardCard2=" + ob.rewardCard2 + "&gdFolderId=" + ob.folderId + "&imageId=" + ob.imageId + "&oneSignalId=" + ob.oneSignalId, null); } catch (Exception ex) { Log.Warning("Error", ex.ToString()); } }
public void SendindividualNotification(SignupBean ob, string clientNotificationId) { string msgPush = ob.name + " has accepted this job. Click to view Smart buyer's profile"; var request = WebRequest.Create(ApiEndPoints.oneSignalCallApi) as HttpWebRequest; request.KeepAlive = false; request.Method = "POST"; request.ContentType = "application/json; charset=utf-8"; request.Headers.Add("authorization", "Basic MGFhOTZjM2UtZjc3Yy00ZTk1LThlZjUtYTE2NzJhOTI5ZDMz"); byte[] byteArray = Encoding.UTF8.GetBytes("{ \"app_id\": \"6be47d95-7a8a-4f0b-932a-6bffa9ee04ca\", " + " \"include_player_ids\": [\"" + clientNotificationId + "\"]," + " \"image\": \"img.png\"," + " \"headings\": {\"en\": \"Trolly Job Accepted\"}, " + " \"data\": {\"location\": \"Location Testing\", \"SBProfileId\": \"" + ob.UUID + "\"}, " + " \"contents\": {\"en\": \"" + msgPush + "\"}}"); string responseContent = null; try { using (var writer = request.GetRequestStream()) { writer.Write(byteArray, 0, byteArray.Length); } using (var response = request.GetResponse() as HttpWebResponse) { using (var reader = new StreamReader(response.GetResponseStream())) { responseContent = reader.ReadToEnd(); } } } catch (WebException ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(new StreamReader(ex.Response.GetResponseStream()).ReadToEnd()); } System.Diagnostics.Debug.WriteLine(responseContent); }
public async void SignUpButton(object sender, EventArgs e) { String UUIDs = Guid.NewGuid().ToString(); if (CheckTextField()) { activIndicator.IsRunning = true; var deviceIds = CrossDeviceInfo.Current.Id; //Can't find Actual Object of CrossDeviceInfo // string simNumber = ""; // string deviceIdJson = ""; // var content = await _client.GetStringAsync(url); // List<Dictionary<string, object>> posts = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(content); // foreach (Dictionary<string, object> i in posts) // { // Dictionary<string, object> post = JsonConvert.DeserializeObject<Dictionary<string, object>>(Convert.ToString(i["properties"])); // deviceIdJson = Convert.ToString(post["deviceId"]); // if (deviceIdJson == deviceId) // { // simNumber = Convert.ToString(post["simNumber"]); // } // } // await Navigation.PushModalAsync(new TermAndService()); try { string oneSignalId = ""; OneSignal.Current.IdsAvailable((playerID, pushToken) => { oneSignalId = playerID; // App.Current.MainPage.DisplayAlert("playerId", id.ToString(), "OK"); }); string names = name; string emailId = email; string subrubs = subrub.Text; var statesPickers = statesPicker.Items[statesPicker.SelectedIndex]; //Can't find actual return type string statess = statesPickers; string postCodee = postCode.Text; string countrys = "Australia"; string userTypes = "C"; string latitude = "45"; string longitude = "45"; var locator = CrossGeolocator.Current; if (!locator.IsGeolocationAvailable || !locator.IsGeolocationEnabled) { await DisplayAlert("", "Trolli app requires access to location services, in order to function properly. If you do not allow location access, some features may not work as expected.", "Ok"); } else { locator.DesiredAccuracy = 100; if (Device.RuntimePlatform == Device.iOS) { var position = await locator.GetPositionAsync(); //Can't find actual return type latitude = "" + position.Latitude; longitude = "" + position.Longitude; } else if (Device.RuntimePlatform == Device.Android) { var position = await locator.GetPositionAsync(); //Can't find actual return type latitude = "" + position.Latitude; longitude = "" + position.Longitude; } string folderID = GoogleDriveAPI.CreateUserFolder("User_" + UUIDs); SignupBean bean = new SignupBean { name = names, email = emailId, subrub = subrubs, states = statess, postCodes = postCodee, country = countrys, userType = userTypes, phoneNumber = phoneNumbers, deviceId = deviceIds, latitude = latitude, longitude = longitude, UUID = UUIDs, folderId = folderID, imageId = "", rewardCard1 = "", rewardCard2 = "", oneSignalId = oneSignalId }; IsJobOnlineSeeker bean2 = new IsJobOnlineSeeker { fullName = name, simNumber = phoneNumbers, isJobSeeker = "true" }; Application.Current.Properties["phoneNumber"] = phoneNumbers; Application.Current.Properties["isOnlineJobSeeker"] = true; Application.Current.Properties["checkTrolli"] = "showAlert"; reloadData.Add("country", countrys); reloadData.Add("UniqueID", UUIDs); reloadData.Add("fullName", names); reloadData.Add("deviceId", deviceIds); reloadData.Add("suburb", subrubs); reloadData.Add("postCode", postCodee); reloadData.Add("state", statess); reloadData.Add("userType", userTypes); reloadData.Add("simNumber", phoneNumbers); reloadData.Add("gdFolderId", folderID); reloadData.Add("gdRewardCard1", ""); reloadData.Add("gdRewardCard2", ""); reloadData.Add("email", emailId); reloadData.Add("gdProfileImageId", ""); reloadData.Add("oneSignalId", oneSignalId); SharedUserData.getUserData = reloadData; ApiCalling callApi = new ApiCalling(); // GlobalVaribles golbalVarible = new GlobalVaribles(); // golbalVarible.setData(bean); callApi.SignupPost(bean); callApi.IsJobOnlineSeeker(bean2); // animationView.Play(); // // string folderID = GoogleDriveAPI.createUserFolder("User_"+UUIDs); userReferral referralObject = new userReferral { userId = phoneNumbers, availReward = true, referredByCode = referred, rewardBalance = 0, referralCode = "Furqan_xw7e" }; callApi.CreateReferralCode(referralObject); await Navigation.PushAsync(new MenuPage()); } } catch (Exception ex) { await DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); } } }
public async void ButtonUpdate(Object sender, EventArgs e) { // ActivityIndicator AI = new ActivityIndicator(); // AI.IsRunning = true; //GlobalVaribles bal = new GlobalVaribles(); //SignupBean bean2 = bal.getData(); try { loaderAI.IsRunning = true; Dictionary <string, object> userData = SharedUserData.getUserData; string name = txtName.Text; string email = txtEmail.Text; string states = txtStates.Items[txtStates.SelectedIndex]; string suburb = txtSuburb.Text; string postCode = txtPostCode.Text; string UDID = Convert.ToString(userData["UniqueID"]); string simNumber = Convert.ToString(userData["simNumber"]); string userType = Convert.ToString(userData["userType"]); string latitude = "0"; string longitude = "0"; var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 100; if (Device.RuntimePlatform == Device.iOS) { var position = await locator.GetPositionAsync(); //Can't find actual return type latitude = "" + position.Latitude; longitude = "" + position.Longitude; } else if (Device.RuntimePlatform == Device.Android) { var position = await locator.GetPositionAsync(); //Can't find actual return type latitude = "" + position.Latitude; longitude = "" + position.Longitude; } string country = Convert.ToString(userData["country"]); string deviceId = Convert.ToString(userData["deviceId"]); string folderId = Convert.ToString(userData["gdFolderId"]); string oneSignalId = Convert.ToString(userData["oneSignalId"]); if (updateImageCheck == 0) { imageId = Convert.ToString(userData["gdProfileImageId"]); } SignupBean bean = new SignupBean { name = name, email = email, subrub = suburb, states = states, postCodes = postCode, country = country, userType = userType, phoneNumber = simNumber, deviceId = deviceId, latitude = latitude, longitude = longitude, UUID = UDID, imageId = imageId, rewardCard1 = "", rewardCard2 = "", folderId = folderId, oneSignalId = oneSignalId }; ApiCalling callApi = new ApiCalling(); callApi.SignupPost(bean); reloadData.Add("country", country); reloadData.Add("UniqueID", UDID); reloadData.Add("fullName", name); reloadData.Add("deviceId", deviceId); reloadData.Add("suburb", suburb); reloadData.Add("postCode", postCode); reloadData.Add("state", states); reloadData.Add("userType", userType); reloadData.Add("simNumber", simNumber); reloadData.Add("gdFolderId", folderId); reloadData.Add("gdRewardCard1", ""); reloadData.Add("gdRewardCard2", ""); reloadData.Add("email", email); //reloadData.Add("gdProfileImageId", imageId); reloadData.Add("oneSignalId", oneSignalId); SharedUserData.getUserData = reloadData; // Application.Current.Properties["id"] = deviceId; //Application.Current.Properties["phoneNumber"] = simNumber; // NavigationPage page = new NavigationPage(new ClientMainPage(name)); //await Navigation.PopToRootAsync(); //await Navigation.PushModalAsync(new ClientMainPage(name)); // this.Navigation.RemovePage(this.Navigation.NavigationStack[this.Navigation.NavigationStack.Count]); // await Navigation.PushAsync(new ClientMainPage(name)); // App app = Application.Current as App; // ClientMainPage md = (ClientMainPage)app.MainPage; // AI.IsRunning = false; loaderAI.IsRunning = false; await Navigation.PopModalAsync(); }catch (Exception ex) { await DisplayAlert("", ExceptionManagement.LogException(ex), "Ok"); //Exception Class } }
public async void signUp_button(object sender, EventArgs e) { String UUIDs = Guid.NewGuid().ToString(); if (checkTextField()) { var deviceIds = CrossDeviceInfo.Current.Id; // string simNumber = ""; // string deviceIdJson = ""; // var content = await _client.GetStringAsync(url); // List<Dictionary<string, object>> posts = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(content); // foreach (Dictionary<string, object> i in posts) // { // Dictionary<string, object> post = JsonConvert.DeserializeObject<Dictionary<string, object>>(Convert.ToString(i["properties"])); // deviceIdJson = Convert.ToString(post["deviceId"]); // if (deviceIdJson == deviceId) // { // simNumber = Convert.ToString(post["simNumber"]); // } // } // await Navigation.PushModalAsync(new TermAndService()); try { string names = name; string emailId = email; string subrubs = subrub.Text; var statesPickers = statesPicker.Items[statesPicker.SelectedIndex]; string statess = statesPickers; string postCodee = postCode.Text; string countrys = "Australia"; string userTypes = "C"; string latitude = "45"; string longitude = "45"; var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 100; if (Device.RuntimePlatform == Device.iOS) { var position = await locator.GetPositionAsync(); latitude = "" + position.Latitude; longitude = "" + position.Longitude; } else if (Device.RuntimePlatform == Device.Android) { var position = await locator.GetPositionAsync(); latitude = "" + position.Latitude; longitude = "" + position.Longitude; } string folderID = GoogleDriveAPI.createUserFolder("User_" + UUIDs); SignupBean bean = new SignupBean { name = names, email = emailId, subrub = subrubs, states = statess, postCodes = postCodee, country = countrys, userType = userTypes, phoneNumber = phoneNumbers, deviceId = deviceIds, latitude = latitude, longitude = longitude, UUID = UUIDs, folderId = folderID, imageId = "", rewardCard1 = "", rewardCard2 = "" }; IsJobOnlineSeeker bean2 = new IsJobOnlineSeeker { fullName = name, simNumber = phoneNumbers, isJobSeeker = "true" }; Application.Current.Properties["phoneNumber"] = phoneNumbers; Application.Current.Properties["isOnlineJobSeeker"] = true; reloadData.Add("country", countrys); reloadData.Add("UniqueID", UUIDs); reloadData.Add("fullName", names); reloadData.Add("deviceId", deviceIds); reloadData.Add("suburb", subrubs); reloadData.Add("postCode", postCodee); reloadData.Add("state", statess); reloadData.Add("userType", userTypes); reloadData.Add("simNumber", phoneNumbers); reloadData.Add("gdFolderId", folderID); reloadData.Add("gdRewardCard1", ""); reloadData.Add("gdRewardCard2", ""); reloadData.Add("email", emailId); reloadData.Add("gdProfileImageId", ""); ShareUserData.getUserData = reloadData; ApiCalling callApi = new ApiCalling(); // GlobalVaribles golbalVarible = new GlobalVaribles(); // golbalVarible.setData(bean); callApi.signupPost(bean); callApi.isJobOnlineSeeker(bean2); // // string folderID = GoogleDriveAPI.createUserFolder("User_"+UUIDs); await Navigation.PushAsync(new MenuPage()); } catch (Exception ex) { await DisplayAlert("Alert", "" + ex, "ok"); } } }
public async void btn_update(Object sender, EventArgs e) { // ActivityIndicator AI = new ActivityIndicator(); // AI.IsRunning = true; //GlobalVaribles bal = new GlobalVaribles(); //SignupBean bean2 = bal.getData(); Dictionary <string, object> userData = ShareUserData.getUserData; string name = txtName.Text; string email = txtEmail.Text; string states = txtStates.Text; string suburb = txtSuburb.Text; string postCode = txtPostCode.Text; string UDID = Convert.ToString(userData["UniqueID"]); string simNumber = Convert.ToString(userData["simNumber"]); string userType = Convert.ToString(userData["userType"]); //string lat = Convert.ToString(userData[""]); // string lng = Convert.ToString(userData[""]); string country = Convert.ToString(userData["country"]); string deviceId = Convert.ToString(userData["deviceId"]); string folderId = Convert.ToString(userData["gdFolderId"]); if (updateImageCheck == 0) { imageId = Convert.ToString(userData["gdProfileImageId"]); } SignupBean bean = new SignupBean { name = name, email = email, subrub = suburb, states = states, postCodes = postCode, country = country, userType = userType, phoneNumber = simNumber, deviceId = deviceId, latitude = "44", longitude = "66", UUID = UDID, imageId = imageId, rewardCard1 = "", rewardCard2 = "", folderId = folderId }; ApiCalling callApi = new ApiCalling(); callApi.signupPost(bean); reloadData.Add("country", country); reloadData.Add("UniqueID", UDID); reloadData.Add("fullName", name); reloadData.Add("deviceId", deviceId); reloadData.Add("suburb", suburb); reloadData.Add("postCode", postCode); reloadData.Add("state", states); reloadData.Add("userType", userType); reloadData.Add("simNumber", simNumber); reloadData.Add("gdFolderId", folderId); reloadData.Add("gdRewardCard1", ""); reloadData.Add("gdRewardCard2", ""); reloadData.Add("email", email); reloadData.Add("gdProfileImageId", imageId); ShareUserData.getUserData = reloadData; // Application.Current.Properties["id"] = deviceId; //Application.Current.Properties["phoneNumber"] = simNumber; // NavigationPage page = new NavigationPage(new ClientMainPage(name)); //await Navigation.PopToRootAsync(); //await Navigation.PushModalAsync(new ClientMainPage(name)); // this.Navigation.RemovePage(this.Navigation.NavigationStack[this.Navigation.NavigationStack.Count]); // await Navigation.PushAsync(new ClientMainPage(name)); // App app = Application.Current as App; // ClientMainPage md = (ClientMainPage)app.MainPage; // AI.IsRunning = false; await Navigation.PopModalAsync(); }