Exemplo n.º 1
0
// Modify default (Update all attributes of the class)

        public void ModifyDefault(IMAdaptationTypeEN iMAdaptationType)
        {
            try
            {
                SessionInitializeTransaction();
                IMAdaptationTypeEN iMAdaptationTypeEN = (IMAdaptationTypeEN)session.Load(typeof(IMAdaptationTypeEN), iMAdaptationType.Id);

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

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


            finally
            {
                SessionClose();
            }
        }
Exemplo n.º 2
0
        public IMAdaptationTypeEN ReadOIDDefault(int id
                                                 )
        {
            IMAdaptationTypeEN iMAdaptationTypeEN = null;

            try
            {
                SessionInitializeTransaction();
                iMAdaptationTypeEN = (IMAdaptationTypeEN)session.Get(typeof(IMAdaptationTypeEN), id);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(iMAdaptationTypeEN);
        }
        public IMAdaptationTypeEN ReadOID(int id
                                          )
        {
            IMAdaptationTypeEN iMAdaptationTypeEN = null;

            iMAdaptationTypeEN = _IIMAdaptationTypeCAD.ReadOID(id);
            return(iMAdaptationTypeEN);
        }
        public void Modify(int p_IMAdaptationType_OID, string p_name, MoSIoTGenNHibernate.Enumerated.MosIoT.DataTypeEnum p_type, bool p_isOID, bool p_isWritable, string p_description, string p_value)
        {
            IMAdaptationTypeEN iMAdaptationTypeEN = null;

            //Initialized IMAdaptationTypeEN
            iMAdaptationTypeEN             = new IMAdaptationTypeEN();
            iMAdaptationTypeEN.Id          = p_IMAdaptationType_OID;
            iMAdaptationTypeEN.Name        = p_name;
            iMAdaptationTypeEN.Type        = p_type;
            iMAdaptationTypeEN.IsOID       = p_isOID;
            iMAdaptationTypeEN.IsWritable  = p_isWritable;
            iMAdaptationTypeEN.Description = p_description;
            iMAdaptationTypeEN.Value       = p_value;
            //Call to IMAdaptationTypeCAD

            _IIMAdaptationTypeCAD.Modify(iMAdaptationTypeEN);
        }
Exemplo n.º 5
0
        public static IMAdaptationTypeDTOA Convert(EntityAttributesEN en, NHibernate.ISession session = null)
        {
            IMAdaptationTypeDTOA    dto = null;
            IMAdaptationTypeRESTCAD iMAdaptationTypeRESTCAD = null;
            IMAdaptationTypeCEN     iMAdaptationTypeCEN     = null;
            IMAdaptationTypeCP      iMAdaptationTypeCP      = null;

            if (en != null)
            {
                dto = new IMAdaptationTypeDTOA();
                iMAdaptationTypeRESTCAD = new IMAdaptationTypeRESTCAD(session);
                iMAdaptationTypeCEN     = new IMAdaptationTypeCEN(iMAdaptationTypeRESTCAD);
                iMAdaptationTypeCP      = new IMAdaptationTypeCP(session);


                IMAdaptationTypeEN enHijo = iMAdaptationTypeRESTCAD.ReadOIDDefault(en.Id);



                //
                // Attributes

                dto.Id = en.Id;

                dto.Name = en.Name;


                dto.Description = en.Description;


                //
                // TravesalLink

                /* Rol: IMAdaptationType o--> AdaptationTypeRequired */
                dto.ValueAdaptionType = AdaptationTypeRequiredAssembler.Convert((AdaptationTypeRequiredEN)enHijo.AdaptationTypeRequired, session);


                //
                // Service
            }

            return(dto);
        }
Exemplo n.º 6
0
        public void Modify(IMAdaptationTypeEN iMAdaptationType)
        {
            try
            {
                SessionInitializeTransaction();
                IMAdaptationTypeEN iMAdaptationTypeEN = (IMAdaptationTypeEN)session.Load(typeof(IMAdaptationTypeEN), iMAdaptationType.Id);

                iMAdaptationTypeEN.Name = iMAdaptationType.Name;


                iMAdaptationTypeEN.Type = iMAdaptationType.Type;


                iMAdaptationTypeEN.IsOID = iMAdaptationType.IsOID;


                iMAdaptationTypeEN.IsWritable = iMAdaptationType.IsWritable;


                iMAdaptationTypeEN.Description = iMAdaptationType.Description;


                iMAdaptationTypeEN.Value = iMAdaptationType.Value;

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

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


            finally
            {
                SessionClose();
            }
        }
Exemplo n.º 7
0
        public int New_(IMAdaptationTypeEN iMAdaptationType)
        {
            try
            {
                SessionInitializeTransaction();
                if (iMAdaptationType.Entity != null)
                {
                    // Argumento OID y no colección.
                    iMAdaptationType.Entity = (MoSIoTGenNHibernate.EN.MosIoT.EntityEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.EntityEN), iMAdaptationType.Entity.Id);

                    iMAdaptationType.Entity.Attributes
                    .Add(iMAdaptationType);
                }
                if (iMAdaptationType.AdaptationTypeRequired != null)
                {
                    // Argumento OID y no colección.
                    iMAdaptationType.AdaptationTypeRequired = (MoSIoTGenNHibernate.EN.MosIoT.AdaptationTypeRequiredEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.AdaptationTypeRequiredEN), iMAdaptationType.AdaptationTypeRequired.Id);

                    iMAdaptationType.AdaptationTypeRequired.IMAdaptationType
                    .Add(iMAdaptationType);
                }

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

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


            finally
            {
                SessionClose();
            }

            return(iMAdaptationType.Id);
        }
        public int New_(string p_name, MoSIoTGenNHibernate.Enumerated.MosIoT.DataTypeEnum p_type, bool p_isOID, bool p_isWritable, string p_description, int p_entity, string p_value, int p_adaptationTypeRequired)
        {
            IMAdaptationTypeEN iMAdaptationTypeEN = null;
            int oid;

            //Initialized IMAdaptationTypeEN
            iMAdaptationTypeEN      = new IMAdaptationTypeEN();
            iMAdaptationTypeEN.Name = p_name;

            iMAdaptationTypeEN.Type = p_type;

            iMAdaptationTypeEN.IsOID = p_isOID;

            iMAdaptationTypeEN.IsWritable = p_isWritable;

            iMAdaptationTypeEN.Description = p_description;


            if (p_entity != -1)
            {
                // El argumento p_entity -> Property entity es oid = false
                // Lista de oids id
                iMAdaptationTypeEN.Entity    = new MoSIoTGenNHibernate.EN.MosIoT.EntityEN();
                iMAdaptationTypeEN.Entity.Id = p_entity;
            }

            iMAdaptationTypeEN.Value = p_value;


            if (p_adaptationTypeRequired != -1)
            {
                // El argumento p_adaptationTypeRequired -> Property adaptationTypeRequired es oid = false
                // Lista de oids id
                iMAdaptationTypeEN.AdaptationTypeRequired    = new MoSIoTGenNHibernate.EN.MosIoT.AdaptationTypeRequiredEN();
                iMAdaptationTypeEN.AdaptationTypeRequired.Id = p_adaptationTypeRequired;
            }

            //Call to IMAdaptationTypeCAD

            oid = _IIMAdaptationTypeCAD.New_(iMAdaptationTypeEN);
            return(oid);
        }
        public static IMAdaptationTypeEN Convert(IMAdaptationTypeDTO dto)
        {
            IMAdaptationTypeEN newinstance = null;

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



                    if (dto.AdaptationTypeRequired_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IAdaptationTypeRequiredCAD adaptationTypeRequiredCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AdaptationTypeRequiredCAD();

                        newinstance.AdaptationTypeRequired = adaptationTypeRequiredCAD.ReadOIDDefault(dto.AdaptationTypeRequired_oid);
                    }
                    newinstance.Id    = dto.Id;
                    newinstance.Name  = dto.Name;
                    newinstance.Type  = dto.Type;
                    newinstance.IsOID = dto.IsOID;
                    if (dto.TargetAssociation_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD();

                        newinstance.TargetAssociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>();
                        foreach (int entry in dto.TargetAssociation_oid)
                        {
                            newinstance.TargetAssociation.Add(associationCAD.ReadOIDDefault(entry));
                        }
                    }
                    if (dto.OriginAsociation_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IAssociationCAD associationCAD = new MoSIoTGenNHibernate.CAD.MosIoT.AssociationCAD();

                        newinstance.OriginAsociation = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.AssociationEN>();
                        foreach (int entry in dto.OriginAsociation_oid)
                        {
                            newinstance.OriginAsociation.Add(associationCAD.ReadOIDDefault(entry));
                        }
                    }
                    newinstance.AssociationType = dto.AssociationType;
                    newinstance.IsWritable      = dto.IsWritable;
                    newinstance.Description     = dto.Description;
                    if (dto.Entity_oid != -1)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD();

                        newinstance.Entity = entityCAD.ReadOIDDefault(dto.Entity_oid);
                    }
                    if (dto.Trigger_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IRecipeTriggerCAD recipeTriggerCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RecipeTriggerCAD();

                        newinstance.Trigger = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RecipeTriggerEN>();
                        foreach (int entry in dto.Trigger_oid)
                        {
                            newinstance.Trigger.Add(recipeTriggerCAD.ReadOIDDefault(entry));
                        }
                    }
                    if (dto.Register_oid != null)
                    {
                        MoSIoTGenNHibernate.CAD.MosIoT.IRegisterCAD registerCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RegisterCAD();

                        newinstance.Register = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RegisterEN>();
                        foreach (int entry in dto.Register_oid)
                        {
                            newinstance.Register.Add(registerCAD.ReadOIDDefault(entry));
                        }
                    }
                    newinstance.Value = dto.Value;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }