Esempio n. 1
0
        public async Task <string> SignUpAsync(TraineeSignupModel signupModel)
        {
            Debug.WriteLine(JsonConvert.SerializeObject(signupModel));

            if (CrossConnectivity.Current.IsConnected)
            {
                var uri = new Uri("http://104.238.81.169:4080/FitnessApp/manageservices/v1/members/signup");

                try
                {
                    var json    = JsonConvert.SerializeObject(signupModel);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");

                    HttpResponseMessage response = null;

                    response = await client.PostAsync(uri, content);


                    if (response.IsSuccessStatusCode)
                    {
                        LoginRequestModel loginRequestModel = new LoginRequestModel(App.SelectedView, signupModel.email, App.SelectedView, signupModel.password);
                        var message = await App.TodoManager.Login(loginRequestModel);

                        if (message == "SUCCESS" || message == "Success")
                        {
                            return("Success");
                        }
                        else
                        {
                            return("Internal Server Error. Please try again.");
                        }
                    }
                    else
                    {
                        return("Internal Server Error. Please try again.");
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(@"ERROR {0}", ex.Message);
                    return("Internal Server Error. Please try again.");
                }
            }
            else
            {
                return("Internet Connectivity error. Please try again.");
            }
        }
Esempio n. 2
0
        public async Task <string> GetInstagramMedia(string accessToken)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                var url = "https://api.instagram.com/v1/users/self/media/recent/?access_token=" + accessToken;

                var uri = new Uri(url);

                try
                {
                    HttpResponseMessage response = null;

                    response = await client.GetAsync(uri);


                    if (response.IsSuccessStatusCode)
                    {
                        var responseJson = response.Content.ReadAsStringAsync().Result;

                        var instagramMedia = JsonConvert.DeserializeObject <InstagramMedia>(responseJson);
                        App.InstagramMedia = instagramMedia;

                        TraineeSignupModel signupModel = new TraineeSignupModel();
                        signupModel.email        = App.LoginResponse.Email;
                        signupModel.imagePayload = App.LoginResponse.ImagePayload;
                        signupModel.password     = App.LoginResponse.Password;
                        signupModel.paypalId     = App.LoginResponse.PaypalId;
                        signupModel.profile      = App.LoginResponse.Profile;
                        signupModel.signUpMetod  = App.LoginResponse.SignUpMetod;
                        TraineeSignupModel.BasicInfo basicInfo = new TraineeSignupModel.BasicInfo();


                        basicInfo.address             = App.LoginResponse.basicInfo.Address;
                        basicInfo.anyMedicalCondition = App.LoginResponse.basicInfo.AnyMedicalCondition;
                        basicInfo.country             = App.LoginResponse.basicInfo.Country;
                        basicInfo.dateOfBirth         = App.LoginResponse.basicInfo.DateOfBirth;
                        basicInfo.gender          = App.LoginResponse.basicInfo.Gender;
                        basicInfo.height          = App.LoginResponse.basicInfo.Height;
                        basicInfo.imageUrl        = App.LoginResponse.basicInfo.ImageUrl;
                        basicInfo.instaGramId     = "";
                        basicInfo.latitude        = App.LoginResponse.basicInfo.Latitude;
                        basicInfo.longitude       = App.LoginResponse.basicInfo.Longitude;
                        basicInfo.mobileNumber    = App.LoginResponse.basicInfo.PhoneNumber;
                        basicInfo.name            = App.LoginResponse.basicInfo.Name;
                        basicInfo.phoneNumber     = App.LoginResponse.basicInfo.PhoneNumber;
                        basicInfo.sportsInterest  = App.LoginResponse.basicInfo.SportsInterest;
                        basicInfo.state           = App.LoginResponse.basicInfo.State;
                        basicInfo.title           = App.LoginResponse.basicInfo.Title;
                        basicInfo.weight          = App.LoginResponse.basicInfo.Weight;
                        basicInfo.instaGramImages = "";


                        foreach (var item in App.InstagramMedia.data)
                        {
                            var media = item.images.standard_resolution.url;
                            basicInfo.instaGramImages = basicInfo.instaGramImages == "" ? media : basicInfo.instaGramImages + "," + media;
                        }

                        signupModel.basicInfo = basicInfo;

                        TraineeSignupModel.ProfessionalInfo professionalInfo = new TraineeSignupModel.ProfessionalInfo();

                        if (App.SelectedView == "Trainer")
                        {
                            professionalInfo.accolades      = App.LoginResponse.professionalInfo.Accolades;
                            professionalInfo.experience     = App.LoginResponse.professionalInfo.Experience;
                            professionalInfo.speciality     = App.LoginResponse.professionalInfo.Speciality;
                            professionalInfo.services       = new List <TraineeSignupModel.Services>();
                            professionalInfo.certifications = new List <TraineeSignupModel.Certifications>();

                            foreach (var item in App.LoginResponse.professionalInfo.services)
                            {
                                TraineeSignupModel.Services services = new TraineeSignupModel.Services();

                                services.charges        = Convert.ToDouble(item.Charges);
                                services.chargingPeriod = item.ChargingPeriod;
                                services.serviceName    = item.ServiceName;
                                services.teamSize       = item.TeamSize;
                                services.workLocaton    = item.WorkLocaton;
                                services.schedule       = new List <TraineeSignupModel.Schedule>();
                                foreach (var scheduleItem in item.schedules)
                                {
                                    TraineeSignupModel.Schedule schedule = new TraineeSignupModel.Schedule();

                                    schedule.day          = scheduleItem.Day;
                                    schedule.endTime      = scheduleItem.EndTime;
                                    schedule.month        = scheduleItem.Month;
                                    schedule.scheduleType = scheduleItem.ScheduleType;
                                    schedule.startTime    = scheduleItem.StartTime;
                                    schedule.weekDay      = scheduleItem.WeekDay;
                                    schedule.year         = scheduleItem.Year;

                                    services.schedule.Add(schedule);
                                }

                                professionalInfo.services.Add(services);
                            }


                            foreach (var certItem in App.LoginResponse.professionalInfo.certifications)
                            {
                                TraineeSignupModel.Certifications certifications = new TraineeSignupModel.Certifications();
                                certifications.certification = certItem.Certification;

                                professionalInfo.certifications.Add(certifications);
                            }


                            //signupModel.professionalInfo.certifications = App.LoginResponse.professionalInfo.certifications;
                            //signupModel.professionalInfo.services = App.LoginResponse.professionalInfo.services;
                        }

                        signupModel.professionalInfo = professionalInfo;

                        String signupSuccess = await SignUpAsync(signupModel);

                        return(signupSuccess);
                    }
                    else
                    {
                        return("Internal Server Error. Please try again.");
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(@"ERROR {0}", ex.Message);
                    return("Internal Server Error. Please try again.");
                }
            }
            else
            {
                return("Internet Connectivity error. Please try again.");
            }
        }
Esempio n. 3
0
        public async Task <string> SignUpAsync(TraineeSignupModel signupModel)
        {
            Debug.WriteLine(JsonConvert.SerializeObject(signupModel));

            if (CrossConnectivity.Current.IsConnected)
            {
                var uri = new Uri("https://arkho-app.org:6443/FitnessApp/manageservices/v1/members/signup");

                try
                {
                    var json    = JsonConvert.SerializeObject(signupModel);
                    var content = new StringContent(json, Encoding.UTF8, "application/json");

                    HttpResponseMessage response = null;

                    response = await client.PostAsync(uri, content);


                    if (response.IsSuccessStatusCode)
                    {
                        var responseJson = response.Content.ReadAsStringAsync().Result;
                        SignUpResponseModel responseItem = JsonConvert.DeserializeObject <Models.SignUpResponseModel>(responseJson);

                        if (responseItem.status.status == "SUCCESS" || responseItem.status.status == "Success")
                        {
                            if (signupModel.profile == "Trainer" && responseItem.status.IsStripeAccountCreated == "false")
                            {
                                App.TrainerStripeUrl = responseItem.status.StripeRedirectUrl;
                            }

                            LoginRequestModel loginRequestModel = new LoginRequestModel(App.SelectedView, signupModel.email, App.SelectedView, signupModel.password);
                            var message = await App.TodoManager.Login(loginRequestModel);

                            if (message == "SUCCESS" || message == "Success")
                            {
                                return("Success");
                            }
                            else
                            {
                                return("Internal Server Error. Please try again.");
                            }
                        }
                        else
                        {
                            return("Internal Server Error. Please try again.");
                        }
                    }
                    else
                    {
                        return("Internal Server Error. Please try again.");
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(@"ERROR {0}", ex.Message);
                    return("Internal Server Error. Please try again.");
                }
            }
            else
            {
                return("Internet Connectivity error. Please try again.");
            }
        }
Esempio n. 4
0
        public async Task <string> DeleteInstaImages()
        {
            TraineeSignupModel signupModel = new TraineeSignupModel();

            signupModel.email        = App.LoginResponse.Email;
            signupModel.imagePayload = App.LoginResponse.ImagePayload;
            signupModel.password     = App.LoginResponse.Password;
            signupModel.paypalId     = App.LoginResponse.PaypalId;
            signupModel.profile      = App.LoginResponse.Profile;
            signupModel.signUpMetod  = App.LoginResponse.SignUpMetod;
            TraineeSignupModel.BasicInfo basicInfo = new TraineeSignupModel.BasicInfo();


            basicInfo.address             = App.LoginResponse.basicInfo.Address;
            basicInfo.anyMedicalCondition = App.LoginResponse.basicInfo.AnyMedicalCondition;
            basicInfo.country             = App.LoginResponse.basicInfo.Country;
            basicInfo.dateOfBirth         = App.LoginResponse.basicInfo.DateOfBirth;
            basicInfo.gender          = App.LoginResponse.basicInfo.Gender;
            basicInfo.height          = App.LoginResponse.basicInfo.Height;
            basicInfo.imageUrl        = App.LoginResponse.basicInfo.ImageUrl;
            basicInfo.instaGramId     = "";
            basicInfo.latitude        = App.LoginResponse.basicInfo.Latitude;
            basicInfo.longitude       = App.LoginResponse.basicInfo.Longitude;
            basicInfo.mobileNumber    = App.LoginResponse.basicInfo.PhoneNumber;
            basicInfo.name            = App.LoginResponse.basicInfo.Name;
            basicInfo.phoneNumber     = App.LoginResponse.basicInfo.PhoneNumber;
            basicInfo.sportsInterest  = App.LoginResponse.basicInfo.SportsInterest;
            basicInfo.state           = App.LoginResponse.basicInfo.State;
            basicInfo.title           = App.LoginResponse.basicInfo.Title;
            basicInfo.weight          = App.LoginResponse.basicInfo.Weight;
            basicInfo.instaGramImages = "";

            signupModel.basicInfo = basicInfo;

            TraineeSignupModel.ProfessionalInfo professionalInfo = new TraineeSignupModel.ProfessionalInfo();

            if (App.SelectedView == "Trainer")
            {
                professionalInfo.accolades      = App.LoginResponse.professionalInfo.Accolades;
                professionalInfo.experience     = App.LoginResponse.professionalInfo.Experience;
                professionalInfo.speciality     = App.LoginResponse.professionalInfo.Speciality;
                professionalInfo.services       = new List <TraineeSignupModel.Services>();
                professionalInfo.certifications = new List <TraineeSignupModel.Certifications>();

                foreach (var item in App.LoginResponse.professionalInfo.services)
                {
                    TraineeSignupModel.Services services = new TraineeSignupModel.Services();

                    services.charges        = Convert.ToDouble(item.Charges);
                    services.chargingPeriod = item.ChargingPeriod;
                    services.serviceName    = item.ServiceName;
                    services.teamSize       = item.TeamSize;
                    services.workLocaton    = item.WorkLocaton;
                    services.schedule       = new List <TraineeSignupModel.Schedule>();
                    foreach (var scheduleItem in item.schedules)
                    {
                        TraineeSignupModel.Schedule schedule = new TraineeSignupModel.Schedule();

                        schedule.day          = scheduleItem.Day;
                        schedule.endTime      = scheduleItem.EndTime;
                        schedule.month        = scheduleItem.Month;
                        schedule.scheduleType = scheduleItem.ScheduleType;
                        schedule.startTime    = scheduleItem.StartTime;
                        schedule.weekDay      = scheduleItem.WeekDay;
                        schedule.year         = scheduleItem.Year;

                        services.schedule.Add(schedule);
                    }

                    professionalInfo.services.Add(services);
                }


                foreach (var certItem in App.LoginResponse.professionalInfo.certifications)
                {
                    TraineeSignupModel.Certifications certifications = new TraineeSignupModel.Certifications();
                    certifications.certification = certItem.Certification;

                    professionalInfo.certifications.Add(certifications);
                }


                //signupModel.professionalInfo.certifications = App.LoginResponse.professionalInfo.certifications;
                //signupModel.professionalInfo.services = App.LoginResponse.professionalInfo.services;
            }

            signupModel.professionalInfo = professionalInfo;

            String signupSuccess = await SignUpAsync(signupModel);

            await CredentialsService.SaveCredentials(userName : App.LoginResponse.Email, password : App.LoginResponse.Password, member : App.LoginResponse, userType : App.SelectedView);

            return(signupSuccess);
        }
Esempio n. 5
0
 public Task <string> SignUpAsync(TraineeSignupModel signupModel)
 {
     throw new NotImplementedException();
 }