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

        public void ModifyDefault(LineaCestaEN lineaCesta)
        {
            try
            {
                SessionInitializeTransaction();
                LineaCestaEN lineaCestaEN = (LineaCestaEN)session.Load(typeof(LineaCestaEN), lineaCesta.Id);



                lineaCestaEN.Numero = lineaCesta.Numero;

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

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


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

            try
            {
                SessionInitializeTransaction();
                lineaCestaEN = (LineaCestaEN)session.Get(typeof(LineaCestaEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

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

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


            finally
            {
                SessionClose();
            }
        }
Beispiel #4
0
        public int New_(LineaCestaEN lineaCesta)
        {
            try
            {
                SessionInitializeTransaction();
                if (lineaCesta.Cesta != null)
                {
                    // Argumento OID y no colección.
                    lineaCesta.Cesta = (CervezUAGenNHibernate.EN.CervezUA.CestaEN)session.Load(typeof(CervezUAGenNHibernate.EN.CervezUA.CestaEN), lineaCesta.Cesta.Id);

                    lineaCesta.Cesta.Articulos
                    .Add(lineaCesta);
                }

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

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


            finally
            {
                SessionClose();
            }

            return(lineaCesta.Id);
        }
Beispiel #5
0
        public void Modify(int p_LineaCesta_OID, int p_numero)
        {
            LineaCestaEN lineaCestaEN = null;

            //Initialized LineaCestaEN
            lineaCestaEN        = new LineaCestaEN();
            lineaCestaEN.Id     = p_LineaCesta_OID;
            lineaCestaEN.Numero = p_numero;
            //Call to LineaCestaCAD

            _ILineaCestaCAD.Modify(lineaCestaEN);
        }
Beispiel #6
0
        public int New_(int p_cesta, int p_numero)
        {
            LineaCestaEN lineaCestaEN = null;
            int          oid;

            //Initialized LineaCestaEN
            lineaCestaEN = new LineaCestaEN();

            if (p_cesta != -1)
            {
                // El argumento p_cesta -> Property cesta es oid = false
                // Lista de oids id
                lineaCestaEN.Cesta    = new CervezUAGenNHibernate.EN.CervezUA.CestaEN();
                lineaCestaEN.Cesta.Id = p_cesta;
            }

            lineaCestaEN.Numero = p_numero;

            //Call to LineaCestaCAD

            oid = _ILineaCestaCAD.New_(lineaCestaEN);
            return(oid);
        }