Example #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            TrainningForm tf = new TrainningForm();

            tf.Show();
            this.Hide();
        }
Example #2
0
        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!";
            }
        }
Example #3
0
 private void button12_Click(object sender, EventArgs e)
 {
     if ((DateTime.Now.Date - start.Date).TotalDays * 2 >= 8)
     {
         if (MessageBox.Show("We recommend to reset your goals, your diet plan and training plan", "Instraction", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             userTableAdapter1.updatePoints(0, id);
             goalsTableAdapter1.updateStatus("Failed", id, "Incomplete");
             userRoutineTableAdapter1.deleteAllDuplicates(id);
             userDietPlanTableAdapter1.deleteUserDietPlan(id);
             MessageBox.Show("Reset successful", "Reseted", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             UserClass.firstTime = true;
             TrainningForm tf = new TrainningForm();
             tf.Show();
             this.Hide();
         }
     }
 }
Example #4
0
 private void button13_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you satisfied with current program?", "Satisfied?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
     {
         if (MessageBox.Show("Do you want to reset goals, diet plan and training plan?", "Reset?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             userTableAdapter1.updatePoints(0, id);
             goalsTableAdapter1.updateStatus("Failed", id, "Incomplete");
             userRoutineTableAdapter1.deleteAllDuplicates(id);
             userDietPlanTableAdapter1.deleteUserDietPlan(id);
             MessageBox.Show("Reset successful", "Reseted", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             UserClass.firstTime = true;
             TrainningForm tf = new TrainningForm();
             tf.Show();
             this.Hide();
         }
     }
 }
Example #5
0
 private void button11_Click(object sender, EventArgs e)
 {
     if (DateTime.Now.Date == end.Date)
     {
         userTableAdapter1.updatePoints(0, id);
         goalsTableAdapter1.updateStatus("Completed", id, "Incomplete");
         userRoutineTableAdapter1.deleteAllDuplicates(id);
         userDietPlanTableAdapter1.deleteUserDietPlan(id);
         MessageBox.Show("Completed your Program", "Complete program", MessageBoxButtons.OK, MessageBoxIcon.Information);
         UserClass.firstTime = true;
         TrainningForm tf = new TrainningForm();
         tf.Show();
         this.Hide();
     }
     else
     {
         MessageBox.Show("You still have " + (end.Date - DateTime.Now.Date).TotalDays + " days for training", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }