private void OKButton_Click(object sender, RoutedEventArgs e) { List <Features> featurs = new List <Features>(); featurs = checkedFeatures(); SQLQuery mSqlQuery = new SQLQuery(); if (roomID.SelectedIndex > -1 && featurs.Count > 0) { mSqlQuery.deleteChildFeature((int)GlobalVariables.globalChild.id); foreach (var item in featurs) { mSqlQuery.insertChildFeature(((int)GlobalVariables.globalChild.id), FeatureToID[item.featureName]); } GlobalVariables.globalChild.roomID = Convert.ToInt32(getRoomID[int.Parse(roomID.Text.ToString())]); mSqlQuery.updateChildData(GlobalVariables.globalChild); MessageBox.Show("Data Updated Successflly", "Process Finshed", MessageBoxButton.OK, MessageBoxImage.Information); } else if (featurs.Count == 0) { MessageBox.Show("Please Enter atleast one feature", "Invaild Data", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show("Please Enter the Room number", "Invaild Data", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void signUpButton_Click(object sender, RoutedEventArgs e) { SQLQuery mSQLQuery = new SQLQuery(); List <Features> featurs = new List <Features>(); featurs = checkedFeatures(); if (childName.Text.Length >= 2 && DOBpicker.SelectedDate != null && featurs.Count > 0 && mainPic != false) { string gender; if (female.IsChecked == true) { gender = "Female"; } else { gender = "Male"; } ImageOperation OP = new ImageOperation(); profileHeader.Source = profileImage.ImageSource; Child child = new Child(childName.Text, GlobalVariables.globalParent.firstName, GlobalVariables.globalParent.id, -1, gender, DOBpicker.SelectedDate.Value, OP.ImageToBinary(profileHeader), 1); mSQLQuery.insertChildData(child); int childID = mSQLQuery.getIDForChild(childName.Text, GlobalVariables.globalParent.id.ToString()); foreach (var item in featurs) { mSQLQuery.insertChildFeature(childID, FeatureToID[item.featureName]); } MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButton.OK, MessageBoxImage.None); this.Close(); } else if (featurs.Count == 0) { MessageBox.Show("Please Enter atleast one feature", "Invaild Data", MessageBoxButton.OK, MessageBoxImage.Error); } else if (mainPic == false) { MessageBox.Show("Please Enter child image", "Invaild Data", MessageBoxButton.OK, MessageBoxImage.Error); } else if (childName.Text.Length < 2) { MessageBox.Show("Please Enter at least 2 letter", "Invaild Child Name", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show("Please enter the Date of Birth", "Missing DOB", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void editProfileButton_Click(object sender, RoutedEventArgs e) { SQLQuery mSQLQuery = new SQLQuery(); if (childName.Text.Length >= 2 && DOBpicker.SelectedDate != null) { string gender; if (female.IsChecked == true) { gender = "Female"; } else { gender = "Male"; } mSQLQuery.deleteChildFeature((int)GlobalVariables.globalChild.id); GlobalVariables.globalChild.DOB = DOBpicker.SelectedDate.Value; GlobalVariables.globalChild.firstName = childName.Text; GlobalVariables.globalChild.lastName = GlobalVariables.globalParent.firstName; GlobalVariables.globalChild.gender = gender; List <Features> featurs = new List <Features>(); featurs = checkedFeatures(); foreach (var item in featurs) { mSQLQuery.insertChildFeature((int)GlobalVariables.globalChild.id, FeatureToID[item.featureName]); } mSQLQuery.updateChildData(GlobalVariables.globalChild); MessageBox.Show("Updated", "Updated successfully ", MessageBoxButton.OK, MessageBoxImage.None); } else if (childName.Text.Length < 2) { MessageBox.Show("Please Enter at least 2 letter", "Invaild Child Name", MessageBoxButton.OK, MessageBoxImage.Error); } else { MessageBox.Show("Please enter the Date of Birth", "Missing DOB", MessageBoxButton.OK, MessageBoxImage.Error); } }