Example #1
0
        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");
                }
            }
        }
Example #2
0
        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
            }
        }