Esempio n. 1
0
        public void QuitarTipoEstancia(int p_FamiliaPack_OID, System.Collections.Generic.IList <int> p_tipoEstancia_OIDs)
        {
            try
            {
                SesssionInitializeTransaction();
                PersonalHomeGenNHibernate.EN.PersonalHome.FamiliaPackEN familiaPackEN = null;
                familiaPackEN = (FamiliaPackEN)session.Load(typeof(FamiliaPackEN), p_FamiliaPack_OID);

                EN.PersonalHome.TipoEstanciaEN tipoEstanciaEN = null;
                if (familiaPackEN.TipoEstancia != null)
                {
                    foreach (int item in p_tipoEstancia_OIDs)
                    {
                        tipoEstanciaEN = (TipoEstanciaEN)session.Load(typeof(TipoEstanciaEN), item);
                        if (familiaPackEN.TipoEstancia.Contains(tipoEstanciaEN) == true)
                        {
                            familiaPackEN.TipoEstancia.Remove(tipoEstanciaEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_tipoEstancia_OIDs you are trying to unrelationer, doesn't exist in FamiliaPackEN");
                        }
                    }
                }

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

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


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

            if (t == null)
            {
                return(false);
            }
            if (IdFamPack.Equals(t.IdFamPack))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        public void AsignarFamiliaPack(int p_Pack_OID, System.Collections.Generic.IList <int> p_familiaPack_OIDs)
        {
            PersonalHomeGenNHibernate.EN.PersonalHome.PackEN packEN = null;
            try
            {
                SesssionInitializeTransaction();
                packEN = (PackEN)session.Load(typeof(PackEN), p_Pack_OID);
                PersonalHomeGenNHibernate.EN.PersonalHome.FamiliaPackEN familiaPackEN = null;
                if (packEN.FamiliaPack == null)
                {
                    packEN.FamiliaPack = new System.Collections.Generic.List <EN.PersonalHome.FamiliaPackEN>();
                }

                foreach (int item in p_familiaPack_OIDs)
                {
                    familiaPackEN = new EN.PersonalHome.FamiliaPackEN();
                    familiaPackEN = (EN.PersonalHome.FamiliaPackEN)session.Load(typeof(EN.PersonalHome.FamiliaPackEN), item);
                    packEN.FamiliaPack.Add(familiaPackEN);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
Esempio n. 4
0
 public FamiliaPackEN(FamiliaPackEN familiaPack)
 {
     this.init(familiaPack.IdFamPack, familiaPack.Nombre, familiaPack.Codigo, familiaPack.Color, familiaPack.Pack, familiaPack.TipoEstancia);
 }