Beispiel #1
0
 protected void WorkoutChoices_Initialize()
 {
     foreach (View view in WorkoutChoices.Views)
     {
         if (view.ID.ToString().Equals("Welcome"))
         {
             WorkoutChoices.SetActiveView(view);
         }
     }
 }
Beispiel #2
0
 protected void WorkoutChoices_SetView(object sender, EventArgs e)
 {
     foreach (View view in WorkoutChoices.Views)
     {
         if (view.ID.ToString().Equals(ddlWorkoutChoices.Text))
         {
             WorkoutChoices.SetActiveView(view);
         }
     }
 }
Beispiel #3
0
        protected void btnSubmitResults_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("Click test");
            //System.Diagnostics.Debug.WriteLine(WorkoutChoices.GetActiveView().ToString());

            // string current = WorkoutChoices.GetActiveView().ID.ToString();

            HealthInputController controller = new HealthInputController(userID);
            string message    = "";
            bool   callPassed = true;

            switch (WorkoutChoices.GetActiveView().ID.ToString())
            {
            case "Welcome":
                System.Diagnostics.Debug.WriteLine("1");
                break;

            case "CardioWorkout":

                callPassed = controller.inputCardioWorkout(txtRoadRunning.Text, txtTreadmill.Text, txtCycling.Text, txtSwimming.Text, txtWalking.Text, txtRowing.Text, out message);
                if (callPassed)
                {
                    //Input is valid
                    string script = "alert(\"Success!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }
                else
                {
                    //Input invalid
                    System.Diagnostics.Debug.WriteLine(message);

                    string script = "alert(\"" + message + "\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }



                System.Diagnostics.Debug.WriteLine("2");
                break;

            case "StrengthWorkout":

                callPassed = controller.inputStrengthWorkout(txtClimbing.Text, txtBoxing.Text, txtPushups.Text, txtSitups.Text, txtWorkoutRoutine.Text, out message);
                if (callPassed)
                {
                    //Input is valid
                    string script = "alert(\"Success!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }
                else
                {
                    //Input invalid
                    System.Diagnostics.Debug.WriteLine(message);

                    string script = "alert(\"" + message + "\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }

                System.Diagnostics.Debug.WriteLine("3");
                break;

            case "WorkActivities":

                callPassed = controller.inputWorkActivities(txtComputerTime.Text, txtBreaksPerHour.Text, txtLunchTime.Text, txtWorkTime.Text, txtMeetingTime.Text, out message);
                if (callPassed)
                {
                    //Input is valid
                    string script = "alert(\"Success!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }
                else
                {
                    //Input invalid
                    System.Diagnostics.Debug.WriteLine(message);

                    string script = "alert(\"" + message + "\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }

                System.Diagnostics.Debug.WriteLine("4");
                break;


            case "HealthIndicators":

                callPassed = controller.inputHealthIndicators(txtWeight.Text, txtBMI.Text, txtSittingHeartRate.Text, txtWorkingHeartRate.Text, txtHeight.Text, txtSleep.Text, out message);
                if (callPassed)
                {
                    //Input is valid
                    string script = "alert(\"Success!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }
                else
                {
                    //Input invalid
                    System.Diagnostics.Debug.WriteLine(message);

                    string script = "alert(\"" + message + "\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }


                System.Diagnostics.Debug.WriteLine("5");
                break;

            case "CouchPotato":

                callPassed = controller.inputCouchPotato(txtComputerTimeHome.Text, txtTelevision.Text, txtChores.Text, out message);
                if (callPassed)
                {
                    //Input is valid
                    string script = "alert(\"Success!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }
                else
                {
                    //Input invalid
                    System.Diagnostics.Debug.WriteLine(message);

                    string script = "alert(\"" + message + "\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }

                System.Diagnostics.Debug.WriteLine("6");
                break;

            case "Injuries":

                if (panelList.Count == 0)
                {
                    string script = "alert(\"You have not clicked on any part!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                }
                else
                {
                    foreach (InjuryMiniPanel o in panelList)
                    {
                        injuryComments.Add(o.Name, o.txtInjury.Text);
                    }

                    callPassed = controller.inputInjury(injuryComments, out message);
                    if (callPassed)
                    {
                        //Input is valid
                        string script = "alert(\"Success!\");";
                        ScriptManager.RegisterStartupScript(this, GetType(),
                                                            "ServerControlScript", script, true);
                        pnlInjuryList.Controls.Clear();
                        panelList.Clear();
                        injurylist.Clear();
                    }
                    else
                    {
                        //Input invalid
                        System.Diagnostics.Debug.WriteLine(message);

                        string script = "alert(\"" + message + "\");";
                        ScriptManager.RegisterStartupScript(this, GetType(),
                                                            "ServerControlScript", script, true);
                    }
                }
                injuryComments.Clear();
                refreshList();

                System.Diagnostics.Debug.WriteLine("7");
                break;
            }

            //Response.Redirect("HealthInputReport.aspx");
            controller = null;
            GC.Collect();
        }