Пример #1
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 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;
        }