private void mNewSet_Click(object sender, EventArgs e) { NewSetEventArgs args = new NewSetEventArgs(); args.Reps = 0; args.Weight = 0; args.Notes = ""; AddSet(null, args); GetSets(null, EventArgs.Empty); }
private void btnNew_Click(object sender, EventArgs e) { NewSetEventArgs args = new NewSetEventArgs(); args.Reps = 0; args.Weight = 0; args.Notes = ""; CopySet(args); }
private void AddSet(object sender, NewSetEventArgs e) { string sql = "INSERT INTO tblWoSets (idWorkoutExercise, idExerciseType, Reps, Weight, Notes) " + "VALUES(@idWorkoutExercise, @idExerciseType, @reps, @weight, @notes)"; SqlCommand cmd = Global.conn1.CreateCommand(); cmd.Parameters.AddWithValue("@idWorkoutExercise", IdExercise); cmd.Parameters.AddWithValue("@idExerciseType", IdExerciseType); cmd.Parameters.AddWithValue("@reps", e.Reps); cmd.Parameters.AddWithValue("@weight", e.Weight); cmd.Parameters.AddWithValue("@notes", e.Notes); cmd.CommandText = sql; if (Global.conn1.State != ConnectionState.Open) Global.conn1.Open(); cmd.ExecuteNonQuery(); Global.conn1.Close(); GetSets(null, EventArgs.Empty); }
protected virtual void CopySet(NewSetEventArgs e) { EventHandler<NewSetEventArgs> handler = CopySetEvent; if (handler != null) handler(this, e); }