protected void Page_Load(object sender, EventArgs e) { sysManager = new SystemExerciseManager(); routManager = new routineManager(); logManager = new LoggedExerciseManager(); lb = (ListBox)this.Parent.FindControl("lbRoutines"); if (Session["loggedExerciseID"] != null) { loggedExerciseID = (int)Session["loggedExerciseID"]; } if (!IsPostBack) { Session.Abandon(); pnlSets.Visible = false; } if (lb != null && lb.SelectedIndex > -1) { routineID = Convert.ToInt32(lb.SelectedItem.Value); GridView1.DataSource = routManager.getLoggedExercises(userID, routineID); GridView1.DataBind(); pnlSets.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { manager = new SystemExerciseManager(); }
protected void Page_Load(object sender, EventArgs e) { sysManager = new SystemExerciseManager(); routManager = new routineManager(); if (Session["exercises"] == null) { exercises = new List<Exercise>(); Session["exercises"] = exercises; } if (!IsPostBack) { lblUniqueName.Visible = false; pnlDescription.Visible = false; // full refresh of page will abandon current session Session.Abandon(); lb = (ListBox)this.Parent.FindControl("lbRoutines"); if (userID != null) { lb.DataSource = routManager.getUsersRoutines(userID).ToList(); lb.DataTextField = "name"; lb.DataValueField = "id"; lb.DataBind(); } // to get the id of the button so that enter = submit tbRoutineName.Attributes.Add("onKeyPress", "doClick('" + btnConfirm.ClientID + "',event)"); } }
public void showAddGoal() { if (viewExercises.ddlCount > 0) { try { SystemExerciseManager manager = new SystemExerciseManager(); Exercise exercise = manager.getExercise(viewExercises.ddlValue); addGoalPanel.Visible = true; if (exercise.time) { goalTimeTxtBox.Enabled = true; NumericUpDownExtender1.Enabled = true; goalTimeTxtBox.Text = "0"; } else { goalTimeTxtBox.Enabled = false; NumericUpDownExtender1.Enabled = false; goalTimeTxtBox.Text = "0"; } if (exercise.weight) { goalWeightTxtBox.Enabled = true; NumericUpDownExtender2.Enabled = true; goalWeightTxtBox.Text = "0"; } else { goalWeightTxtBox.Enabled = false; NumericUpDownExtender2.Enabled = false; goalWeightTxtBox.Text = "0"; } if (exercise.distance) { goalDistanceTxtBox.Enabled = true; NumericUpDownExtender3.Enabled = true; goalDistanceTxtBox.Text = "0"; } else { goalDistanceTxtBox.Enabled = false; NumericUpDownExtender3.Enabled = false; goalDistanceTxtBox.Text = "0"; } if (exercise.rep) { goalRepsTxtBox.Enabled = true; NumericUpDownExtender4.Enabled = true; goalRepsTxtBox.Text = "0"; } else { goalRepsTxtBox.Enabled = false; NumericUpDownExtender4.Enabled = false; goalRepsTxtBox.Text = "0"; } if (goalMngr.getExerciseNameWithinGoal(userName, exercise.name) == exercise.name) { saveNewGoalBtn.Enabled = false; addGoalResultLbl.Text = "You already have a Goal for this exercise. You can modify it in the \"View Exercise Goals\" page."; } else saveNewGoalBtn.Enabled = true; } catch (Exception ex) { addGoalResultLbl.Text = "Something went wrong with the creating of the form: " + ex.Message + ex.StackTrace; } } else addGoalPanel.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { sysManager = new SystemExerciseManager(); routManager = new routineManager(); rbl = (RadioButtonList)this.Parent.FindControl("rblRoutines"); if (!IsPostBack) { } if (rbl != null && rbl.SelectedIndex > -1) { GridView1.DataSource = routManager.getExerciseFromRoutine(Convert.ToInt32(rbl.SelectedItem.Value)); GridView1.DataBind(); Panel1.Visible = true; Panel1.Enabled = true; //Response.Write(rbl.SelectedIndex + " item: " + rbl.SelectedItem); // to get the id of the button so that enter = submit tbRoutineName.Attributes.Add("onKeyPress", "doClick('" + btnConfirm.ClientID + "',event)"); } }
public void showAddGoal() { if (viewExercises.ddlCount != 0) { try { SystemExerciseManager manager = new SystemExerciseManager(); Exercise exercise = manager.getExercise(viewExercises.ddlValue); addGoalPanel.Visible = true; if (exercise.time) { goalTimeTxtBox.Enabled = true; NumericUpDownExtender1.Enabled = true; NumericUpDownExtender1.Minimum = 1; goalTimeTxtBox.Text = "1"; RegularExpressionValidator1.ValidationExpression = "^[1-9][0-9]*$"; } else { goalTimeTxtBox.Enabled = false; NumericUpDownExtender1.Enabled = false; NumericUpDownExtender1.Minimum = 0; goalTimeTxtBox.Text = "0"; RegularExpressionValidator1.ValidationExpression = "[0-9]+"; } if (exercise.weight) { goalWeightTxtBox.Enabled = true; NumericUpDownExtender2.Enabled = true; NumericUpDownExtender2.Minimum = 1; goalWeightTxtBox.Text = "1"; RegularExpressionValidator2.ValidationExpression = "^[1-9][0-9]*$"; } else { goalWeightTxtBox.Enabled = false; NumericUpDownExtender2.Enabled = false; NumericUpDownExtender2.Minimum = 0; goalWeightTxtBox.Text = "0"; RegularExpressionValidator2.ValidationExpression = "[0-9]+"; } if (exercise.distance) { goalDistanceTxtBox.Enabled = true; NumericUpDownExtender3.Enabled = true; NumericUpDownExtender3.Minimum = 0.1; goalDistanceTxtBox.Text = "0.1"; RegularExpressionValidator3.ValidationExpression = "^[1-9][0-9]*(\\.[0-9]+)?|0+\\.[0-9]*[1-9][0-9]*$"; } else { goalDistanceTxtBox.Enabled = false; NumericUpDownExtender3.Enabled = false; NumericUpDownExtender3.Minimum = 0; goalDistanceTxtBox.Text = "0"; RegularExpressionValidator3.ValidationExpression = "[0-9]+([\\.][0-9]{1,3})?$"; } if (exercise.rep) { goalRepsTxtBox.Enabled = true; NumericUpDownExtender4.Enabled = true; NumericUpDownExtender4.Minimum = 1; goalRepsTxtBox.Text = "1"; RegularExpressionValidator4.ValidationExpression = "^[1-9][0-9]*$"; } else { goalRepsTxtBox.Enabled = false; NumericUpDownExtender4.Enabled = false; NumericUpDownExtender4.Minimum = 0; goalRepsTxtBox.Text = "0"; RegularExpressionValidator4.ValidationExpression = "[0-9]+"; } if (goalMngr.getExerciseNameWithinGoal(userName, exercise.name) == exercise.name) { saveNewGoalBtn.Enabled = false; addGoalResultLbl.Text = "You already have a Goal for this exercise. You can modify it in the \"View Exercise Goals\" page."; } else saveNewGoalBtn.Enabled = true; } catch (Exception ex) { addGoalResultLbl.Text = "Something went wrong with the creating of the form: " + ex.Message + ex.StackTrace; } } else { addGoalPanel.Visible = false; viewExercises.ddle = false; } }