示例#1
0
        protected void CareInterventionTreeView_OnNodeClick(Object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
        {
            Int64 careInterventionId = 0;

            if (Int64.TryParse(e.Node.Value, out careInterventionId))
            {
                Client.Core.Individual.CareIntervention careIntervention = MercuryApplication.CareInterventionGet(careInterventionId, true);


                CareInterventionName.Text = careIntervention.Name;

                CareInterventionDescription.Text = careIntervention.Description;


                // 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

                     where

                     // ALTERED TO CHECK IF CARE INTERVENTION IS NULL

                     ((currentMemberCaseCarePlanGoalIntervention.CareIntervention != null) &&

                      ((currentMemberCaseCarePlanGoalIntervention.CareIntervention != null) ?

                       (currentMemberCaseCarePlanGoalIntervention.CareIntervention.CareInterventionId == careIntervention.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();


                CareInterventionProblemsListView.DataSource = memberCaseProblemCarePlans;

                CareInterventionProblemsListView.DataBind();


                // LINK UP ACTIVITIES

                CareInterventionActivitiesListView.DataSource = careIntervention.Activities;

                CareInterventionActivitiesListView.DataBind();

                return;
            }

            return;
        }
示例#2
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;
        }