//protected void ProblemStatementCategoryOnChange () {

        //    if (ProblemStatementCategorySelection.SelectedItem != null) {

        //        problemStatement.ProblemCategoryId = Convert.ToInt64 (ProblemStatementCategorySelection.SelectedValue);

        //        problemStatement.ProblemCategoryName = ProblemStatementCategorySelection.SelectedItem.Text;

        //    }

        //    else {

        //        problemStatement.ProblemCategoryId = 0;

        //        problemStatement.ProblemCategoryName = ProblemStatementCategorySelection.Text;

        //    }

        //    problemStatement.ProblemSubcategoryId = 0;

        //    problemStatement.ProblemSubcategoryName = String.Empty;


        //    ProblemStatementSubcategorySelection.SelectedValue = String.Empty;

        //    ProblemStatementSubcategorySelection.Text = String.Empty;


        //    InitializeClassification ();

        //    return;

        //}

        //protected void ProblemStatementCategorySelection_OnSelectedIndexChanged (Object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) {

        //    ProblemStatementCategoryOnChange ();

        //    return;

        //}

        //protected void ProblemStatementCategorySelection_OnTextChanged (Object sender, EventArgs e) {

        //    ProblemStatementCategoryOnChange ();

        //    return;

        //}

        #endregion


        #region Dialog Button Event Handlers

        protected Boolean ApplyChanges()
        {
            Boolean isModified = false;

            Boolean success = false;


            Mercury.Client.Core.Individual.ProblemStatement problemStatementUnmodified = (Mercury.Client.Core.Individual.ProblemStatement)Session[SessionCachePrefix + "ProblemStatementUnmodified"];

            if (problemStatementUnmodified.Id == 0)
            {
                isModified = true;
            }


            // CLASSIFICATION

            if (ProblemStatementDomainSelection.SelectedItem != null)
            {
                problemStatement.ProblemDomainId = Convert.ToInt64(ProblemStatementDomainSelection.SelectedItem.Value);
            }

            problemStatement.ProblemDomainName = ProblemStatementDomainSelection.Text.Trim();



            if (ProblemStatementClassSelection.SelectedItem != null)
            {
                problemStatement.ProblemClassId = Convert.ToInt64(ProblemStatementClassSelection.SelectedItem.Value);
            }

            problemStatement.ProblemClassName = ProblemStatementClassSelection.Text.Trim();


            //if (ProblemStatementCategorySelection.SelectedItem != null) {

            //    problemStatement.ProblemCategoryId = Convert.ToInt64 (ProblemStatementCategorySelection.SelectedItem.Value);

            //}

            //problemStatement.ProblemCategoryName = ProblemStatementCategorySelection.Text;


            //if (ProblemStatementSubcategorySelection.SelectedItem != null) {

            //    problemStatement.ProblemSubcategoryId = Convert.ToInt64 (ProblemStatementSubcategorySelection.SelectedItem.Value);

            //}

            //problemStatement.ProblemSubcategoryName = ProblemStatementSubcategorySelection.Text;



            problemStatement.Name = ProblemStatementName.Text.Trim();

            problemStatement.Description = ProblemStatementDescription.Text.Trim();

            problemStatement.DefiningCharacteristics = ProblemStatementDefiningCharacteristics.Text.Trim();

            problemStatement.RelatedFactors = ProblemStatementRelatedFactors.Text.Trim();

            problemStatement.Enabled = ProblemStatementEnabled.Checked;

            problemStatement.Visible = ProblemStatementVisible.Checked;


            if (ProblemStatementDefaultCarePlanSelection.SelectedItem != null)
            {
                problemStatement.DefaultCarePlanId = Convert.ToInt64(ProblemStatementDefaultCarePlanSelection.SelectedValue);
            }


            if (!isModified)
            {
                isModified = !problemStatement.IsEqual(problemStatementUnmodified);
            }

            if (isModified)
            {
                success = MercuryApplication.ProblemStatementSave(problemStatement);

                if (success)
                {
                    problemStatement = MercuryApplication.ProblemStatementGet(problemStatement.Id, false);

                    Session[SessionCachePrefix + "ProblemStatement"] = problemStatement;

                    Session[SessionCachePrefix + "ProblemStatementUnmodified"] = problemStatement.Copy();

                    SaveResponseLabel.Text = "Save Successful";

                    InitializeAll();
                }

                else
                {
                    SaveResponseLabel.Text = "Unable to Save.";

                    if (MercuryApplication.LastException != null)
                    {
                        SaveResponseLabel.Text = SaveResponseLabel.Text + " [" + MercuryApplication.LastException.Message + "]";
                    }

                    success = false;
                }
            }

            else
            {
                SaveResponseLabel.Text = "No Changes Detected."; success = true;
            }

            return(success);
        }