示例#1
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, string p_descripcion)
        {
            PredefinidaEN predefinidaEN = null;
            int           oid;

            //Initialized PredefinidaEN
            predefinidaEN        = new PredefinidaEN();
            predefinidaEN.Precio = p_precio;

            predefinidaEN.Nombre = p_nombre;

            predefinidaEN.Foto = p_foto;

            predefinidaEN.NumVeces = p_numVeces;

            predefinidaEN.Tamaño = p_tamaño;

            predefinidaEN.Masa = p_masa;

            predefinidaEN.Descripcion = p_descripcion;

            //Call to PredefinidaCAD

            oid = _IPredefinidaCAD.New_(predefinidaEN);
            return(oid);
        }
示例#2
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(PredefinidaEN predefinida)
        {
            try
            {
                SessionInitializeTransaction();
                PredefinidaEN predefinidaEN = (PredefinidaEN)session.Load(typeof(PredefinidaEN), predefinida.Id);

                predefinidaEN.Descripcion = predefinida.Descripcion;

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

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


            finally
            {
                SessionClose();
            }
        }
示例#3
0
        public PredefinidaEN ReadOIDDefault(int id
                                            )
        {
            PredefinidaEN predefinidaEN = null;

            try
            {
                SessionInitializeTransaction();
                predefinidaEN = (PredefinidaEN)session.Get(typeof(PredefinidaEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(predefinidaEN);
        }
示例#4
0
        public void Destroy(int id
                            )
        {
            try
            {
                SessionInitializeTransaction();
                PredefinidaEN predefinidaEN = (PredefinidaEN)session.Load(typeof(PredefinidaEN), id);
                session.Delete(predefinidaEN);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }
        }
示例#5
0
        public int New_(PredefinidaEN predefinida)
        {
            try
            {
                SessionInitializeTransaction();

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

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


            finally
            {
                SessionClose();
            }

            return(predefinida.Id);
        }
示例#6
0
        public PredefinidaEN ReadOID(int id
                                     )
        {
            PredefinidaEN predefinidaEN = null;

            predefinidaEN = _IPredefinidaCAD.ReadOID(id);
            return(predefinidaEN);
        }
示例#7
0
        public Predefinida ConvertENToModelUI(PredefinidaEN en)
        {
            Predefinida pred = new Predefinida();

            pred.Id          = en.Id;
            pred.Descripcion = en.Descripcion;
            double precio = Convert.ToDouble(pred.precio);

            precio        = en.Precio;
            pred.Nombre   = en.Nombre;
            pred.Foto     = en.Foto;
            pred.NumVeces = en.NumVeces;
            pred.tamaño   = en.Tamaño;
            pred.masa     = en.Masa;

            return(pred);
        }
示例#8
0
        public void Modify(PredefinidaEN predefinida)
        {
            try
            {
                SessionInitializeTransaction();
                PredefinidaEN predefinidaEN = (PredefinidaEN)session.Load(typeof(PredefinidaEN), predefinida.Id);

                predefinidaEN.Precio = predefinida.Precio;


                predefinidaEN.Nombre = predefinida.Nombre;


                predefinidaEN.Foto = predefinida.Foto;


                predefinidaEN.NumVeces = predefinida.NumVeces;


                predefinidaEN.Tamaño = predefinida.Tamaño;


                predefinidaEN.Masa = predefinida.Masa;


                predefinidaEN.Descripcion = predefinida.Descripcion;

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

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


            finally
            {
                SessionClose();
            }
        }
示例#9
0
        public void Modify(int p_Predefinida_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, string p_descripcion)
        {
            PredefinidaEN predefinidaEN = null;

            //Initialized PredefinidaEN
            predefinidaEN             = new PredefinidaEN();
            predefinidaEN.Id          = p_Predefinida_OID;
            predefinidaEN.Precio      = p_precio;
            predefinidaEN.Nombre      = p_nombre;
            predefinidaEN.Foto        = p_foto;
            predefinidaEN.NumVeces    = p_numVeces;
            predefinidaEN.Tamaño      = p_tamaño;
            predefinidaEN.Masa        = p_masa;
            predefinidaEN.Descripcion = p_descripcion;
            //Call to PredefinidaCAD

            _IPredefinidaCAD.Modify(predefinidaEN);
        }