Beispiel #1
0
        protected void InterventionsGrid_OnDeleteCommand(Object sender, Telerik.Web.UI.GridCommandEventArgs eventArgs)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            if (!(eventArgs.Item is Telerik.Web.UI.GridDataItem))
            {
                return;
            }


            String carePlanGoalName = String.Empty;

            Client.Core.Individual.CarePlanGoal carePlanGoal = null;

            String carePlanInterventionName = String.Empty;

            Client.Core.Individual.CarePlanIntervention carePlanIntervention = null;


            // GET VALUES OUT OF THE DATA ITEM

            Telerik.Web.UI.GridDataItem dataItem = (Telerik.Web.UI.GridDataItem)eventArgs.Item;

            carePlanGoalName = (String)dataItem.GetDataKeyValue("CarePlanGoal.Name");

            carePlanGoal = carePlan.CarePlanGoal(carePlanGoalName);

            if (carePlanGoal != null)
            {
                carePlanInterventionName = (String)dataItem.GetDataKeyValue("Name");

                carePlanIntervention = carePlanGoal.CarePlanIntervention(carePlanInterventionName);

                if (carePlanIntervention != null)
                {
                    carePlanGoal.Interventions.Remove(carePlanIntervention);
                }
            }


            InitializeInterventionsPage();

            InterventionsGrid.Rebind();

            return;
        }
Beispiel #2
0
        private void InitializeCareInterventionTreeView()
        {
            Client.Core.Individual.CarePlanGoal originalCarePlanGoal = MemberCaseCarePlanGoal.MemberCaseCarePlan.CarePlan.CarePlanGoal(MemberCaseCarePlanGoal.CarePlanGoalId);

            Telerik.Web.UI.RadTreeNode careInterventionNode;


            #region Create Root Nodes

            Telerik.Web.UI.RadTreeNode rootCurrentNode = new Telerik.Web.UI.RadTreeNode("Current", "RootCurrent");

            rootCurrentNode.Checkable = false;

            rootCurrentNode.Expanded = false;

            CareInterventionTreeView.Nodes.Add(rootCurrentNode);


            Telerik.Web.UI.RadTreeNode rootRequiredNode = new Telerik.Web.UI.RadTreeNode("Required", "RootRequired");

            rootRequiredNode.Checkable = false;

            rootRequiredNode.Expanded = true;

            CareInterventionTreeView.Nodes.Add(rootRequiredNode);


            Telerik.Web.UI.RadTreeNode rootSuggestedNode = new Telerik.Web.UI.RadTreeNode("Suggested", "RootSuggested");

            rootSuggestedNode.Checkable = false;

            rootSuggestedNode.Expanded = true;

            CareInterventionTreeView.Nodes.Add(rootSuggestedNode);


            Telerik.Web.UI.RadTreeNode rootOptionalNode = new Telerik.Web.UI.RadTreeNode("Optional", "RootOptional");

            rootOptionalNode.Checkable = false;

            rootOptionalNode.Expanded = false;

            CareInterventionTreeView.Nodes.Add(rootOptionalNode);


            Telerik.Web.UI.RadTreeNode rootAllNode = new Telerik.Web.UI.RadTreeNode("All Others", "RootAll");

            rootAllNode.Checkable = false;

            rootAllNode.Expanded = false;

            CareInterventionTreeView.Nodes.Add(rootAllNode);

            #endregion


            List <Client.Core.Individual.CareIntervention> careInterventionsCurrent =

                (from currentCarePlanGoalIntervention in MemberCaseCarePlanGoal.Interventions

                 where

                 // ALTERED TO REMOVE THOSE WHERE CARE INTERVENTION IS NULL

                 (currentCarePlanGoalIntervention.CareIntervention != null) && (

                     (currentCarePlanGoalIntervention.CareIntervention != null ?

                      ((currentCarePlanGoalIntervention.CareIntervention.Status == Mercury.Server.Application.CaseItemStatus.UnderDevelopment)

                       || (currentCarePlanGoalIntervention.CareIntervention.Status == Mercury.Server.Application.CaseItemStatus.Active))

                    : (currentCarePlanGoalIntervention.Id == currentCarePlanGoalIntervention.Id)))

                 select currentCarePlanGoalIntervention.CareIntervention.CareIntervention

                ).Distinct().ToList();


            foreach (Client.Core.Individual.CareIntervention currentCareIntervention in careInterventionsCurrent)
            {
                // EXISTING CARE INTERVENTIONS WILL HAVE "Checked" TRUE AND "ForeColor" System.Drawing.Color.Black

                // IF THE CARE INTERVENTION EXISTS AND IS ACTIVE IN THE CASE ALREADY, DO NOT ALLOW IT TO BE ADDED AGAIN

                careInterventionNode = new Telerik.Web.UI.RadTreeNode(currentCareIntervention.Name, currentCareIntervention.Id.ToString());

                careInterventionNode.Checkable = false;

                careInterventionNode.ImageUrl = "/Images/Common16/Check.png";

                careInterventionNode.ForeColor = System.Drawing.Color.Black;


                // ADD EARLY SO THAT EXPAND TO NODE WORKS (PARENT RELATIONSHIP REQUIRED)

                rootCurrentNode.Nodes.Add(careInterventionNode);
            }


            List <Client.Core.Individual.CareIntervention> careInterventionsAvailable = MercuryApplication.CareInterventionsAvailable(true);

            careInterventionsAvailable =

                (from currentCareIntervention in careInterventionsAvailable

                 where (currentCareIntervention.Enabled == true)

                 orderby currentCareIntervention.Name

                 select currentCareIntervention).ToList();



            foreach (Client.Core.Individual.CareIntervention currentCareIntervention in careInterventionsAvailable)
            {
                // MAKE SURE THAT THE NODE DOES NOT ALREADY EXIST (FROM THE "CURRENT" SELECTION)

                if (CareInterventionTreeView.FindNodeByValue(currentCareIntervention.Id.ToString()) == null)
                {
                    Telerik.Web.UI.RadTreeNode parentNode = rootAllNode;


                    if (originalCarePlanGoal != null)   // IT IS POSSIBLE THAT THE GOAL WAS A CUSTOM CREATED GOAL

                    // USE THE ORIGINAL CARE PLAN OF THE CARE PLAN GOAL TO CHECK TO SEE IF THE INTERVENTION IS REQUIRED/SUGGESTED/OPTIONAL IN THE ORIGINAL

                    {
                        Client.Core.Individual.CarePlanIntervention originalCarePlanIntervention = originalCarePlanGoal.CarePlanIntervention(currentCareIntervention.Id);


                        if (originalCarePlanIntervention != null)
                        {
                            switch (originalCarePlanIntervention.Inclusion)
                            {
                            case Mercury.Server.Application.CarePlanItemInclusion.Required: parentNode = rootRequiredNode; break;

                            case Mercury.Server.Application.CarePlanItemInclusion.Suggested: parentNode = rootSuggestedNode; break;

                            case Mercury.Server.Application.CarePlanItemInclusion.Optional: parentNode = rootOptionalNode; break;
                            }
                        }
                    }

                    careInterventionNode = new Telerik.Web.UI.RadTreeNode(currentCareIntervention.Name, currentCareIntervention.Id.ToString());

                    parentNode.Nodes.Add(careInterventionNode);


                    // IDENTIFY CARE INTERVENTIONS THAT ARE ALREADY IN USE BY CURRENT CARE PLAN OR OTHER CARE PLAN

                    List <Client.Core.Individual.Case.MemberCaseProblemCarePlan> memberCaseProblemCarePlans =

                        (from currentMemberCaseCarePlan in Case.CarePlans

                         from currentMemberCaseCarePlanGoal in currentMemberCaseCarePlan.Goals

                         from currentMemberCaseCarePlanGoalIntervention in currentMemberCaseCarePlanGoal.Interventions

                         from currentProblems in currentMemberCaseCarePlanGoalIntervention.MemberCaseCarePlanGoal.MemberCaseCarePlan.Problems

                         // ALTERED TO CHECK IF CARE INTERVENTION IS NULL

                         where ((currentMemberCaseCarePlanGoalIntervention.CareIntervention != null) ? (currentMemberCaseCarePlanGoalIntervention.CareIntervention.CareInterventionId == currentCareIntervention.Id)

                                && ((currentMemberCaseCarePlanGoalIntervention.CareIntervention.Status == Mercury.Server.Application.CaseItemStatus.UnderDevelopment))

                                || (currentMemberCaseCarePlanGoalIntervention.CareIntervention.Status == Mercury.Server.Application.CaseItemStatus.Active) : (currentMemberCaseCarePlanGoalIntervention.Id == currentMemberCaseCarePlanGoalIntervention.Id))

                         select currentProblems).Distinct().ToList();

                    foreach (Client.Core.Individual.Case.MemberCaseProblemCarePlan currentMemberCaseProblemCarePlan in memberCaseProblemCarePlans)
                    {
                        Telerik.Web.UI.RadTreeNode problemNode = new Telerik.Web.UI.RadTreeNode(currentMemberCaseProblemCarePlan.ProblemStatementClassificationWithName, currentCareIntervention.Id.ToString() + "|" + currentMemberCaseProblemCarePlan.Id.ToString());

                        problemNode.Checkable = false;

                        careInterventionNode.Nodes.Add(problemNode);
                    }
                }
            }

            return;
        }
Beispiel #3
0
        protected void InterventionsGrid_OnItemCommand(Object sender, Telerik.Web.UI.GridCommandEventArgs eventArgs)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            if (!(eventArgs.Item is Telerik.Web.UI.GridDataItem))
            {
                return;
            }

            Int32 itemIndex = eventArgs.Item.DataSetIndex;


            String carePlanGoalName = String.Empty;

            Client.Core.Individual.CarePlanGoal carePlanGoal = null;

            String carePlanInterventionName = String.Empty;

            Client.Core.Individual.CarePlanIntervention carePlanIntervention = null;


            // GET VALUES OUT OF THE DATA ITEM

            Telerik.Web.UI.GridDataItem dataItem = (Telerik.Web.UI.GridDataItem)eventArgs.Item;

            carePlanGoalName = (String)dataItem.GetDataKeyValue("CarePlanGoal.Name");

            carePlanGoal = carePlan.CarePlanGoal(carePlanGoalName);

            if (carePlanGoal != null)
            {
                carePlanInterventionName = (String)dataItem.GetDataKeyValue("Name");

                carePlanIntervention = carePlanGoal.CarePlanIntervention(carePlanInterventionName);
            }


            switch (eventArgs.CommandName)
            {
            case "ToggleActive":

                if (carePlanIntervention != null)
                {
                    carePlanIntervention.Enabled = !carePlanIntervention.Enabled;
                }

                break;

            case Telerik.Web.UI.RadGrid.EditCommandName:

                // MAKE COPY OF SELECTED ROW FOR EDITING

                EditCarePlanIntervention = carePlanIntervention.Copy();

                // EditCarePlanIntervention = carePlan.Interventions[activityIndex].Copy ();


                // TODO: ASSIGN INTERVENTION MEMBERS


                eventArgs.Canceled = true;

                break;

            default:

                System.Diagnostics.Debug.WriteLine(eventArgs.CommandName);

                break;
            }

            InitializeInterventionsPage();

            InterventionsGrid.Rebind();

            InterventionsGrid.SelectedIndexes.Add(eventArgs.Item.ItemIndex);

            return;
        }
Beispiel #4
0
        protected void ButtonAddUpdateIntervention_OnClick(Object sender, EventArgs eventArgs)
        {
            Boolean existingInterventionFound = false;

            Client.Core.Individual.CarePlanIntervention newIntervention = null;

            Int64 careInterventionId = 0;

            Client.Core.Individual.CarePlanGoal carePlanGoal;

            Client.Core.Individual.CareIntervention careIntervention;

            Dictionary <String, String> validationResponse;

            SaveResponseLabel.Text = String.Empty;



            if (MercuryApplication == null)
            {
                return;
            }

            if (CarePlanCareInterventionGoalSelection.SelectedItem == null)
            {
                return;
            }

            if (CarePlanCareInterventionSelection.SelectedItem == null)
            {
                return;
            }


            // GOAL THAT IS TO BE THE PARENT OF THE INTERVENTION

            carePlanGoal = carePlan.CarePlanGoal(CarePlanCareInterventionGoalSelection.SelectedValue);

            if (carePlanGoal == null)
            {
                return;
            }


            // CREATE INTERVENTION

            careInterventionId = Convert.ToInt64(CarePlanCareInterventionSelection.SelectedValue);

            careIntervention = MercuryApplication.CareInterventionGet(careInterventionId, true);


            newIntervention = new Client.Core.Individual.CarePlanIntervention(MercuryApplication);

            newIntervention.CarePlanGoalId = carePlanGoal.Id;

            newIntervention.CarePlanGoal = carePlanGoal;

            newIntervention.Name = careIntervention.Name;

            newIntervention.Description = careIntervention.Description;

            newIntervention.CareInterventionId = careIntervention.Id;

            newIntervention.Inclusion = (Mercury.Server.Application.CarePlanItemInclusion)Convert.ToInt32(CarePlanInteventionInclusionSelection.SelectedValue);


            validationResponse = MercuryApplication.CoreObject_Validate((Mercury.Server.Application.CoreObject)newIntervention.ToServerObject());

            if (validationResponse.Count == 0)
            {
                existingInterventionFound = carePlanGoal.ContainsCareIntervention(careInterventionId);


                switch (((System.Web.UI.WebControls.Button)sender).ID)
                {
                case "ButtonAddIntervention":

                    if (!existingInterventionFound)
                    {
                        carePlanGoal.Interventions.Add(newIntervention);

                        SaveResponseLabel.Text = String.Empty;
                    }

                    else
                    {
                        SaveResponseLabel.Text = "Duplicate Intervention.";
                    }

                    break;


                case "ButtonUpdateIntervention":

                    if (InterventionsGrid.SelectedItems.Count != 0)
                    {
                        newIntervention.Id = carePlanGoal.Interventions[InterventionsGrid.SelectedItems[0].DataSetIndex].Id;

                        carePlanGoal.Interventions.RemoveAt(InterventionsGrid.SelectedItems[0].DataSetIndex);

                        carePlanGoal.Interventions.Add(newIntervention);
                    }

                    else
                    {
                        SaveResponseLabel.Text = "No Intervention Selected.";
                    }

                    break;
                }
            }

            else
            {
                foreach (String validationKey in validationResponse.Keys)
                {
                    SaveResponseLabel.Text = "Invalid [" + validationKey + "]: " + validationResponse[validationKey];

                    break;
                }
            }

            InitializeInterventionsPage();

            InterventionsGrid.Rebind();

            return;
        }