private void dataGrid_workout_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { DataGridViewRow row = this.dataGrid_workout.Rows[e.RowIndex]; txtW3_Wname.Text = row.Cells[0].Value.ToString(); cmb_w5_type.SelectedItem = row.Cells[1].Value.ToString(); txtW2_bmi_from.Text = row.Cells[2].Value.ToString(); txtW3_schedule.Text = row.Cells[4].Value.ToString(); txtW4_fat_from.Text = row.Cells[3].Value.ToString(); txtW2_bmi_to.Text = row.Cells[5].Value.ToString(); txtW4_fat_to.Text = row.Cells[6].Value.ToString(); Buisness_Logic.workout_repository wr = new Buisness_Logic.workout_repository(); dataGrid_ex_list.DataSource = wr.getExercises_from_workoutGrid(txtW3_Wname.Text); } } catch (Exception ecell) { throw; } }
private void btnworkout_update_w_Click(object sender, EventArgs e) { try { Buisness_Logic.workout wk = new Buisness_Logic.workout(); wk.BMI_rate_from = double.Parse(txtW2_bmi_from.Text); wk.BMI_rate_to = double.Parse(txtW2_bmi_to.Text); wk.fat_level_from = double.Parse(txtW4_fat_from.Text); wk.fat_level_to = double.Parse(txtW4_fat_to.Text); wk.interval_days = txtW3_schedule.Text; wk.type = cmb_w5_type.SelectedItem.ToString(); wk.workout_name = txtW3_Wname.Text; Buisness_Logic.workout_repository wr = new Buisness_Logic.workout_repository(); if (wr.updateWorkouts(wk)) { MessageBox.Show("Workout update successfull.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Workout update failed.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception fs) { throw; } }
private void btnworkout_update_Click(object sender, EventArgs e) { try { Buisness_Logic.workout wk = new Buisness_Logic.workout(); wk.exName = comboW5_name.SelectedItem.ToString(); wk.workout_name = txtW3_Wname.Text; wk.repeats = int.Parse(txtW5_sets.Text); Buisness_Logic.workout_repository wr = new Buisness_Logic.workout_repository(); if (wr.updateWorkouts_ex_list(wk)) { MessageBox.Show("Workout list update successfull.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Workout list update failed.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception fs) { throw; } }
private void btnworkout_search_Click(object sender, EventArgs e) { try { Buisness_Logic.workout wrk = new Buisness_Logic.workout(); wrk.workout_name = txtW3_Wname.Text; wrk.exName = comboW5_name.SelectedItem.ToString(); wrk.repeats = int.Parse(txtW5_sets.Text); Buisness_Logic.workout_repository wo1 = new Buisness_Logic.workout_repository(); if (wo1.addExercises_to_workout(wrk)) { MessageBox.Show("Succesfull.", "Data Insertion.", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Unsucesfull.", "Data Insertion.", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception exp) { throw; } }
private void bnt_genwrfs_Click(object sender, EventArgs e) { try { DataTable dt = new DataTable(); double fat_to, fat_from, bmi_to, bmi_from; string workout_name; int match; bool test = false; double member_bmi, member_fat; member_bmi = double.Parse(txtgetW_bmi.Text); member_fat = double.Parse(txtgetW_fat.Text); Buisness_Logic.workout_repository wr = new Buisness_Logic.workout_repository(); dt = wr.searchWorkouts_for_grid(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { bmi_from = (double)dt.Rows[i]["BMI_rate_from"]; bmi_to = (double)dt.Rows[i]["BMI_rate_to"]; fat_from = (double)dt.Rows[i]["fat_level_from"]; fat_to = (double)dt.Rows[i]["fat_level_to"]; if (member_bmi >= bmi_from && member_bmi < bmi_to && member_fat >= fat_from && member_fat < fat_to) { match = i; workout_name = dt.Rows[i]["w_name"].ToString(); // txtgw_workoutName.Text = dt.Rows[match]["w_name"].ToString(); MessageBox.Show("Workout generated.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Information); txtgw_workoutName.Text = workout_name; txtgetW_shedule.Text = dt.Rows[i]["interval_days"].ToString(); test = true; break; } } if (test == false) { MessageBox.Show("No workout match found.", "Information.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception gf) { throw; } }
private void btnworkout_save_Click(object sender, EventArgs e) { try { Buisness_Logic.workout wo = new Buisness_Logic.workout(); wo.workout_name = txtW3_Wname.Text; wo.type = cmb_w5_type.SelectedItem.ToString(); // from wo.BMI_rate_from = double.Parse(txtW2_bmi_from.Text); wo.fat_level_from = double.Parse(txtW4_fat_from.Text); //to wo.BMI_rate_to = double.Parse(txtW2_bmi_to.Text); wo.fat_level_to = double.Parse(txtW4_fat_to.Text); wo.interval_days = txtW3_schedule.Text; Buisness_Logic.workout_repository wr = new Buisness_Logic.workout_repository(); if (wr.addWorkouts(wo)) { MessageBox.Show("Succesfull.", "Data Insertion.", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Unsucesfull.", "Data Insertion.", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception exp) { throw; } }
private void btnGw_save_Click(object sender, EventArgs e) { string wk = txtgw_workoutName.Text; DataTable mem = new DataTable(); mem.Columns.Add("memID", typeof(int)); mem.Columns.Add("fat", typeof(double)); mem.Columns.Add("bmi", typeof(double)); double fat = double.Parse(txtgetW_fat.Text); double bmi = double.Parse(txtgetW_bmi.Text); int memid = int.Parse(txtgetW_memID.Text); mem.Rows.Add(memid, fat, bmi); Buisness_Logic.workout_repository wr = new Buisness_Logic.workout_repository(); var dt_w = wr.searchWorkouts_for_report(wk); var dt_e = wr.getExercises_from_workoutGrid(wk); Workout_printUI fd = new Workout_printUI(dt_w, dt_e, mem); fd.Show(); }
private void workout_to_datagrid() { Buisness_Logic.workout_repository wr = new Buisness_Logic.workout_repository(); dataGrid_workout.DataSource = wr.searchWorkouts_for_grid(); }