public void UnassignGoal(int p_CarePlan_OID, System.Collections.Generic.IList <int> p_goal_OIDs)
        {
            try
            {
                SessionInitializeTransaction();
                ChroniGenNHibernate.EN.Chroni.CarePlanEN carePlanEN = null;
                carePlanEN = (CarePlanEN)session.Load(typeof(CarePlanEN), p_CarePlan_OID);

                ChroniGenNHibernate.EN.Chroni.GoalEN goalENAux = null;
                if (carePlanEN.Goal != null)
                {
                    foreach (int item in p_goal_OIDs)
                    {
                        goalENAux = (ChroniGenNHibernate.EN.Chroni.GoalEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.GoalEN), item);
                        if (carePlanEN.Goal.Contains(goalENAux) == true)
                        {
                            carePlanEN.Goal.Remove(goalENAux);
                            goalENAux.CarePlan = null;
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_goal_OIDs you are trying to unrelationer, doesn't exist in CarePlanEN");
                        }
                    }
                }

                session.Update(carePlanEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is ChroniGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
        public void AssignGoal(int p_CarePlan_OID, System.Collections.Generic.IList <int> p_goal_OIDs)
        {
            ChroniGenNHibernate.EN.Chroni.CarePlanEN carePlanEN = null;
            try
            {
                SessionInitializeTransaction();
                carePlanEN = (CarePlanEN)session.Load(typeof(CarePlanEN), p_CarePlan_OID);
                ChroniGenNHibernate.EN.Chroni.GoalEN goalENAux = null;
                if (carePlanEN.Goal == null)
                {
                    carePlanEN.Goal = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.GoalEN>();
                }

                foreach (int item in p_goal_OIDs)
                {
                    goalENAux          = new ChroniGenNHibernate.EN.Chroni.GoalEN();
                    goalENAux          = (ChroniGenNHibernate.EN.Chroni.GoalEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.GoalEN), item);
                    goalENAux.CarePlan = carePlanEN;

                    carePlanEN.Goal.Add(goalENAux);
                }


                session.Update(carePlanEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is ChroniGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in CarePlanCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
        public void AssignCarePlan(int p_Encounter_OID, System.Collections.Generic.IList <int> p_carePlan_OIDs)
        {
            ChroniGenNHibernate.EN.Chroni.EncounterEN encounterEN = null;
            try
            {
                SessionInitializeTransaction();
                encounterEN = (EncounterEN)session.Load(typeof(EncounterEN), p_Encounter_OID);
                ChroniGenNHibernate.EN.Chroni.CarePlanEN carePlanENAux = null;
                if (encounterEN.CarePlan == null)
                {
                    encounterEN.CarePlan = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.CarePlanEN>();
                }

                foreach (int item in p_carePlan_OIDs)
                {
                    carePlanENAux           = new ChroniGenNHibernate.EN.Chroni.CarePlanEN();
                    carePlanENAux           = (ChroniGenNHibernate.EN.Chroni.CarePlanEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.CarePlanEN), item);
                    carePlanENAux.Encounter = encounterEN;

                    encounterEN.CarePlan.Add(carePlanENAux);
                }


                session.Update(encounterEN);
                SessionCommit();
            }

            catch (Exception ex) {
                SessionRollBack();
                if (ex is ChroniGenNHibernate.Exceptions.ModelException)
                {
                    throw ex;
                }
                throw new ChroniGenNHibernate.Exceptions.DataLayerException("Error in EncounterCAD.", ex);
            }


            finally
            {
                SessionClose();
            }
        }
Esempio n. 4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            CarePlanEN t = obj as CarePlanEN;

            if (t == null)
            {
                return(false);
            }
            if (Identifier.Equals(t.Identifier))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
 public CarePlanEN(CarePlanEN carePlan)
 {
     this.init(Identifier, carePlan.Subject, carePlan.Status, carePlan.Context, carePlan.StartDate, carePlan.Modified, carePlan.Description, carePlan.Note, carePlan.Activity, carePlan.Encounter, carePlan.Goal, carePlan.EndDate, carePlan.CarePlanCategory);
 }