Exemplo n.º 1
0
        public void QuitaTalla(int p_Tienda_OID, System.Collections.Generic.IList <int> p_talla_OIDs)
        {
            try
            {
                SessionInitializeTransaction();
                AppEstadioGenNHibernate.EN.AppEstadio.TiendaEN tiendaEN = null;
                tiendaEN = (TiendaEN)session.Load(typeof(TiendaEN), p_Tienda_OID);

                AppEstadioGenNHibernate.EN.AppEstadio.TallaEN tallaENAux = null;
                if (tiendaEN.Talla != null)
                {
                    foreach (int item in p_talla_OIDs)
                    {
                        tallaENAux = (AppEstadioGenNHibernate.EN.AppEstadio.TallaEN)session.Load(typeof(AppEstadioGenNHibernate.EN.AppEstadio.TallaEN), item);
                        if (tiendaEN.Talla.Contains(tallaENAux) == true)
                        {
                            tiendaEN.Talla.Remove(tallaENAux);
                            tallaENAux.Tienda.Remove(tiendaEN);
                        }
                        else
                        {
                            throw new ModelException("The identifier " + item + " in p_talla_OIDs you are trying to unrelationer, doesn't exist in TiendaEN");
                        }
                    }
                }

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

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


            finally
            {
                SessionClose();
            }
        }
Exemplo n.º 2
0
        public void AgregaTalla(int p_Tienda_OID, System.Collections.Generic.IList <int> p_talla_OIDs)
        {
            AppEstadioGenNHibernate.EN.AppEstadio.TiendaEN tiendaEN = null;
            try
            {
                SessionInitializeTransaction();
                tiendaEN = (TiendaEN)session.Load(typeof(TiendaEN), p_Tienda_OID);
                AppEstadioGenNHibernate.EN.AppEstadio.TallaEN tallaENAux = null;
                if (tiendaEN.Talla == null)
                {
                    tiendaEN.Talla = new System.Collections.Generic.List <AppEstadioGenNHibernate.EN.AppEstadio.TallaEN>();
                }

                foreach (int item in p_talla_OIDs)
                {
                    tallaENAux = new AppEstadioGenNHibernate.EN.AppEstadio.TallaEN();
                    tallaENAux = (AppEstadioGenNHibernate.EN.AppEstadio.TallaEN)session.Load(typeof(AppEstadioGenNHibernate.EN.AppEstadio.TallaEN), item);
                    tallaENAux.Tienda.Add(tiendaEN);

                    tiendaEN.Talla.Add(tallaENAux);
                }


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

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


            finally
            {
                SessionClose();
            }
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            TallaEN t = obj as TallaEN;

            if (t == null)
            {
                return(false);
            }
            if (Id.Equals(t.Id))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
 public TallaEN(TallaEN talla)
 {
     this.init(talla.Id, talla.Nombre, talla.Tipo, talla.Medidas, talla.Tienda);
 }