protected void initHeightPlot()
        {
            if (cmc == null) { cmc = new CommomMethodsClass(PersonInfo); }

            List<Double> hVal = new List<Double>();
            List<DateTime> dts = new List<DateTime>();
            List<Height> heights = cmc.GetValues<Height>(Height.TypeId);
            if (heights != null)
            {
                for (int i = 0; i < heights.Count; i++)
                {
                    hVal.Add(heights[i].Value.DisplayValue.Value);
                    dts.Add(heights[i].When.ToDateTime());
                }
            }

            Title chartTitle1 = new Title();
            chartTitle1.Text = "Height in Inches";
            hgraph.Titles.Add(chartTitle1);

            Series series4 = new Series("Spline1");
            series4.ChartType = SeriesChartType.Spline;
            series4.Points.DataBindXY(dts, hVal);
            series4.IsValueShownAsLabel = true;
            hgraph.Series.Add(series4);

            //hide grid lines
            hgraph.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
            hgraph.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
        }
Esempio n. 2
0
    private string userRole; // therapist or child

    #endregion Fields

    #region Methods

    //----------------------------------------------
    // FUNCTIONS
    //----------------------------------------------
    protected void Page_Load(object sender, EventArgs e)
    {
        // initialize user information
        cmc = new CommomMethodsClass(PersonInfo);
        userName = PersonInfo.Name;
        userRole = cmc.getRelationshipWithChild();

        System.Diagnostics.Debug.WriteLine("UserName: "******" UserRole: " + userRole);

        // initialize tabs
        // show/hide tabs given the user's role
        ((SiteMaster)Master).setTabsFromUserRole(userRole);

        // redirect to the appropriote dashboard
        switch (userRole)
        {
            case "Therapist":
                Response.Redirect("~/TherapistDashboard.aspx");
                break;
            case "Parent":
                Response.Redirect("~/ParentDashboard.aspx");
                break;
            case "Doctor":
                Response.Redirect("~/ParentIntervention.aspx");
                break;
            default:
                System.Diagnostics.Debug.WriteLine("Default: invalid user role " + userRole + ", exiting");
                break;
        };
    }
        //----------------------------------------------
        // FUNCTIONS
        //----------------------------------------------
        protected void Page_Load(object sender, EventArgs e)
        {
            cmc = new CommomMethodsClass(PersonInfo);
            rel = cmc.getRelationshipWithChild();
            userName.Text = PersonInfo.Name + "," + rel;

            cmc = new CommomMethodsClass(PersonInfo);
            rel = cmc.getRelationshipWithChild();
            //userName.Text = PersonInfo.Name + "," + rel;
            if (rel.Equals("Therapist"))
            {
                dp.ImageUrl = "~/images/therapists/" + PersonInfo.Name + ".jpg";
            }
            else
            {
                dp.ImageUrl = "~/images/" + cmc.getRelationshipWithChild() + ".jpg";
            }
        }
        protected void initVitalFields()
        {
            if (cmc == null) { cmc = new CommomMethodsClass(PersonInfo); }

            Basic basic = cmc.GetSingleValue<Basic>(Basic.TypeId);
            if (basic != null && basic.BirthYear.HasValue)
            {
                age = (DateTime.Today.Year - basic.BirthYear).ToString();
            }

            Weight w = cmc.GetSingleValue<Weight>(Weight.TypeId);
            if (w != null)
            {
                weight = w.Value.DisplayValue.Value.ToString();
            }

            Height h = cmc.GetSingleValue<Height>(Height.TypeId);
            if (h != null)
            {
                height = h.Value.DisplayValue.Value.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // initialize members
            if (cmc == null) { cmc = new CommomMethodsClass(PersonInfo); }
            if (m_surveyQuestionResults == null) { m_surveyQuestionResults = new SurveyQuestionResultStruct[8]; }

            if (!IsPostBack) // get values from HV
            {
                this.initFields();
                //set question text
                surveyQ1.SurveyQuestionText = m_surveyQuestionResults[0].surveyText;
                surveyQ2.SurveyQuestionText = m_surveyQuestionResults[1].surveyText;
                surveyQ3.SurveyQuestionText = m_surveyQuestionResults[2].surveyText;
                surveyQ4.SurveyQuestionText = m_surveyQuestionResults[3].surveyText;
                surveyQ5.SurveyQuestionText = m_surveyQuestionResults[4].surveyText;
                surveyQ6.SurveyQuestionText = m_surveyQuestionResults[5].surveyText;
                surveyQ7.SurveyQuestionText = m_surveyQuestionResults[6].surveyText;
                surveyQ8.SurveyQuestionText = m_surveyQuestionResults[7].surveyText;
            }
            /*
            //set questions
            m_surveyQuestionResults[0].surveyText = "1. How overactive or aroused was the child by the toys, people or the environment?";
            m_surveyQuestionResults[1].surveyText = "2. How vigilant / defensive was the child’s behavior?";
            m_surveyQuestionResults[2].surveyText = "3. How comfortable was the child exploring movement while playing?";
            m_surveyQuestionResults[3].surveyText = "4. How much discomfort, displeasure or sadness did the child present during play if you became unresponsive?";
            m_surveyQuestionResults[4].surveyText = "5. How often did the child initiate purposeful interactions through vocalisations and/or gestures?";
            m_surveyQuestionResults[5].surveyText = "6. How comfortable was the child exploring movement while playing?";
            m_surveyQuestionResults[6].surveyText = "7. How much did your child insists on his wish when you do not comply or play dumb?";
            m_surveyQuestionResults[7].surveyText = "8. How much joy does your child express during play when you propose the themes?";
            //set categories
            m_surveyQuestionResults[0].surveyCategory = "Self-Regulation";
            m_surveyQuestionResults[1].surveyCategory = "Self-Regulation";
            m_surveyQuestionResults[2].surveyCategory = "Self-Regulation";
            m_surveyQuestionResults[3].surveyCategory = "Relationships";
            m_surveyQuestionResults[4].surveyCategory = "Relationships";
            m_surveyQuestionResults[5].surveyCategory = "2 Way Communication";
            m_surveyQuestionResults[6].surveyCategory = "2 Way Communication";
            m_surveyQuestionResults[7].surveyCategory = "2 Way Communication";
             */
        }
        protected void initWeightPlot()
        {
            if (cmc == null) { cmc = new CommomMethodsClass(PersonInfo); }

            List<Double> wVal = new List<Double>();
            List<DateTime> dts1 = new List<DateTime>();
            List<Weight> weights = cmc.GetValues<Weight>(Weight.TypeId);
            if (weights != null)
            {
                for (int i = 0; i < weights.Count; i++)
                {
                    wVal.Add(weights[i].Value.DisplayValue.Value);
                    dts1.Add(weights[i].When.ToDateTime());
                }
            }

            Title chartTitle1 = new Title();
            chartTitle1.Text = "Weight in Pounds";
            wgraph.Titles.Add(chartTitle1);

            Series series5 = new Series("Spline1");
            series5.ChartType = SeriesChartType.Spline;
            series5.Points.DataBindXY(dts1, wVal);
            series5.IsValueShownAsLabel = true;
            wgraph.Series.Add(series5);

            //hide grid lines
            wgraph.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
            wgraph.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
        }
        protected void saveButton_clicked(object sender, EventArgs e)
        {
            if (cmc == null) { cmc = new CommomMethodsClass(PersonInfo); }

            Double weightInPounds = Double.Parse(weight);

            Weight weightHV = new Weight();
            weightHV.Value.Kilograms = weightInPounds / 2.204;
            weightHV.Value.DisplayValue = new DisplayValue(weightInPounds, "pounds");
            weightHV.When = new HealthServiceDateTime(DateTime.Today);
            PersonInfo.SelectedRecord.NewItem(weightHV);

            Double heightInInches = Double.Parse(height);

            Height heightHV = new Height(heightInInches/39.3701);
            heightHV.Value.DisplayValue = new DisplayValue(heightInInches, "inches");
            heightHV.When = new HealthServiceDateTime(DateTime.Today);
            PersonInfo.SelectedRecord.NewItem(heightHV);

            System.Diagnostics.Debug.Write(age + height + weight);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            cmc = new CommomMethodsClass(PersonInfo);

            // initalize vital fields
            if (!IsPostBack) // get values from HV
            {
                this.initVitalFields();
            }
            // otherwise, retreive values from UI
            else
            {
                age = ageBox.Text;
                height = heightBox.Text.Trim();
                weight = weightBox.Text.Trim();
            }
            ageBox.Text = age;
            heightBox.Text = height;
            weightBox.Text = weight;

            // initialize height and weight plots
            this.initHeightPlot();
            this.initWeightPlot();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            cmc = new CommomMethodsClass(PersonInfo);
            //userName.Text = PersonInfo.Name + ","+cmc.getRelationshipWithChild();
            startDt.Text = DateTime.Today.Date.ToShortDateString();
            endDt.Text = DateTime.Today.AddMonths(3).Date.ToShortDateString();
            settingsRow1.GoalTB = "How overactive or aroused was the child by the toys, people or the environment?";
            settingsRow1.CategoryTB= "Self-Regulation";
            settingsRow2.GoalTB = "How vigilant / defensive was the child’s behavior?";
            settingsRow2.CategoryTB= "Self-Regulation";
            settingsRow3.GoalTB = "How comfortable was the child exploring movement while playing?";
            settingsRow3.CategoryTB= "Self-Regulation";
            settingsRow4.GoalTB = "How much discomfort, displeasure or sadness did the child present during play if you became unresponsive?";
            settingsRow4.CategoryTB= "Relationships";
            settingsRow5.GoalTB = "How comfortable was the child with physical closeness contact?";
            settingsRow5.CategoryTB= "Relationships";
            settingsRow6.GoalTB = "How often did the child initiate purposeful interactions through vocalisations and/or gestures?";
            settingsRow6.CategoryTB= "2 Way Communication";
            settingsRow7.GoalTB = "How much did your child insists on his wish when you do not comply or play dumb?";
            settingsRow7.CategoryTB= "2 Way Communication";
            settingsRow8.GoalTB = "How much joy does your child xpress during play when you propose the themes?";
            settingsRow8.CategoryTB = "2 Way Communication";

            String rel = cmc.getRelationshipWithChild();

            if (rel.Equals("Doctor"))
            {
                DateTime chkDtFrom = DateTime.Today.AddDays(-7);
                List<HealthGoal> hgs = cmc.GetValues<HealthGoal>(HealthGoal.TypeId);
                var listOfUserControls1 = cmc.GetUserControls(Page);
                if (hgs != null)
                {
                    for (int i = 0; i < hgs.Count; i++)
                    {
                        HealthGoal h = hgs[i];
                        String dtString = h.StartDate.ToString();
                        DateTime dat = DateTime.Parse(dtString);
                        if (dat >= chkDtFrom && h.CommonData.Source.Equals("Parent"))
                        {
                            foreach (Control ctrl in listOfUserControls1)
                            {
                                if (ctrl.GetType().Name.Equals("controls_settingsmenu_ascx"))
                                {
                                    settingsMenu sm = ctrl as settingsMenu;
                                    if (sm.GoalTB.Equals(h.Description))
                                    {
                                        sm.BaseLineTB = h.TargetRange.Minimum.ToString();
                                        sm.ParentValueTB = h.TargetRange.Maximum.ToString();
                                    }
                                }
                            }
                        }
                    }
                }
            }

            var listOfUserControls = cmc.GetUserControls(Page);
            foreach (Control ctrl in listOfUserControls)
            {
                if (ctrl.GetType().Name.Equals("controls_settingsmenu_ascx"))
                {
                    if (rel.Equals("Parent"))
                    {
                        TextBox p = (TextBox)(ctrl.FindControl("finalValueTB"));
                        p.Enabled = false;
                    }
                    else
                    {
                        TextBox p = (TextBox)(ctrl.FindControl("parentValueTB"));
                        p.Enabled = false;
                    }

                }
            }

            List<Double> finalVal = new List<Double>();
            List<Double> propVal = new List<Double>();
            List<DateTime> dts = new List<DateTime>();
            try
            {
                List<HealthGoal> hgs = cmc.GetValues<HealthGoal>(HealthGoal.TypeId);
                if (hgs != null )
                {
                    for (int i = 0; i < hgs.Count; i++)
                    {
                        HealthGoal h = hgs[i];
                        if (h.CommonData.Source.Equals("Doctor"))
                        {
                            String dtString = h.StartDate.ToString();
                            DateTime dat = DateTime.Parse(dtString);
                            if (dts.Contains(dat))
                            {
                            }
                            else
                            {
                                dts.Add(dat);
                                List<Double> fTemp = new List<Double>();
                                List<Double> bTemp = new List<Double>();
                                for (int j = 0; j < hgs.Count; j++)
                                {
                                    HealthGoal hg = hgs[j];
                                    if (hg.CommonData.Source.Equals("Doctor") && hg.StartDate.ToString().Equals(dtString))
                                    {
                                        fTemp.Add(Double.Parse(h.TargetRange.Maximum.ToString()));
                                        bTemp.Add(Double.Parse(h.TargetRange.Minimum.ToString()));
                                    }
                                }
                                finalVal.Add(fTemp.Average());
                                propVal.Add(bTemp.Average());

                            }
                        }

                    }
                }
                else
                {
                    debugLBL.Text = "missing data";
                }

            }
            catch (HealthServiceException ex)
            {
            }

            Series series4 = new Series("Spline1");
            series4.ChartType = SeriesChartType.Spline;
            series4.Points.DataBindXY(dts, propVal);
            series4.LegendText = "Baseline";
            series4.IsValueShownAsLabel = true;
            graph1.Series.Add(series4);

            Series series5 = new Series("Spline2");
            series5.ChartType = SeriesChartType.Spline;
            series5.Points.DataBindXY(dts, finalVal);
            series5.LegendText = "Final Proposed Values";
            series5.IsValueShownAsLabel = true;
            graph1.Series.Add(series5);

            //hide grid lines
            graph1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
            graph1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
        }