Beispiel #1
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(PizzaEN pizza)
        {
            try
            {
                SessionInitializeTransaction();
                PizzaEN pizzaEN = (PizzaEN)session.Load(typeof(PizzaEN), pizza.Id);

                pizzaEN.Tamaño = pizza.Tamaño;


                pizzaEN.Masa = pizza.Masa;

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

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


            finally
            {
                SessionClose();
            }
        }
Beispiel #2
0
        public PizzaEN ReadOIDDefault(int id
                                      )
        {
            PizzaEN pizzaEN = null;

            try
            {
                SessionInitializeTransaction();
                pizzaEN = (PizzaEN)session.Get(typeof(PizzaEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(pizzaEN);
        }
Beispiel #3
0
        public void Destroy(int id
                            )
        {
            try
            {
                SessionInitializeTransaction();
                PizzaEN pizzaEN = (PizzaEN)session.Load(typeof(PizzaEN), id);
                session.Delete(pizzaEN);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }
        }
Beispiel #4
0
        public int New_(PizzaEN pizza)
        {
            try
            {
                SessionInitializeTransaction();

                session.Save(pizza);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(pizza.Id);
        }
Beispiel #5
0
        public PizzaEN ReadOID(int id
                               )
        {
            PizzaEN pizzaEN = null;

            pizzaEN = _IPizzaCAD.ReadOID(id);
            return(pizzaEN);
        }
Beispiel #6
0
        public void Modify(int p_Pizza_OID, double p_precio, string p_nombre, string p_foto, int p_numVeces, PracticaGenNHibernate.Enumerated.Practica.TamanyoEnum p_tamaño, PracticaGenNHibernate.Enumerated.Practica.TipoMasaEnum p_masa)
        {
            PizzaEN pizzaEN = null;

            //Initialized PizzaEN
            pizzaEN          = new PizzaEN();
            pizzaEN.Id       = p_Pizza_OID;
            pizzaEN.Precio   = p_precio;
            pizzaEN.Nombre   = p_nombre;
            pizzaEN.Foto     = p_foto;
            pizzaEN.NumVeces = p_numVeces;
            pizzaEN.Tamaño   = p_tamaño;
            pizzaEN.Masa     = p_masa;
            //Call to PizzaCAD

            _IPizzaCAD.Modify(pizzaEN);
        }
Beispiel #7
0
        public int New_(double p_precio, string p_nombre, string p_foto, int p_numVeces, PracticaGenNHibernate.Enumerated.Practica.TamanyoEnum p_tamaño, PracticaGenNHibernate.Enumerated.Practica.TipoMasaEnum p_masa)
        {
            PizzaEN pizzaEN = null;
            int     oid;

            //Initialized PizzaEN
            pizzaEN        = new PizzaEN();
            pizzaEN.Precio = p_precio;

            pizzaEN.Nombre = p_nombre;

            pizzaEN.Foto = p_foto;

            pizzaEN.NumVeces = p_numVeces;

            pizzaEN.Tamaño = p_tamaño;

            pizzaEN.Masa = p_masa;

            //Call to PizzaCAD

            oid = _IPizzaCAD.New_(pizzaEN);
            return(oid);
        }