Exemple #1
0
        /// <summary>
        /// Binds the question data to the rQuestions repeater control.
        /// </summary>
        private void BindRepeater()
        {
            String[,] questionData = DiscService.GetResponsesByQuestion();
            var dataSet   = new DataSet();
            var dataTable = dataSet.Tables.Add();
            var iRow      = questionData.GetLongLength(0);
            var iCol      = questionData.GetLongLength(1);

            dataTable.Columns.Add("r1");   //Response 1
            dataTable.Columns.Add("r2");   //Response 2
            dataTable.Columns.Add("r3");   //Response 3
            dataTable.Columns.Add("r4");   //Response 4
            dataTable.Columns.Add("ms");   //Most Scores
            dataTable.Columns.Add("ls");   //Least Scores

            //Row
            for (var r = 0; r < iRow; r++)
            {
                var row = dataTable.Rows.Add();
                //Column
                for (var c = 0; c < iCol; c++)
                {
                    row[c] = questionData[r, c];
                }
            }

            rQuestions.DataSource = dataSet.Tables[0];
            rQuestions.DataBind();
        }
Exemple #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // otherwise use the currently logged in person
            if (CurrentPerson != null)
            {
                _targetPerson = CurrentPerson;
            }
            else
            {
                nbError.Visible         = true;
                pnlInstructions.Visible = false;
                pnlQuestions.Visible    = false;
                pnlResults.Visible      = false;
            }

            if (_targetPerson != null)
            {
                DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(_targetPerson);

                if (savedScores.LastSaveDate <= DateTime.MinValue || !string.IsNullOrWhiteSpace(PageParameter("RetakeDisc")))
                {
                    ShowInstructions();
                }
                else
                {
                    ShowResults(savedScores);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Shows the questions.
        /// </summary>
        private void ShowQuestions()
        {
            pnlInstructions.Visible = false;
            pnlQuestions.Visible    = true;

            Random r = new Random();

            AssessmentResponses = DiscService.GetResponses()
                                  .GroupBy(a => a.QuestionNumber)
                                  .Select(a => new AssessmentResponse()
            {
                QuestionNumber = a.Key,
                Questions      = a.OrderBy(x => r.Next(0, 4)).ToDictionary(c => c.MostScore, b => b.ResponseText)
            }).ToList();

            // If _maxQuestions has not been set yet...
            if (QuestionCount == 0 && AssessmentResponses != null)
            {
                // Set the max number of questions to be no greater than the actual number of questions.
                int numQuestions = this.GetAttributeValue(NUMBER_OF_QUESTIONS).AsInteger();
                QuestionCount = (numQuestions > AssessmentResponses.Count) ? AssessmentResponses.Count : numQuestions;
            }

            BindRepeater(0);
        }
Exemple #4
0
        public DvdSource(DiscService service, DvdModel model)
            : base(service, (DiscModel) model, Catalog.GetString ("DVD"), model.Title, 58)
        {
            TypeUniqueId = "";

            SetupGui ();
            model.LoadModelFromDisc ();
        }
 /// <summary>
 /// Shows the results of the assessment test.
 /// </summary>
 /// <param name="savedScores">The saved scores.</param>
 private void ShowResults(DiscService.AssessmentResults savedScores)
 {
     // Plot the Natural graph
     DiscService.PlotOneGraph(discNaturalScore_D, discNaturalScore_I, discNaturalScore_S, discNaturalScore_C,
                              savedScores.NaturalBehaviorD, savedScores.NaturalBehaviorI, savedScores.NaturalBehaviorS,
                              savedScores.NaturalBehaviorC, 35);
     ShowExplaination(savedScores.PersonalityType);
 }
Exemple #6
0
        public DvdSource(DiscService service, DvdModel model)
            : base(service, (DiscModel)model, Catalog.GetString("DVD"), model.Title, 58)
        {
            TypeUniqueId = "";

            SetupGui();
            model.LoadModelFromDisc();
        }
Exemple #7
0
        /// <summary>
        /// Handles the Click event of the btnNext control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void btnNext_Click(object sender, EventArgs e)
        {
            int pageNumber = hfPageNo.ValueAsInt() + 1;

            GetResponse();

            LinkButton btn             = ( LinkButton )sender;
            string     commandArgument = btn.CommandArgument;

            var totalQuestion = pageNumber * QuestionCount;

            if ((AssessmentResponses.Count > totalQuestion && !AssessmentResponses.All(a => !string.IsNullOrEmpty(a.MostScore) && !string.IsNullOrEmpty(a.LeastScore))) || "Next".Equals(commandArgument))
            {
                BindRepeater(pageNumber);
            }
            else
            {
                try
                {
                    var moreD = AssessmentResponses.Where(a => a.MostScore == "D").Count();
                    var moreI = AssessmentResponses.Where(a => a.MostScore == "I").Count();
                    var moreS = AssessmentResponses.Where(a => a.MostScore == "S").Count();
                    var moreC = AssessmentResponses.Where(a => a.MostScore == "C").Count();
                    var lessD = AssessmentResponses.Where(a => a.LeastScore == "D").Count();
                    var lessI = AssessmentResponses.Where(a => a.LeastScore == "I").Count();
                    var lessS = AssessmentResponses.Where(a => a.LeastScore == "S").Count();
                    var lessC = AssessmentResponses.Where(a => a.LeastScore == "C").Count();
                    // Score the responses and return the results
                    DiscService.AssessmentResults results = DiscService.Score(moreD, moreI, moreS, moreC, lessD, lessI, lessS, lessC);

                    // Now save the results for this person
                    DiscService.SaveAssessmentResults(
                        _targetPerson,
                        results.AdaptiveBehaviorD.ToString(),
                        results.AdaptiveBehaviorI.ToString(),
                        results.AdaptiveBehaviorS.ToString(),
                        results.AdaptiveBehaviorC.ToString(),
                        results.NaturalBehaviorD.ToString(),
                        results.NaturalBehaviorI.ToString(),
                        results.NaturalBehaviorS.ToString(),
                        results.NaturalBehaviorC.ToString(),
                        results.PersonalityType
                        );
                    ShowResults(results);
                }
                catch (Exception ex)
                {
                    nbError.Visible = true;
                    nbError.Title   = "We're Sorry...";
                    nbError.Text    = "Something went wrong while trying to save your test results.";
                    LogException(ex);
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Shows the results of the assessment test.
        /// </summary>
        /// <param name="savedScores">The saved scores.</param>
        private void ShowResults(DiscService.AssessmentResults savedScores)
        {
            // Plot the Natural graph
            DiscService.PlotOneGraph(discNaturalScore_D, discNaturalScore_I, discNaturalScore_S, discNaturalScore_C,
                                     savedScores.NaturalBehaviorD, savedScores.NaturalBehaviorI, savedScores.NaturalBehaviorS, savedScores.NaturalBehaviorC, 35);
            ShowExplaination(savedScores.PersonalityType);

            hlAssessmentDate.Text = String.Format("Assessment Date: {0}", savedScores.LastSaveDate.ToShortDateString());
            lPersonName.Text      = _targetPerson.FullName;

            lHeading.Text = string.Format("<div class='disc-heading'><h1>{0}</h1><h4>Personality Type: {1}</h4></div>", _targetPerson.FullName, savedScores.PersonalityType);
        }
Exemple #9
0
 /// <summary>
 /// Plots the graphs using the Disc score results.
 /// </summary>
 /// <param name="results">The results.</param>
 private void PlotGraph(DiscService.AssessmentResults results)
 {
     // Plot the Natural graph
     DiscService.PlotOneGraph(
         discNaturalScore_D,
         discNaturalScore_I,
         discNaturalScore_S,
         discNaturalScore_C,
         results.NaturalBehaviorD,
         results.NaturalBehaviorI,
         results.NaturalBehaviorS,
         results.NaturalBehaviorC,
         100);
 }
Exemple #10
0
 protected void btnSaveResults_Click(object sender, EventArgs e)
 {
     DiscService.SaveAssessmentResults(
         CurrentPerson,
         lblABd.Text,
         lblABi.Text,
         lblABs.Text,
         lblABc.Text,
         lblNBd.Text,
         lblNBi.Text,
         lblNBs.Text,
         lblNBc.Text
         );
 }
        /// <summary>
        /// Update the Disc Natural Score
        /// </summary>
        public void UpdateDiscNaturalScore()
        {
            //Natural D
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("86670F7D-07BA-4ECE-9BB9-9D94B5FB5F26"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetNaturalScoreValue(DiscService.AttributeKeys.NaturalD, Convert.ToInt32(Math.Round((27 - a.Value.AsDecimal() * 0.78m), 0))).ToString();
                });
                rockContext.SaveChanges();
            }

            //Natural S
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("FA4341B4-28C7-409E-A101-548BB5759BE6"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetNaturalScoreValue(DiscService.AttributeKeys.NaturalS, Convert.ToInt32(Math.Round((27 - a.Value.AsDecimal() * 0.78m), 0))).ToString();
                });
                rockContext.SaveChanges();
            }

            //Natural I
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("3EFF4FEF-EE4C-40E2-8DBD-80F3276852DA"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetNaturalScoreValue(DiscService.AttributeKeys.NaturalI, Convert.ToInt32(Math.Round((26 - a.Value.AsDecimal() * 0.78m), 0))).ToString();
                });
                rockContext.SaveChanges();
            }

            //Natural C
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("3A10ECFB-8CAB-4CCA-8B29-298756CD3251"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetNaturalScoreValue(DiscService.AttributeKeys.NaturalC, Convert.ToInt32(Math.Round((26 - a.Value.AsDecimal() * 0.78m), 0))).ToString();
                });
                rockContext.SaveChanges();
            }
        }
        /// <summary>
        /// Update the Disc Adaptive Score
        /// </summary>
        public void UpdateDiscAdaptiveScore()
        {
            //Adaptive D
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("EDE5E199-37BE-424F-A788-5CDCC064157C"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetAdaptiveScoreValue(DiscService.AttributeKeys.AdaptiveD, Convert.ToInt32(Math.Round(a.Value.AsDecimal() * 0.28m, 0))).ToString();
                });
                rockContext.SaveChanges();
            }

            //Adaptive S
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("2512DAC6-BBC4-4D0E-A01D-E92F94C534BD"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetAdaptiveScoreValue(DiscService.AttributeKeys.AdaptiveS, Convert.ToInt32(Math.Round(a.Value.AsDecimal() * 0.28m, 0))).ToString();
                });
                rockContext.SaveChanges();
            }

            //Adaptive I
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("7F0A1794-0150-413B-9AE1-A6B0D6373DA6"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetAdaptiveScoreValue(DiscService.AttributeKeys.AdaptiveI, Convert.ToInt32(Math.Round(a.Value.AsDecimal() * 0.28m, 0))).ToString();
                });
                rockContext.SaveChanges();
            }

            //Adaptive C
            using (var rockContext = new Rock.Data.RockContext())
            {
                var attribute       = new AttributeService(rockContext).Get(new Guid("4A2E1539-4ECC-40B9-9EBD-C0C84EC8DA36"));
                var attributeValues = new AttributeValueService(rockContext).Queryable().Where(b => b.AttributeId == attribute.Id && b.Value != string.Empty);
                attributeValues.ToList().ForEach(a => {
                    a.Value = DiscService.GetAdaptiveScoreValue(DiscService.AttributeKeys.AdaptiveC, Convert.ToInt32(Math.Round(a.Value.AsDecimal() * 0.28m, 0))).ToString();
                });
                rockContext.SaveChanges();
            }
        }
Exemple #13
0
        // used for public / protected properties

        #endregion

        #region Base Control Methods

        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            string personKey = PageParameter("rckipid");

            if (!string.IsNullOrEmpty(personKey))
            {
                try
                {
                    _targetPerson = new PersonService(new RockContext()).GetByUrlEncodedKey(personKey);
                }
                catch
                {
                    nbError.Visible = true;
                }
            }
            else
            {
                // otherwise use the currently logged in person
                if (CurrentPerson != null)
                {
                    _targetPerson = CurrentPerson;
                }
                else
                {
                    nbError.Visible = true;
                }
            }

            if (_targetPerson != null)
            {
                DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(_targetPerson);

                if (savedScores.LastSaveDate <= DateTime.MinValue || !string.IsNullOrWhiteSpace(PageParameter("RetakeDisc")))
                {
                    ShowInstructions();
                }
                else
                {
                    ShowResults(savedScores);
                }
            }
        }
Exemple #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Checks if RockPage IsPostBack (making the assumption that the PostBack is because the
            //  'Score Test' button was clicked.
            //Tell Javascript that the page is posted back or not.
            // See:  http://stackoverflow.com/questions/59719/how-can-i-check-for-ispostback-in-javascript
            string script = IsPostBack ? "var isScored = true;" : "var isScored = false;";

            Page.ClientScript.RegisterStartupScript(GetType(), "IsScored", script, true);

            //Add reference to my JS file
            RockPage.AddScriptLink("~/Blocks/Crm/DiscAssessment/scripts/disc.js");

            //Yup, build question table
            buildQuestionTable();

            DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(CurrentPerson);

            if (savedScores.LastSaveDate > DateTime.MinValue)
            {
                //build last results table
                lblLastAssessmentDate.Text = savedScores.LastSaveDate.ToString("MM/dd/yyyy");

                lblPrevABd.Text = savedScores.AdaptiveBehaviorD.ToString();
                lblPrevABi.Text = savedScores.AdaptiveBehaviorI.ToString();
                lblPrevABs.Text = savedScores.AdaptiveBehaviorS.ToString();
                lblPrevABc.Text = savedScores.AdaptiveBehaviorC.ToString();

                lblPrevNBd.Text = savedScores.NaturalBehaviorD.ToString();
                lblPrevNBi.Text = savedScores.NaturalBehaviorI.ToString();
                lblPrevNBs.Text = savedScores.NaturalBehaviorS.ToString();
                lblPrevNBc.Text = savedScores.NaturalBehaviorC.ToString();
            }

            if (IsPostBack)
            {
                btnSaveResults.Enabled = true;
            }
            else
            {
                btnSaveResults.Enabled = false;
            }
        }
Exemple #15
0
        /// <summary>
        /// Gets checked RadioButtons, scores test, and displays results.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnScoreTest_Click(object sender, EventArgs e)
        {
            List <DiscService.ResponseItem> responses = DiscService.GetResponses();
            List <string> selectedResponseIDs         = new List <string>();

            // Collect selected responses into a string array.
            // All we need is the selected RadioButton's ID (which we set to the ResponseID + ("l" or "m") for each responses record).
            //   Examples: "012m", "130l"
            // We now know the selected response and whether it was 'm'ost or 'l'east.
            foreach (DiscService.ResponseItem response in responses)
            {
                string      rbID = response.ResponseID + "m";
                RadioButton rb   = findRadioButton(this, rbID);
                if (rb.Checked)
                {
                    selectedResponseIDs.Add(rb.ID);
                }

                rbID = response.ResponseID + "l";
                rb   = findRadioButton(this, rbID);
                if (rb.Checked)
                {
                    selectedResponseIDs.Add(rb.ID);
                }
            }

            // Score the responses and return the results
            DiscService.AssessmentResults results = DiscService.Score(selectedResponseIDs);

            //Display results out to user
            lblABd.Text = results.AdaptiveBehaviorD.ToString();
            lblABi.Text = results.AdaptiveBehaviorI.ToString();
            lblABs.Text = results.AdaptiveBehaviorS.ToString();
            lblABc.Text = results.AdaptiveBehaviorC.ToString();

            lblNBd.Text = results.NaturalBehaviorD.ToString();
            lblNBi.Text = results.NaturalBehaviorI.ToString();
            lblNBs.Text = results.NaturalBehaviorS.ToString();
            lblNBc.Text = results.NaturalBehaviorC.ToString();
        }
Exemple #16
0
        /// <summary>
        /// Builds a table with the questions listed.
        /// </summary>
        private void buildQuestionTable()
        {
            List <DiscService.ResponseItem> responses = DiscService.GetResponses();

            TableRow  tr = new TableRow();
            TableCell tc = new TableCell();

            foreach (DiscService.ResponseItem response in responses)
            {
                // If we are processing the first response in each question, build a question header
                if (response.ResponseNumber == "1")
                {
                    tr            = new TableRow();
                    tc            = new TableCell();
                    tc.ColumnSpan = 3;
                    tc.Text       = "Question " + response.QuestionNumber;
                    tc.BackColor  = System.Drawing.Color.LightGray;
                    tr.Cells.Add(tc);
                    tc.ID = "q" + response.QuestionNumber;
                    tblQuestions.Rows.Add(tr);

                    tr      = new TableRow();
                    tc      = new TableCell();
                    tc.Text = "";
                    tr.Cells.Add(tc);
                    tc      = new TableCell();
                    tc.Text = "MOST";
                    tr.Cells.Add(tc);
                    tc      = new TableCell();
                    tc.Text = "LEAST";
                    tr.Cells.Add(tc);
                    tblQuestions.Rows.Add(tr);
                }

                buildRadioButtonTableRow(response);
            }
        }
Exemple #17
0
        // used for public / protected properties

        #endregion

        #region Base Control Methods

        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            string personKey = PageParameter("Person");

            if (!string.IsNullOrEmpty(personKey))
            {
                try
                {
                    _targetPerson = new PersonService(new RockContext()).GetByUrlEncodedKey(personKey);
                }
                catch (Exception)
                {
                    nbError.Visible = true;
                }
            }
            else
            {
                // otherwise use the currently logged in person
                if (CurrentPerson != null)
                {
                    _targetPerson = CurrentPerson;
                }
                else
                {
                    nbError.Visible = true;
                }
            }

            if (_targetPerson != null)
            {
                pnlResults.Visible = true;
                DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(_targetPerson);
                ShowResults(savedScores);
            }
        }
Exemple #18
0
        /// <summary>
        /// Shows the assessment.
        /// A null value for _targetPerson is already handled in OnInit() so this method assumes there is a value
        /// </summary>
        private void ShowAssessment()
        {
            /*
             * 2020-01-09 - ETD
             * This block will either show the assessment results of the most recent assessment test or give the assessment test.
             * The following use cases are considered:
             * 1. If the assessment ID "0" was provided then create a new test for the current user. This covers user directed retakes.
             * 2. If the assessment ID was provided and is not "0"
             *  Note: The assessment results are stored on the person's attributes and are overwritten if the assessment is retaken. So past Assessments will not be loaded by this block.
             *  The test data is saved in the assessment table but would need to be recomputed, which may be a future feature.
             *  a. The assessment ID is ignored and the current person is used.
             *  b. If the assessment exists for the current person and is completed then show the results
             *  c. If the assessment exists for the current person and is pending then show the questions.
             *  d. If the assessment does not exist for the current person then nothing loads.
             * 3. If the assessment ID was not provided and the PersonKey was provided
             *  a. If there is only one test of the type
             *      1. If the assessment is completed show the results
             *      2. If the assessment is pending and the current person is the one assigned the test then show the questions.
             *      3. If the assessment is pending and the current person is not the one assigned then show a message that the test has not been completed.
             *  b. If more than one of type
             *      1. If the latest requested assessment is completed show the results.
             *      2. If the latest requested assessment is pending and the current person is the one assigned then show the questions.
             *      3. If the latest requested assessment is pending and the current person is not the one assigned the show the results of the last completed test.
             *      4. If the latest requested assessment is pending and the current person is not the one assigned and there are no previous completed assessments then show a message that the test has not been completed.
             * 4. If an assessment ID or PersonKey were not provided or are not valid then show an error message
             */

            var        rockContext    = new RockContext();
            var        assessmentType = new AssessmentTypeService(rockContext).Get(Rock.SystemGuid.AssessmentType.DISC.AsGuid());
            Assessment assessment     = null;
            Assessment previouslyCompletedAssessment = null;

            // A "0" value indicates that the block should create a new assessment instead of looking for an existing one, so keep assessment null. e.g. a user directed re-take
            if (_assessmentId != 0)
            {
                var assessments = new AssessmentService(rockContext)
                                  .Queryable()
                                  .AsNoTracking()
                                  .Where(a => a.PersonAlias != null &&
                                         a.PersonAlias.PersonId == _targetPerson.Id &&
                                         a.AssessmentTypeId == assessmentType.Id)
                                  .OrderByDescending(a => a.CompletedDateTime ?? a.RequestedDateTime)
                                  .ToList();

                if (_assessmentId == null && assessments.Count == 0)
                {
                    // For this to happen the user has to have never taken the assessment, the user isn't using a link with the assessment ID, AND they are arriving at the block directly rather than through the assessment list block.
                    // So treat this as a user directed take/retake.
                    _assessmentId = 0;
                }
                else
                {
                    if (assessments.Count > 0)
                    {
                        // If there are any results then pick the first one. If the assesement ID was specified then the query will only return one result
                        assessment = assessments[0];
                    }
                    if (assessments.Count > 1)
                    {
                        // If there are more than one result then we need to pick the right one (see developer note)
                        // If the most recent assessment is "Completed" then it is already set as the assessment and we can move on. Otherwise check if there are previoulsy completed assessments.
                        if (assessment.Status == AssessmentRequestStatus.Pending)
                        {
                            // If the most recent assessment is pending then check for a prior completed one
                            previouslyCompletedAssessment = assessments.Where(a => a.Status == AssessmentRequestStatus.Complete).FirstOrDefault();
                        }
                    }
                }
            }

            if (assessment == null)
            {
                // If assessment is null and _assessmentId = 0 this is user directed. If the type does not require a request then show instructions
                if (_assessmentId == 0 && !assessmentType.RequiresRequest)
                {
                    hfAssessmentId.SetValue(0);
                    ShowInstructions();
                }
                else
                {
                    // If assessment is null and _assessmentId != 0 or is 0 but the type does require a request then show requires request error
                    HidePanelsAndShowError("Sorry, this test requires a request from someone before it can be taken.");
                }

                return;
            }

            hfAssessmentId.SetValue(assessment.Id);

            // If assessment is completed show the results
            if (assessment.Status == AssessmentRequestStatus.Complete)
            {
                DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(_targetPerson);
                ShowResult(savedScores, assessment);
                return;
            }

            if (assessment.Status == AssessmentRequestStatus.Pending)
            {
                if (_targetPerson.Id != CurrentPerson.Id)
                {
                    // If assessment is pending and the current person is not the one assigned the show previouslyCompletedAssessment results
                    if (previouslyCompletedAssessment != null)
                    {
                        DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(_targetPerson);
                        ShowResult(savedScores, previouslyCompletedAssessment, true);
                        return;
                    }

                    // If assessment is pending and the current person is not the one assigned and previouslyCompletedAssessment is null show a message that the test has not been completed.
                    HidePanelsAndShowError(string.Format("{0} has not yet taken the {1} Assessment.", _targetPerson.FullName, assessmentType.Title));
                }
                else
                {
                    // If assessment is pending and the current person is the one assigned then show the questions
                    ShowInstructions();
                }

                return;
            }

            // This should never happen, if the block gets to this point then something is not right
            HidePanelsAndShowError("Unable to load assessment");
        }
Exemple #19
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                var        rockContext    = new RockContext();
                var        assessmentType = new AssessmentTypeService(rockContext).Get(Rock.SystemGuid.AssessmentType.DISC.AsGuid());
                Assessment assessment     = null;

                if (_targetPerson != null)
                {
                    var primaryAliasId = _targetPerson.PrimaryAliasId;

                    if (_assessmentId == 0)
                    {
                        // This indicates that the block should create a new assessment instead of looking for an existing one. e.g. a user directed re-take
                        assessment = null;
                    }
                    else
                    {
                        // Look for an existing pending or completed assessment.
                        assessment = new AssessmentService(rockContext)
                                     .Queryable()
                                     .Where(a => (_assessmentId.HasValue && a.Id == _assessmentId) || (a.PersonAliasId == primaryAliasId && a.AssessmentTypeId == assessmentType.Id))
                                     .OrderByDescending(a => a.CreatedDateTime)
                                     .FirstOrDefault();
                    }

                    if (assessment != null)
                    {
                        hfAssessmentId.SetValue(assessment.Id);
                    }
                    else
                    {
                        hfAssessmentId.SetValue(0);
                    }

                    if (assessment != null && assessment.Status == AssessmentRequestStatus.Complete)
                    {
                        DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(_targetPerson);
                        ShowResult(savedScores, assessment);
                    }
                    else if ((assessment == null && !assessmentType.RequiresRequest) || (assessment != null && assessment.Status == AssessmentRequestStatus.Pending))
                    {
                        if (_targetPerson.Id != CurrentPerson.Id)
                        {
                            // If the current person is not the target person and there are no results to show then show a not taken message.
                            HidePanelsAndShowError(string.Format("{0} does not have results for the EQ Inventory Assessment.", _targetPerson.FullName));
                        }
                        else
                        {
                            ShowInstructions();
                        }
                    }
                    else
                    {
                        HidePanelsAndShowError("Sorry, this test requires a request from someone before it can be taken.");
                    }
                }
            }
            else
            {
                // Hide notification panels on every postback
                nbError.Visible = false;
            }
        }
Exemple #20
0
        /// <summary>
        /// Handles the Click event of the btnNext control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        protected void btnNext_Click(object sender, EventArgs e)
        {
            int pageNumber = hfPageNo.ValueAsInt() + 1;

            GetResponse();

            LinkButton btn             = ( LinkButton )sender;
            string     commandArgument = btn.CommandArgument;

            var totalQuestion = pageNumber * QuestionCount;

            if ((_assessmentResponses.Count > totalQuestion && !_assessmentResponses.All(a => !string.IsNullOrEmpty(a.MostScore) && !string.IsNullOrEmpty(a.LeastScore))) || "Next".Equals(commandArgument))
            {
                BindRepeater(pageNumber);
            }
            else
            {
                try
                {
                    var moreD = _assessmentResponses.Where(a => a.MostScore == "D").Count();
                    var moreI = _assessmentResponses.Where(a => a.MostScore == "I").Count();
                    var moreS = _assessmentResponses.Where(a => a.MostScore == "S").Count();
                    var moreC = _assessmentResponses.Where(a => a.MostScore == "C").Count();
                    var lessD = _assessmentResponses.Where(a => a.LeastScore == "D").Count();
                    var lessI = _assessmentResponses.Where(a => a.LeastScore == "I").Count();
                    var lessS = _assessmentResponses.Where(a => a.LeastScore == "S").Count();
                    var lessC = _assessmentResponses.Where(a => a.LeastScore == "C").Count();

                    // Score the responses and return the results
                    DiscService.AssessmentResults results = DiscService.Score(moreD, moreI, moreS, moreC, lessD, lessI, lessS, lessC);

                    // Now save the results for this person
                    DiscService.SaveAssessmentResults(
                        _targetPerson,
                        results.AdaptiveBehaviorD.ToString(),
                        results.AdaptiveBehaviorI.ToString(),
                        results.AdaptiveBehaviorS.ToString(),
                        results.AdaptiveBehaviorC.ToString(),
                        results.NaturalBehaviorD.ToString(),
                        results.NaturalBehaviorI.ToString(),
                        results.NaturalBehaviorS.ToString(),
                        results.NaturalBehaviorC.ToString(),
                        results.PersonalityType);

                    var assessmentData = _assessmentResponses.ToDictionary(a => a.QuestionNumber, b => new { Most = new string[2] {
                                                                                                                 b.MostScore, b.Questions[b.MostScore]
                                                                                                             }, Least = new string[2] {
                                                                                                                 b.LeastScore, b.Questions[b.LeastScore]
                                                                                                             } });
                    var rockContext = new RockContext();

                    var        assessmentService = new AssessmentService(rockContext);
                    Assessment assessment        = null;

                    if (hfAssessmentId.ValueAsInt() != 0)
                    {
                        assessment = assessmentService.Get(int.Parse(hfAssessmentId.Value));
                    }

                    if (assessment == null)
                    {
                        var assessmentType = new AssessmentTypeService(rockContext).Get(Rock.SystemGuid.AssessmentType.DISC.AsGuid());
                        assessment = new Assessment()
                        {
                            AssessmentTypeId = assessmentType.Id,
                            PersonAliasId    = _targetPerson.PrimaryAliasId.Value
                        };
                        assessmentService.Add(assessment);
                    }

                    assessment.Status               = AssessmentRequestStatus.Complete;
                    assessment.CompletedDateTime    = RockDateTime.Now;
                    assessment.AssessmentResultData = new { Result = assessmentData, TimeToTake = RockDateTime.Now.Subtract(StartDateTime).TotalSeconds }.ToJson();
                    rockContext.SaveChanges();

                    ShowResult(results, assessment);
                }
                catch (Exception ex)
                {
                    nbError.Visible = true;
                    nbError.Title   = "We're Sorry...";
                    nbError.Text    = "Something went wrong while trying to save your test results.";
                    LogException(ex);
                }
            }
        }
Exemple #21
0
        /// <summary>
        /// Scores test, and displays results.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnScoreTest_Click(object sender, EventArgs e)
        {
            try
            {
                int moreN = 0;
                int moreD = 0;
                int moreI = 0;
                int moreS = 0;
                int moreC = 0;
                int lessN = 0;
                int lessD = 0;
                int lessI = 0;
                int lessS = 0;
                int lessC = 0;

                foreach (RepeaterItem rItem in rQuestions.Items)
                {
                    RockRadioButtonList rblMore1 = rItem.FindControl("rblMore1") as RockRadioButtonList;
                    RockRadioButtonList rblMore2 = rItem.FindControl("rblMore2") as RockRadioButtonList;
                    RockRadioButtonList rblMore3 = rItem.FindControl("rblMore3") as RockRadioButtonList;
                    RockRadioButtonList rblMore4 = rItem.FindControl("rblMore4") as RockRadioButtonList;

                    RockRadioButtonList rblLess1 = rItem.FindControl("rblLess1") as RockRadioButtonList;
                    RockRadioButtonList rblLess2 = rItem.FindControl("rblLess2") as RockRadioButtonList;
                    RockRadioButtonList rblLess3 = rItem.FindControl("rblLess3") as RockRadioButtonList;
                    RockRadioButtonList rblLess4 = rItem.FindControl("rblLess4") as RockRadioButtonList;

                    string selectedMoreValue = GetSelectedValue(rblMore1, rblMore2, rblMore3, rblMore4);
                    string selectedLessValue = GetSelectedValue(rblLess1, rblLess2, rblLess3, rblLess4);

                    switch (selectedMoreValue)
                    {
                    case "N":
                        moreN++;
                        break;

                    case "D":
                        moreD++;
                        break;

                    case "I":
                        moreI++;
                        break;

                    case "S":
                        moreS++;
                        break;

                    case "C":
                        moreC++;
                        break;

                    default:
                        break;
                    }

                    switch (selectedLessValue)
                    {
                    case "N":
                        lessN++;
                        break;

                    case "D":
                        lessD++;
                        break;

                    case "I":
                        lessI++;
                        break;

                    case "S":
                        lessS++;
                        break;

                    case "C":
                        lessC++;
                        break;

                    default:
                        break;
                    }
                }

                // Score the responses and return the results
                DiscService.AssessmentResults results = DiscService.Score(moreN, moreD, moreI, moreS, moreC, lessN, lessD, lessI, lessS, lessC);

                // Now save the results for this person
                DiscService.SaveAssessmentResults(
                    _targetPerson,
                    results.AdaptiveBehaviorD.ToString(),
                    results.AdaptiveBehaviorI.ToString(),
                    results.AdaptiveBehaviorS.ToString(),
                    results.AdaptiveBehaviorC.ToString(),
                    results.NaturalBehaviorD.ToString(),
                    results.NaturalBehaviorI.ToString(),
                    results.NaturalBehaviorS.ToString(),
                    results.NaturalBehaviorC.ToString(),
                    results.PersonalityType
                    );

                // Show the results
                ShowResults(results);
            }
            catch (Exception ex)
            {
                nbError.Visible = true;
                nbError.Title   = "We're Sorry...";
                nbError.Text    = "Something went wrong while trying to save your test results.";
                LogException(ex);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var shapePageReference = new Rock.Web.PageReference(GetAttributeValue("SHAPEAssessmentPage"));
            var discPageReference  = new Rock.Web.PageReference(GetAttributeValue("DISCAssessmentPage"));

            if (!string.IsNullOrWhiteSpace(PageParameter("FormId")))
            {
                //Load the person based on the FormId
                var personInUrl = PageParameter("FormId");
                SelectedPerson   = GetPersonFromForm(personInUrl);
                PersonEncodedKey = SelectedPerson.UrlEncodedKey;
            }

            else if (!string.IsNullOrWhiteSpace(PageParameter("PersonId")))
            {
                //Load the person based on the PersonId
                SelectedPerson   = GetPersonFromId(PageParameter("PersonId"));
                PersonEncodedKey = SelectedPerson.UrlEncodedKey;
            }

            else if (CurrentPerson != null)
            {
                //Load the person based on the currently logged in person
                SelectedPerson   = CurrentPerson;
                PersonEncodedKey = SelectedPerson.UrlEncodedKey;
            }

            else
            {
                //Show Error Message
                nbNoPerson.Visible = true;
                Response.Redirect(shapePageReference.BuildUrl(), true);
                return;
            }



            // Load the attributes

            AttributeValueService attributeValueService = new AttributeValueService(rockContext);
            DefinedValueService   definedValueService   = new DefinedValueService(rockContext);



            string spiritualGift1  = "";
            string spiritualGift2  = "";
            string spiritualGift3  = "";
            string spiritualGift4  = "";
            string heartCategories = "";
            string heartCauses     = "";
            string heartPassion    = "";
            string ability1        = "";
            string ability2        = "";
            string people          = "";
            string places          = "";
            string events          = "";

            var spiritualGift1AttributeValue =
                attributeValueService
                .Queryable()
                .FirstOrDefault(a => a.Attribute.Key == "SpiritualGift1" && a.EntityId == SelectedPerson.Id);

            // Redirect if they haven't taken the Assessment
            if (spiritualGift1AttributeValue == null)
            {
                Response.Redirect(shapePageReference.BuildUrl(), true);
            }

            else
            {
                var spiritualGift2AttributeValue =
                    attributeValueService
                    .Queryable()
                    .FirstOrDefault(a => a.Attribute.Key == "SpiritualGift2" && a.EntityId == SelectedPerson.Id);

                var spiritualGift3AttributeValue =
                    attributeValueService
                    .Queryable()
                    .FirstOrDefault(a => a.Attribute.Key == "SpiritualGift3" && a.EntityId == SelectedPerson.Id);

                var spiritualGift4AttributeValue =
                    attributeValueService
                    .Queryable()
                    .FirstOrDefault(a => a.Attribute.Key == "SpiritualGift4" && a.EntityId == SelectedPerson.Id);

                var ability1AttributeValue =
                    attributeValueService
                    .Queryable().FirstOrDefault(a => a.Attribute.Key == "Ability1" && a.EntityId == SelectedPerson.Id);

                var ability2AttributeValue =
                    attributeValueService
                    .Queryable().FirstOrDefault(a => a.Attribute.Key == "Ability2" && a.EntityId == SelectedPerson.Id);

                var peopleAttributeValue = attributeValueService
                                           .Queryable()
                                           .FirstOrDefault(a => a.Attribute.Key == "SHAPEPeople" && a.EntityId == SelectedPerson.Id);

                var placesAttributeValue = attributeValueService
                                           .Queryable()
                                           .FirstOrDefault(a => a.Attribute.Key == "SHAPEPlaces" && a.EntityId == SelectedPerson.Id);

                var eventsAttributeValue = attributeValueService
                                           .Queryable()
                                           .FirstOrDefault(a => a.Attribute.Key == "SHAPEEvents" && a.EntityId == SelectedPerson.Id);

                var heartCategoriesAttributeValue = attributeValueService
                                                    .Queryable()
                                                    .FirstOrDefault(a => a.Attribute.Key == "HeartCategories" && a.EntityId == SelectedPerson.Id);

                var heartCausesAttributeValue = attributeValueService
                                                .Queryable()
                                                .FirstOrDefault(a => a.Attribute.Key == "HeartCauses" && a.EntityId == SelectedPerson.Id);

                var heartPassionAttributeValue = attributeValueService
                                                 .Queryable()
                                                 .FirstOrDefault(a => a.Attribute.Key == "HeartPassion" && a.EntityId == SelectedPerson.Id);


                if (spiritualGift1AttributeValue.Value != null)
                {
                    spiritualGift1 = spiritualGift1AttributeValue.Value;
                }
                if (spiritualGift2AttributeValue.Value != null)
                {
                    spiritualGift2 = spiritualGift2AttributeValue.Value;
                }
                if (spiritualGift3AttributeValue.Value != null)
                {
                    spiritualGift3 = spiritualGift3AttributeValue.Value;
                }
                if (spiritualGift4AttributeValue.Value != null)
                {
                    spiritualGift4 = spiritualGift4AttributeValue.Value;
                }
                if (heartCategoriesAttributeValue.Value != null)
                {
                    heartCategories = heartCategoriesAttributeValue.Value;
                }
                if (heartCausesAttributeValue.Value != null)
                {
                    heartCauses = heartCausesAttributeValue.Value;
                }
                if (heartPassionAttributeValue.Value != null)
                {
                    heartPassion = heartPassionAttributeValue.Value;
                }
                if (ability1AttributeValue.Value != null)
                {
                    ability1 = ability1AttributeValue.Value;
                }
                if (ability2AttributeValue.Value != null)
                {
                    ability2 = ability2AttributeValue.Value;
                }
                if (peopleAttributeValue.Value != null)
                {
                    people = peopleAttributeValue.Value;
                }
                if (placesAttributeValue.Value != null)
                {
                    places = placesAttributeValue.Value;
                }
                if (eventsAttributeValue.Value != null)
                {
                    events = eventsAttributeValue.Value;
                }

                string spiritualGift1Guid;
                string spiritualGift2Guid;
                string spiritualGift3Guid;
                string spiritualGift4Guid;
                string ability1Guid;
                string ability2Guid;


                // Check to see if there are already values saved as an ID.  If so, convert them to GUID
                if (spiritualGift1.ToString().Length < 5)
                {
                    if (spiritualGift1 != null)
                    {
                        SpiritualGift1 = Int32.Parse(spiritualGift1);
                    }
                    if (spiritualGift2 != null)
                    {
                        SpiritualGift2 = Int32.Parse(spiritualGift2);
                    }
                    if (spiritualGift3 != null)
                    {
                        SpiritualGift3 = Int32.Parse(spiritualGift3);
                    }
                    if (spiritualGift4 != null)
                    {
                        SpiritualGift4 = Int32.Parse(spiritualGift4);
                    }
                    if (ability1 != null)
                    {
                        Ability1 = Int32.Parse(ability1);
                    }
                    if (ability2 != null)
                    {
                        Ability2 = Int32.Parse(ability2);
                    }

                    var intsOfGifts =
                        definedValueService.GetByIds(new List <int>
                    {
                        SpiritualGift1,
                        SpiritualGift2,
                        SpiritualGift3,
                        SpiritualGift4,
                        Ability1,
                        Ability2
                    });

                    spiritualGift1Guid = intsOfGifts.ToList()[SpiritualGift1].Guid.ToString();
                    spiritualGift2Guid = intsOfGifts.ToList()[SpiritualGift2].Guid.ToString();
                    spiritualGift3Guid = intsOfGifts.ToList()[SpiritualGift3].Guid.ToString();
                    spiritualGift4Guid = intsOfGifts.ToList()[SpiritualGift4].Guid.ToString();
                    ability1Guid       = intsOfGifts.ToList()[Ability1].Guid.ToString();
                    ability2Guid       = intsOfGifts.ToList()[Ability2].Guid.ToString();
                }
                else
                {
                    spiritualGift1Guid = spiritualGift1;
                    spiritualGift2Guid = spiritualGift2;
                    spiritualGift3Guid = spiritualGift3;
                    spiritualGift4Guid = spiritualGift4;
                    ability1Guid       = ability1;
                    ability2Guid       = ability2;
                }



                // Get all of the data about the assiciated gifts and ability categories
                var shapeGift1Object = definedValueService.GetListByGuids(new List <Guid> {
                    new Guid(spiritualGift1Guid)
                }).FirstOrDefault();
                var shapeGift2Object = definedValueService.GetListByGuids(new List <Guid> {
                    new Guid(spiritualGift2Guid)
                }).FirstOrDefault();
                var shapeGift3Object = definedValueService.GetListByGuids(new List <Guid> {
                    new Guid(spiritualGift3Guid)
                }).FirstOrDefault();
                var shapeGift4Object = definedValueService.GetListByGuids(new List <Guid> {
                    new Guid(spiritualGift4Guid)
                }).FirstOrDefault();
                var ability1Object = definedValueService.GetListByGuids(new List <Guid> {
                    new Guid(ability1Guid)
                }).FirstOrDefault();
                var ability2Object = definedValueService.GetListByGuids(new List <Guid> {
                    new Guid(ability2Guid)
                }).FirstOrDefault();


                shapeGift1Object.LoadAttributes();
                shapeGift2Object.LoadAttributes();
                shapeGift3Object.LoadAttributes();
                shapeGift4Object.LoadAttributes();
                ability1Object.LoadAttributes();
                ability2Object.LoadAttributes();


                // Get heart choices Values from Guids
                string heartCategoriesString = "";
                if (!heartCategories.IsNullOrWhiteSpace())
                {
                    string[] heartCategoryArray = heartCategories.Split(',');
                    foreach (string category in heartCategoryArray)
                    {
                        var definedValueObject =
                            definedValueService.Queryable().FirstOrDefault(a => a.Guid == new Guid(category));

                        if (category.Equals(heartCategoryArray.Last()))
                        {
                            heartCategoriesString += definedValueObject.Value;
                        }
                        else
                        {
                            heartCategoriesString += definedValueObject.Value + ", ";
                        }
                    }
                }


                // Get Volunteer Opportunities

                string gift1AssociatedVolunteerOpportunities =
                    shapeGift1Object.GetAttributeValue("AssociatedVolunteerOpportunities");
                string gift2AssociatedVolunteerOpportunities =
                    shapeGift2Object.GetAttributeValue("AssociatedVolunteerOpportunities");
                string gift3AssociatedVolunteerOpportunities =
                    shapeGift3Object.GetAttributeValue("AssociatedVolunteerOpportunities");
                string gift4AssociatedVolunteerOpportunities =
                    shapeGift4Object.GetAttributeValue("AssociatedVolunteerOpportunities");

                string allAssociatedVolunteerOpportunities = gift1AssociatedVolunteerOpportunities + "," +
                                                             gift2AssociatedVolunteerOpportunities + "," +
                                                             gift3AssociatedVolunteerOpportunities + "," +
                                                             gift4AssociatedVolunteerOpportunities;

                if (allAssociatedVolunteerOpportunities != ",,,")
                {
                    List <int> associatedVolunteerOpportunitiesList =
                        allAssociatedVolunteerOpportunities.Split(',').Select(t => int.Parse(t)).ToList();
                    Dictionary <int, int> VolunteerOpportunities = new Dictionary <int, int>();


                    var i = 0;
                    var q = from x in associatedVolunteerOpportunitiesList
                            group x by x
                            into g
                            let count = g.Count()
                                        orderby count descending
                                        select new { Value = g.Key, Count = count };
                    foreach (var x in q)
                    {
                        VolunteerOpportunities.Add(i, x.Value);
                        i++;
                    }

                    ConnectionOpportunityService connectionOpportunityService = new ConnectionOpportunityService(rockContext);
                    List <ConnectionOpportunity> connectionOpportunityList    = new List <ConnectionOpportunity>();

                    foreach (KeyValuePair <int, int> entry in VolunteerOpportunities.Take(4))
                    {
                        var connection = connectionOpportunityService.GetByIds(new List <int> {
                            entry.Value
                        }).FirstOrDefault();

                        // Only display connection if it is marked Active
                        if (connection.IsActive == true)
                        {
                            connectionOpportunityList.Add(connection);
                        }
                    }

                    rpVolunteerOpportunities.DataSource = connectionOpportunityList;
                    rpVolunteerOpportunities.DataBind();
                }



                //Get DISC Info

                DiscService.AssessmentResults savedScores = DiscService.LoadSavedAssessmentResults(SelectedPerson);


                if (!string.IsNullOrWhiteSpace(savedScores.PersonalityType))
                {
                    ShowResults(savedScores);
                    DISCResults.Visible   = true;
                    NoDISCResults.Visible = false;
                }
                else
                {
                    discPageReference.Parameters = new System.Collections.Generic.Dictionary <string, string>();
                    discPageReference.Parameters.Add("rckipid", SelectedPerson.UrlEncodedKey);
                    Response.Redirect(discPageReference.BuildUrl(), true);
                }


                // Build the UI

                lbPersonName.Text = SelectedPerson.FullName;

                lbGift1Title.Text    = shapeGift1Object.Value;
                lbGift1BodyHTML.Text = shapeGift1Object.GetAttributeValue("HTMLDescription");

                lbGift2Title.Text    = shapeGift2Object.Value;
                lbGift2BodyHTML.Text = shapeGift2Object.GetAttributeValue("HTMLDescription");

                lbGift3Title.Text    = shapeGift3Object.Value;
                lbGift3BodyHTML.Text = shapeGift3Object.GetAttributeValue("HTMLDescription");

                lbGift4Title.Text    = shapeGift4Object.Value;
                lbGift4BodyHTML.Text = shapeGift4Object.GetAttributeValue("HTMLDescription");

                lbAbility1Title.Text    = ability1Object.Value;
                lbAbility1BodyHTML.Text = ability1Object.GetAttributeValue("HTMLDescription");

                lbAbility2Title.Text    = ability2Object.Value;
                lbAbility2BodyHTML.Text = ability2Object.GetAttributeValue("HTMLDescription");

                lbPeople.Text = people;
                lbPlaces.Text = places;
                lbEvents.Text = events;

                lbHeartCategories.Text = heartCategoriesString;
                lbHeartCauses.Text     = heartCauses;
                lbHeartPassion.Text    = heartPassion;

                if (spiritualGift1AttributeValue.ModifiedDateTime != null)
                {
                    lbAssessmentDate.Text = spiritualGift1AttributeValue.ModifiedDateTime.Value.ToShortDateString();
                }
                else
                {
                    lbAssessmentDate.Text = spiritualGift1AttributeValue.CreatedDateTime.Value.ToShortDateString();
                }


                // Show create account panel if this person doesn't have an account
                if (SelectedPerson.Users.Count == 0)
                {
                    pnlAccount.Visible = true;
                }
            }
        }