private void saveButton_Click(object sender, EventArgs e) { // Boolean to check if the user enter all required information bool readyToSave = true; // Set the User NickName Program.dprofile.NickName = Program.nickName; // Checking if the user enter sex if (sexComboBox.SelectedIndex == -1) { lbSexError.Visible = true; readyToSave = false; } else Program.dprofile.Sex = sexComboBox.GetItemText(sexComboBox.SelectedItem); // Checking if the user enter min age try { Program.dprofile.Min_Age = int.Parse(ageMinComboBox.Text); } catch { lbAgeMinError.Visible = true; readyToSave = false; } // Checking if the user enter max age try { Program.dprofile.Max_Age = int.Parse(ageMaxComboBox.Text); } catch { lbAgeMaxError.Visible = true; readyToSave = false; } // Checking if the user enter range try { Program.dprofile.Range = int.Parse(txRange.Text); Program.profile.Distance = int.Parse(txRange.Text); } catch { lbRangeError.Visible = true; readyToSave = false; } // Checking if the user enter race if (raceComboBox.SelectedIndex == -1) { lbRaceError.Visible = true; readyToSave = false; } else Program.dprofile.Race = raceComboBox.GetItemText(raceComboBox.SelectedItem); // Checking if the user enter min height try { Program.dprofile.Height_Min = int.Parse(heightMinCmTextbox.Text); } catch { lbHeightMinError.Visible = true; readyToSave = false; } // Checking if the user specified max Height try { Program.dprofile.Height_Max = int.Parse(heightMaxCmTextBox.Text); } catch { lbHeightMaxError.Visible = true; readyToSave = false; } // Checking if the user enter min weight try { Program.dprofile.Min_Weight = int.Parse(weightMinTextBox.Text); } catch { lbWeightMinError.Visible = true; readyToSave = false; } // Checking if the user specified the max weight try { Program.dprofile.Max_Weight = int.Parse(weightMaxTextBox.Text); } catch { lbWeightMaxError.Visible = true; readyToSave = false; } // Checking if the user enter hair if (hairComboBox.SelectedIndex == -1) { lbHairError.Visible = true; readyToSave = false; } else Program.dprofile.Hair = hairComboBox.GetItemText(hairComboBox.SelectedItem); // Checking if the user specified the Interest if (cbInterest.SelectedIndex == -1) { lbErrorInterest.Visible = true; readyToSave = false; } else Program.dprofile.Interest = cbInterest.GetItemText(cbInterest.SelectedItem); // We good to go if (readyToSave) { //call web service to add dating ad to Database MessageBox.Show("Saved Successfully"); // This is our webService reference MainProject.cloudWebRef.NoIdeasWebService service = new MainProject.cloudWebRef.NoIdeasWebService(); if (Program.doesHaveDateProfile) // Update Dating profile service.UpdateDatingProfile(Program.dprofile); else // Insert new user into the db service.LoadDatingProfile(Program.dprofile); // MainProject.cloudWebRef.DatingProfile -- DON'T DELETE IT -- WE NEED IT TO FIX VS BUG // Indicate that the user have a dating profile Program.doesHaveDateProfile = true; //send user back to the HomePage page // HomeForm homeForm = new HomeForm(Program.nickName); // homeForm.Show(); // Close current form this.Close(); } // Display the error message else MessageBox.Show("Please fill in all required fields"); }
private void UpdateGPSCoordinates() { // This is our webService reference MainProject.cloudWebRef.NoIdeasWebService service = new MainProject.cloudWebRef.NoIdeasWebService(); while (true) { //txbTestThread.Text = "It's been " + count.ToString() + " so far"; service.UpdateDatingProfile(Program.dprofile); Thread.Sleep(30000); Program.dprofile.Max_Weight++; } }