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

            if (t == null)
            {
                return(false);
            }
            if (Id.Equals(t.Id))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
 public TiendaEN(TiendaEN tienda)
 {
     this.init(tienda.Id, tienda.Color, tienda.Tipo, tienda.Talla, tienda.Nombre, tienda.Descripcion, tienda.Foto, tienda.Precio, tienda.LineaPedido, tienda.Articulo, tienda.Stock, tienda.Categoria);
 }