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

        public void ModifyDefault(TransporteEN transporte)
        {
            try
            {
                SessionInitializeTransaction();
                TransporteEN transporteEN = (TransporteEN)session.Load(typeof(TransporteEN), transporte.Id);

                transporteEN.Tipo = transporte.Tipo;


                transporteEN.Origen = transporte.Origen;


                transporteEN.Destino = transporte.Destino;

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

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


            finally
            {
                SessionClose();
            }
        }
Exemple #2
0
        public TransporteEN ReadOIDDefault(int id
                                           )
        {
            TransporteEN transporteEN = null;

            try
            {
                SessionInitializeTransaction();
                transporteEN = (TransporteEN)session.Get(typeof(TransporteEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

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

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


            finally
            {
                SessionClose();
            }
        }
Exemple #4
0
        public int New_(TransporteEN transporte)
        {
            try
            {
                SessionInitializeTransaction();
                if (transporte.Itinerario != null)
                {
                    // Argumento OID y no colección.
                    transporte.Itinerario = (DSMGenNHibernate.EN.DSM.ItinerarioEN)session.Load(typeof(DSMGenNHibernate.EN.DSM.ItinerarioEN), transporte.Itinerario.Id);

                    transporte.Itinerario.PuntoDeItinerario
                    .Add(transporte);
                }

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

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


            finally
            {
                SessionClose();
            }

            return(transporte.Id);
        }
Exemple #5
0
        public DSMGenNHibernate.EN.DSM.TransporteEN New_(int p_orden, int p_itinerario, DSMGenNHibernate.Enumerated.DSM.TipoTransporteEnum p_tipo, string p_origen, string p_destino)
        {
            /*PROTECTED REGION ID(DSMGenNHibernate.CP.DSM_Transporte_new_) ENABLED START*/

            ITransporteCAD transporteCAD = null;
            TransporteCEN  transporteCEN = null;

            DSMGenNHibernate.EN.DSM.TransporteEN result = null;


            try
            {
                SessionInitializeTransaction();
                transporteCAD = new TransporteCAD(session);
                transporteCEN = new  TransporteCEN(transporteCAD);



                int oid;
                //Initialized TransporteEN
                TransporteEN transporteEN;
                transporteEN       = new TransporteEN();
                transporteEN.Orden = p_orden;


                if (p_itinerario != -1)
                {
                    transporteEN.Itinerario    = new DSMGenNHibernate.EN.DSM.ItinerarioEN();
                    transporteEN.Itinerario.Id = p_itinerario;
                }

                transporteEN.Tipo = p_tipo;

                transporteEN.Origen = p_origen;

                transporteEN.Destino = p_destino;

                //Call to TransporteCAD

                oid    = transporteCAD.New_(transporteEN);
                result = transporteCAD.ReadOIDDefault(oid);



                SessionCommit();
            }
            catch (Exception ex)
            {
                SessionRollBack();
                throw ex;
            }
            finally
            {
                SessionClose();
            }
            return(result);


            /*PROTECTED REGION END*/
        }
Exemple #6
0
        public void Modify(int p_Transporte_OID, int p_orden, DSMGenNHibernate.Enumerated.DSM.TipoTransporteEnum p_tipo, string p_origen, string p_destino)
        {
            TransporteEN transporteEN = null;

            //Initialized TransporteEN
            transporteEN         = new TransporteEN();
            transporteEN.Id      = p_Transporte_OID;
            transporteEN.Orden   = p_orden;
            transporteEN.Tipo    = p_tipo;
            transporteEN.Origen  = p_origen;
            transporteEN.Destino = p_destino;
            //Call to TransporteCAD

            _ITransporteCAD.Modify(transporteEN);
        }