Exemplo n.º 1
0
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            if (isCheck)
            {
                isCheck = false;
                if (Coin51.Text.Equals("") || Coin52.Text.Equals("") || Coin53.Text.Equals("") || Coin101.Text.Equals("") || Coin102.Text.Equals("") || Coin103.Text.Equals("") || Coin151.Text.Equals("") || Coin152.Text.Equals("") || Coin20.Text.Equals("") || Behavior1.Text.Equals("") || Behavior2.Text.Equals("") || Behavior3.Text.Equals("") || Behavior4.Text.Equals(""))
                {
                    MessageBoxResult result = MessageBox.Show("There are empty fields, Do you wish to continue with out them ?", "Warning!", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                    if (result == MessageBoxResult.No)
                    {
                        return;
                    }
                }
                LogInInformation.Child_name    = ChildName.Text;
                LogInInformation.Behavior_name = BehaviorName.Text;
                RewardApp reward = new RewardApp();
                reward.Show();
                this.Close();
                return;
            }

            if (isFillOut())
            {
                isCheck = true;

                if (!isChildExist() && !isBehaviorExist())
                {
                    DBConnection.insertChild(LogInInformation.Username, ChildName.Text, Birthdate.SelectedDate);
                    DBConnection.insertBehavior(LogInInformation.Username, BehaviorName.Text, Behavior1.Text, Behavior2.Text, Behavior3.Text, Behavior4.Text, Coin51.Text, Coin52.Text, Coin53.Text, Coin101.Text, Coin102.Text, Coin103.Text, Coin151.Text, Coin152.Text, Coin20.Text);
                    MessageBox.Show("You just create new information for your Child and new Behavior Group.", "New Child and Behavior Group.", MessageBoxButton.OK, MessageBoxImage.Information);
                    updateComboBox();
                    return;
                }
                else if (!isChildExist() && isBehaviorExist())
                {
                    DBConnection.insertChild(LogInInformation.Username, ChildName.Text, Birthdate.SelectedDate);
                    updateExistBehavior();
                    return;
                }
                else if (isChildExist() && !isBehaviorExist())
                {
                    DBConnection.insertBehavior(LogInInformation.Username, BehaviorName.Text, Behavior1.Text, Behavior2.Text, Behavior3.Text, Behavior4.Text, Coin51.Text, Coin52.Text, Coin53.Text, Coin101.Text, Coin102.Text, Coin103.Text, Coin151.Text, Coin152.Text, Coin20.Text);
                    updateExistChild();
                    return;
                }
                else if (isChildExist() && isBehaviorExist())
                {
                    if (isChildTheSame() && isBehaviorTheSame())
                    {
                        Submit_Click(sender, e);
                    }
                    updateExistChild();
                    updateExistBehavior();
                    updateComboBox();
                    return;
                }
            }
        }
Exemplo n.º 2
0
 private void Back_Click(object sender, RoutedEventArgs e)
 {
     if (isSave)
     {
         RewardApp rewardApp = new RewardApp();
         rewardApp.Show();
         this.Close();
     }
     else
     {
         MessageBoxResult result = MessageBox.Show("You did not save the report yet. Do you want to go back ?", "Unsave Report", MessageBoxButton.YesNo, MessageBoxImage.Warning);
         if (result == MessageBoxResult.Yes)
         {
             RewardApp rewardApp = new RewardApp();
             rewardApp.Show();
             this.Close();
         }
     }
 }