Beispiel #1
0
        public CopaEN ReadOIDDefault(int id
                                     )
        {
            CopaEN copaEN = null;

            try
            {
                SessionInitializeTransaction();
                copaEN = (CopaEN)session.Get(typeof(CopaEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(copaEN);
        }
Beispiel #2
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(CopaEN copa)
        {
            try
            {
                SessionInitializeTransaction();
                CopaEN copaEN = (CopaEN)session.Load(typeof(CopaEN), copa.Id);

                copaEN.Capacidad = copa.Capacidad;


                copaEN.Forma = copa.Forma;

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

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


            finally
            {
                SessionClose();
            }
        }
Beispiel #3
0
        public void Destroy(int id
                            )
        {
            try
            {
                SessionInitializeTransaction();
                CopaEN copaEN = (CopaEN)session.Load(typeof(CopaEN), id);
                session.Delete(copaEN);
                SessionCommit();
            }

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


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

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

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


            finally
            {
                SessionClose();
            }

            return(copa.Id);
        }
Beispiel #5
0
        public int New_(string p_nombre, int p_stock, double p_precio, double p_valMedia, string p_descripcion, string p_imagen, string p_marca, double p_capacidad, CervezUAGenNHibernate.Enumerated.CervezUA.TipoCopaEnum p_forma)
        {
            CopaEN copaEN = null;
            int    oid;

            //Initialized CopaEN
            copaEN        = new CopaEN();
            copaEN.Nombre = p_nombre;

            copaEN.Stock = p_stock;

            copaEN.Precio = p_precio;

            copaEN.ValMedia = p_valMedia;

            copaEN.Descripcion = p_descripcion;

            copaEN.Imagen = p_imagen;

            copaEN.Marca = p_marca;

            copaEN.Capacidad = p_capacidad;

            copaEN.Forma = p_forma;

            //Call to CopaCAD

            oid = _ICopaCAD.New_(copaEN);
            return(oid);
        }
Beispiel #6
0
        public CopaEN ReadOID(int id
                              )
        {
            CopaEN copaEN = null;

            copaEN = _ICopaCAD.ReadOID(id);
            return(copaEN);
        }
Beispiel #7
0
        public void Modify(CopaEN copa)
        {
            try
            {
                SessionInitializeTransaction();
                CopaEN copaEN = (CopaEN)session.Load(typeof(CopaEN), copa.Id);

                copaEN.Nombre = copa.Nombre;


                copaEN.Stock = copa.Stock;


                copaEN.Precio = copa.Precio;


                copaEN.ValMedia = copa.ValMedia;


                copaEN.Descripcion = copa.Descripcion;


                copaEN.Imagen = copa.Imagen;


                copaEN.Marca = copa.Marca;


                copaEN.Capacidad = copa.Capacidad;


                copaEN.Forma = copa.Forma;

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

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


            finally
            {
                SessionClose();
            }
        }
Beispiel #8
0
        public CopaViewModel ConvertENToModelUI(CopaEN en)
        {
            CopaViewModel art = new CopaViewModel();

            art.id          = en.Id;
            art.Descripcion = en.Descripcion;
            art.Nombre      = en.Nombre;
            art.Precio      = en.Precio;
            art.Imagen      = en.Imagen;
            art.Marca       = en.Marca;
            art.ValMedia    = en.ValMedia;
            art.Stock       = en.Stock;
            art.Capacidad   = en.Capacidad;
            art.Tipo        = en.Forma;

            return(art);
        }