コード例 #1
0
        public void UnassignCategory(int p_CarePlan_OID, System.Collections.Generic.IList <int> p_carePlanCategory_OIDs)
        {
            try
            {
                SessionInitializeTransaction();
                ChroniGenNHibernate.EN.Chroni.CarePlanEN carePlanEN = null;
                carePlanEN = (CarePlanEN)session.Load(typeof(CarePlanEN), p_CarePlan_OID);

                ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN carePlanCategoryENAux = null;
                if (carePlanEN.CarePlanCategory != null)
                {
                    foreach (int item in p_carePlanCategory_OIDs)
                    {
                        carePlanCategoryENAux = (ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN), item);
                        if (carePlanEN.CarePlanCategory.Contains(carePlanCategoryENAux) == true)
                        {
                            carePlanEN.CarePlanCategory.Remove(carePlanCategoryENAux);
                            carePlanCategoryENAux.CarePlan.Remove(carePlanEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_carePlanCategory_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();
            }
        }
コード例 #2
0
        public void AssignCategory(int p_CarePlan_OID, System.Collections.Generic.IList <int> p_carePlanCategory_OIDs)
        {
            ChroniGenNHibernate.EN.Chroni.CarePlanEN carePlanEN = null;
            try
            {
                SessionInitializeTransaction();
                carePlanEN = (CarePlanEN)session.Load(typeof(CarePlanEN), p_CarePlan_OID);
                ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN carePlanCategoryENAux = null;
                if (carePlanEN.CarePlanCategory == null)
                {
                    carePlanEN.CarePlanCategory = new System.Collections.Generic.List <ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN>();
                }

                foreach (int item in p_carePlanCategory_OIDs)
                {
                    carePlanCategoryENAux = new ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN();
                    carePlanCategoryENAux = (ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN)session.Load(typeof(ChroniGenNHibernate.EN.Chroni.CarePlanCategoryEN), item);
                    carePlanCategoryENAux.CarePlan.Add(carePlanEN);

                    carePlanEN.CarePlanCategory.Add(carePlanCategoryENAux);
                }


                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();
            }
        }
コード例 #3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            CarePlanCategoryEN t = obj as CarePlanCategoryEN;

            if (t == null)
            {
                return(false);
            }
            if (Identifier.Equals(t.Identifier))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
 public CarePlanCategoryEN(CarePlanCategoryEN carePlanCategory)
 {
     this.init(Identifier, carePlanCategory.Code, carePlanCategory.Display, carePlanCategory.CarePlan);
 }