Esempio n. 1
0
        public void QuitarPack(int p_Variable_OID, System.Collections.Generic.IList <int> p_pack_OIDs)
        {
            try
            {
                SesssionInitializeTransaction();
                PersonalHomeGenNHibernate.EN.PersonalHome.VariableEN variableEN = null;
                variableEN = (VariableEN)session.Load(typeof(VariableEN), p_Variable_OID);

                EN.PersonalHome.PackEN packEN = null;
                if (variableEN.Pack != null)
                {
                    foreach (int item in p_pack_OIDs)
                    {
                        packEN = (PackEN)session.Load(typeof(PackEN), item);
                        if (variableEN.Pack.Contains(packEN) == true)
                        {
                            variableEN.Pack.Remove(packEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_pack_OIDs you are trying to unrelationer, doesn't exist in VariableEN");
                        }
                    }
                }

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

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


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

            if (t == null)
            {
                return(false);
            }
            if (IdVariable.Equals(t.IdVariable))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        public void AsignarVariable(int p_Pack_OID, System.Collections.Generic.IList <int> p_variable_OIDs)
        {
            PersonalHomeGenNHibernate.EN.PersonalHome.PackEN packEN = null;
            try
            {
                SesssionInitializeTransaction();
                packEN = (PackEN)session.Load(typeof(PackEN), p_Pack_OID);
                PersonalHomeGenNHibernate.EN.PersonalHome.VariableEN variableEN = null;
                if (packEN.Variable == null)
                {
                    packEN.Variable = new System.Collections.Generic.List <EN.PersonalHome.VariableEN>();
                }

                foreach (int item in p_variable_OIDs)
                {
                    variableEN = new EN.PersonalHome.VariableEN();
                    variableEN = (EN.PersonalHome.VariableEN)session.Load(typeof(EN.PersonalHome.VariableEN), item);
                    packEN.Variable.Add(variableEN);
                }


                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 VariableEN(VariableEN variable)
 {
     this.init(variable.IdVariable, variable.Nombre, variable.Caracteristicas, variable.Precio, variable.Imagen, variable.Iva, variable.Miniatura, variable.Pack);
 }