Ejemplo n.º 1
0
        public int New_(string p_name, MoSIoTGenNHibernate.Enumerated.MosIoT.DataTypeEnum p_type, int p_entityOperation)
        {
            EntityArgumentEN entityArgumentEN = null;
            int oid;

            //Initialized EntityArgumentEN
            entityArgumentEN      = new EntityArgumentEN();
            entityArgumentEN.Name = p_name;

            entityArgumentEN.Type = p_type;


            if (p_entityOperation != -1)
            {
                // El argumento p_entityOperation -> Property entityOperation es oid = false
                // Lista de oids id
                entityArgumentEN.EntityOperation    = new MoSIoTGenNHibernate.EN.MosIoT.EntityOperationEN();
                entityArgumentEN.EntityOperation.Id = p_entityOperation;
            }

            //Call to EntityArgumentCAD

            oid = _IEntityArgumentCAD.New_(entityArgumentEN);
            return(oid);
        }
        public static EntityArgumentEN Convert(EntityArgumentDTO dto)
        {
            EntityArgumentEN newinstance = null;

            try
            {
                if (dto != null)
                {
                    newinstance = new EntityArgumentEN();



                    newinstance.Id   = dto.Id;
                    newinstance.Name = dto.Name;
                    newinstance.Type = dto.Type;
                    if (dto.EntityOperation_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IEntityOperationCAD entityOperationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityOperationCAD();

                        newinstance.EntityOperation = entityOperationCAD.ReadOIDDefault(dto.EntityOperation_oid);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }
// Modify default (Update all attributes of the class)

        public void ModifyDefault(EntityArgumentEN entityArgument)
        {
            try
            {
                SessionInitializeTransaction();
                EntityArgumentEN entityArgumentEN = (EntityArgumentEN)session.Load(typeof(EntityArgumentEN), entityArgument.Id);

                entityArgumentEN.Name = entityArgument.Name;


                entityArgumentEN.Type = entityArgument.Type;


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

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


            finally
            {
                SessionClose();
            }
        }
        public EntityArgumentEN ReadOIDDefault(int id
                                               )
        {
            EntityArgumentEN entityArgumentEN = null;

            try
            {
                SessionInitializeTransaction();
                entityArgumentEN = (EntityArgumentEN)session.Get(typeof(EntityArgumentEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(entityArgumentEN);
        }
        public void Destroy(int id
                            )
        {
            try
            {
                SessionInitializeTransaction();
                EntityArgumentEN entityArgumentEN = (EntityArgumentEN)session.Load(typeof(EntityArgumentEN), id);
                session.Delete(entityArgumentEN);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }
        }
        public int New_(EntityArgumentEN entityArgument)
        {
            try
            {
                SessionInitializeTransaction();
                if (entityArgument.EntityOperation != null)
                {
                    // Argumento OID y no colección.
                    entityArgument.EntityOperation = (MoSIoTGenNHibernate.EN.MosIoT.EntityOperationEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.EntityOperationEN), entityArgument.EntityOperation.Id);

                    entityArgument.EntityOperation.EntityArgument
                    .Add(entityArgument);
                }

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

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


            finally
            {
                SessionClose();
            }

            return(entityArgument.Id);
        }
Ejemplo n.º 7
0
        public EntityArgumentEN ReadOID(int id
                                        )
        {
            EntityArgumentEN entityArgumentEN = null;

            entityArgumentEN = _IEntityArgumentCAD.ReadOID(id);
            return(entityArgumentEN);
        }
Ejemplo n.º 8
0
        public void Modify(int p_EntityArgument_OID, string p_name, MoSIoTGenNHibernate.Enumerated.MosIoT.DataTypeEnum p_type)
        {
            EntityArgumentEN entityArgumentEN = null;

            //Initialized EntityArgumentEN
            entityArgumentEN      = new EntityArgumentEN();
            entityArgumentEN.Id   = p_EntityArgument_OID;
            entityArgumentEN.Name = p_name;
            entityArgumentEN.Type = p_type;
            //Call to EntityArgumentCAD

            _IEntityArgumentCAD.Modify(entityArgumentEN);
        }