private void button4_Click_1(object sender, EventArgs e) { PersonalData pd = new PersonalData(); pd.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { try { int g = int.Parse(userTableAdapter1.GetFindUser(UserClass.Name, UserClass.Password).Rows[0][0].ToString()); int n = dataGridView1.CurrentRow.Index; if (userDietPlanTableAdapter1.checkDietPlan(g) > 0) { userDietPlanTableAdapter1.deleteUserDietPlan(g); } DataTable Goals = goalsTableAdapter1.GetUserPrefs(g, "Incomplete"); userDietPlanTableAdapter1.Insert(g, dataGridView1.Rows[n].Cells[0].Value.ToString(), Convert.ToDateTime(Goals.Rows[0]["DateStart"].ToString())); MessageBox.Show("Complete with Registration", "Registration Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); finalFormDrive.Enabled = true; button1.Enabled = false; userTableAdapter1.updatePoints(0, g); }catch (Exception es) { MessageBox.Show("Couldn't instert your diet plan", "Error Insert", MessageBoxButtons.OK, MessageBoxIcon.Error); PersonalData pd = new PersonalData(); UserClass.firstTime = true; pd.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 clearBtn_Click(object sender, EventArgs e) { if (MessageBox.Show("This will delete all record from Goals, Diet plan and Routine plan", "Warning!!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { int n = int.Parse(userTableAdapter1.GetFindUser(UserClass.Name, UserClass.Password).Rows[0][0].ToString()); goalsTableAdapter.deleteAllUserRecords(n); userRoutineTableAdapter1.deleteAllDuplicates(n); userDietPlanTableAdapter1.deleteUserDietPlan(n); userTableAdapter1.updatePoints(0, n); MessageBox.Show("Delete successful", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); PersonalData pd = new PersonalData(); pd.Show(); this.Hide(); } }
private void saveProgram_Click(object sender, EventArgs e) { try { int g = int.Parse(userTableAdapter1.GetFindUser(UserClass.Name, UserClass.Password).Rows[0][0].ToString()); int n = dataGridView1.CurrentRow.Index; if (userRoutineTableAdapter1.checkRoutine(g) > 0) { userRoutineTableAdapter1.deleteAllDuplicates(g); } userRoutineTableAdapter1.Insert(Convert.ToDateTime(Goals.Rows[0]["DateStart"].ToString()), g, dataGridView1.Rows[n].Cells[0].Value.ToString()); MessageBox.Show("Successful Insert", "Inserted", MessageBoxButtons.OK, MessageBoxIcon.Information); saveProgram.Enabled = false; MoveToDietForm.Enabled = true; userTableAdapter1.updatePoints(0, g); }catch (Exception es) { MessageBox.Show("Error with insert", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); PersonalData pd = new PersonalData(); UserClass.firstTime = true; pd.Show(); this.Hide(); } }