private void button3_Click(object sender, EventArgs e) { RoutineMenu rm = new RoutineMenu(); rm.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { errorMsg.Text = ""; if (LoginUserTableAdapter.checkLogin(loginUserTxtBox.Text, loginPassTxtBox.Text).Value == 1) { UserClass.firstTime = true; UserClass.Name = loginUserTxtBox.Text; UserClass.Password = loginPassTxtBox.Text; int n = int.Parse(LoginUserTableAdapter.GetFindUser(UserClass.Name, UserClass.Password).Rows[0][0].ToString()); if (int.Parse(LoginUserTableAdapter.GetCheckForUpdated(UserClass.Name, UserClass.Password).Rows[0]["BMI"].ToString()) != 0) { if (goalsTableAdapter1.getGoalsAndStatus(n, "Incomplete") < 1) { TrainningForm tf = new TrainningForm(); tf.Show(); this.Hide(); } else if (userRoutineTableAdapter1.checkRoutine(n) < 1) { RoutineMenu rm = new RoutineMenu(); rm.Show(); this.Hide(); } else if (userDietPlanTableAdapter1.checkDietPlan(n) < 1) { DietForm df = new DietForm(); df.Show(); this.Hide(); } else { FinalForm ff = new FinalForm(); UserClass.firstTime = false; ff.Show(); this.Hide(); } } else { PersonalData pd = new PersonalData(); pd.Show(); this.Hide(); } } else { errorMsg.Text = "Wrong Username or Password. \nPlease try again!"; } }
private void button1_Click(object sender, EventArgs e) { try { int n = int.Parse(userTableAdapter1.GetFindUser(UserClass.Name, UserClass.Password).Rows[0][0].ToString()); if (goalsTableAdapter1.getGoals(n) > 0) { goalsTableAdapter1.deleteAllUserGoals(n, "Incomplete"); } DateTime dateStart = DateTime.Now; goalsTableAdapter1.Insert(n, fitnessGoalsCmbBox.Text, int.Parse(trainingTimeCmbBox.Text), (int)TrainingDaysDd.Value, dateStart, (int)ProgramDurationDd.Value, dateStart.AddMonths((int)ProgramDurationDd.Value), "Incomplete"); RoutineMenu rm = new RoutineMenu(); rm.Show(); }catch (Exception es) { MessageBox.Show("Error with insert", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }