Esempio n. 1
0
        private void signUpButton_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";
                }

                Child child = new Child(childName.Text, GlobalVariables.globalParent.firstName, GlobalVariables.globalParent.id, -1, gender, DOBpicker.SelectedDate.Value, null, 1);
                mSQLQuery.insertChildData(child);
                MessageBox.Show("Requset has been sent", "Request sent", MessageBoxButton.OK, MessageBoxImage.None);
                this.Close();
            }
            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 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);
            }
        }