Пример #1
0
        private void AddTrainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int workoutId = -1;

            using (ExerciseChooseForm Window = new ExerciseChooseForm())
            {
                if (Window.ShowDialog() == DialogResult.OK)
                {
                    NewGymPlannerDataSet.WorkoutsRow workoutRow = dataSet.Workouts.AddWorkoutsRow(0);
                    workoutsAdapter.Update(dataSet);

                    NewGymPlannerDataSet.Workout_ExerciseRow workoutExerciseRow =
                        dataSet.Workout_Exercise.NewWorkout_ExerciseRow();
                    workoutId = workoutRow.ID_Workout;
                    workoutExerciseRow.ID_Workout    = workoutRow.ID_Workout;
                    workoutExerciseRow.Name_Exercise = Window.exerciseName;
                    dataSet.Workout_Exercise.AddWorkout_ExerciseRow(workoutExerciseRow);
                    workoutExerciseAdapter.Update(dataSet);

                    NewGymPlannerDataSet.Day_WorkoutRow dayWorkoutRow =
                        dataSet.Day_Workout.NewDay_WorkoutRow();
                    dayWorkoutRow.ID_Workout         = workoutRow.ID_Workout;
                    dayWorkoutRow.ID_Day             = dayId;
                    workoutExerciseRow.Name_Exercise = Window.exerciseName;
                    dataSet.Day_Workout.AddDay_WorkoutRow(dayWorkoutRow);
                    dayWorkoutAdapter.Update(dataSet);

                    UpdateTreeView();
                    // Window.Hide();
                    using (EditSetsForm setsForm = new EditSetsForm(workoutId))
                    {
                        if (setsForm.ShowDialog() == DialogResult.OK)
                        {
                            UpdateTreeView();
                        }
                    }
                }
            }
        }
Пример #2
0
        private void ChangeTrainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = PlanTreeView.SelectedNode;

            if (node == null)
            {
                MessageBox.Show("Виберіть тренування для зміни");
                return;
            }
            if (node.Level == 1)
            {
                node = node.Parent;
            }
            int workoutId = (int)node.Tag;

            using (EditSetsForm Window = new EditSetsForm(workoutId))
            {
                if (Window.ShowDialog() == DialogResult.OK)
                {
                    UpdateTreeView();
                }
            }
        }