public EntityAttributesEN ReadOIDDefault(int id ) { EntityAttributesEN entityAttributesEN = null; try { SessionInitializeTransaction(); entityAttributesEN = (EntityAttributesEN)session.Get(typeof(EntityAttributesEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityAttributesCAD.", ex); } finally { SessionClose(); } return(entityAttributesEN); }
public int New_(EntityAttributesEN entityAttributes) { try { SessionInitializeTransaction(); if (entityAttributes.Entity != null) { // Argumento OID y no colección. entityAttributes.Entity = (MoSIoTGenNHibernate.EN.MosIoT.EntityEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.EntityEN), entityAttributes.Entity.Id); entityAttributes.Entity.Attributes .Add(entityAttributes); } session.Save(entityAttributes); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityAttributesCAD.", ex); } finally { SessionClose(); } return(entityAttributes.Id); }
public void Destroy(int id ) { try { SessionInitializeTransaction(); EntityAttributesEN entityAttributesEN = (EntityAttributesEN)session.Load(typeof(EntityAttributesEN), id); session.Delete(entityAttributesEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityAttributesCAD.", ex); } finally { SessionClose(); } }
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) { EntityAttributesEN entityAttributesEN = null; int oid; //Initialized EntityAttributesEN entityAttributesEN = new EntityAttributesEN(); entityAttributesEN.Name = p_name; entityAttributesEN.Type = p_type; entityAttributesEN.IsOID = p_isOID; entityAttributesEN.IsWritable = p_isWritable; entityAttributesEN.Description = p_description; if (p_entity != -1) { // El argumento p_entity -> Property entity es oid = false // Lista de oids id entityAttributesEN.Entity = new MoSIoTGenNHibernate.EN.MosIoT.EntityEN(); entityAttributesEN.Entity.Id = p_entity; } entityAttributesEN.Value = p_value; //Call to EntityAttributesCAD oid = _IEntityAttributesCAD.New_(entityAttributesEN); return(oid); }
public EntityAttributesEN ReadOID(int id ) { EntityAttributesEN entityAttributesEN = null; entityAttributesEN = _IEntityAttributesCAD.ReadOID(id); return(entityAttributesEN); }
public static EntityAttributesDTOA Convert(EntityAttributesEN en, NHibernate.ISession session = null) { EntityAttributesDTOA dto = null; EntityAttributesRESTCAD entityAttributesRESTCAD = null; EntityAttributesCEN entityAttributesCEN = null; EntityAttributesCP entityAttributesCP = null; if (en != null) { dto = new EntityAttributesDTOA(); entityAttributesRESTCAD = new EntityAttributesRESTCAD(session); entityAttributesCEN = new EntityAttributesCEN(entityAttributesRESTCAD); entityAttributesCP = new EntityAttributesCP(session); // // Attributes dto.Id = en.Id; dto.Name = en.Name; dto.Type = en.Type; dto.IsOID = en.IsOID; dto.AssociationType = en.AssociationType; dto.IsWritable = en.IsWritable; dto.Description = en.Description; // // TravesalLink // // Service } return(dto); }
// Modify default (Update all attributes of the class) public void ModifyDefault(EntityAttributesEN entityAttributes) { try { SessionInitializeTransaction(); EntityAttributesEN entityAttributesEN = (EntityAttributesEN)session.Load(typeof(EntityAttributesEN), entityAttributes.Id); entityAttributesEN.Name = entityAttributes.Name; entityAttributesEN.Type = entityAttributes.Type; entityAttributesEN.IsOID = entityAttributes.IsOID; entityAttributesEN.AssociationType = entityAttributes.AssociationType; entityAttributesEN.IsWritable = entityAttributes.IsWritable; entityAttributesEN.Description = entityAttributes.Description; entityAttributesEN.Value = entityAttributes.Value; session.Update(entityAttributesEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityAttributesCAD.", ex); } finally { SessionClose(); } }
public static IMPropertyDTOA Convert(EntityAttributesEN en, NHibernate.ISession session = null) { IMPropertyDTOA dto = null; IMPropertyRESTCAD iMPropertyRESTCAD = null; IMPropertyCEN iMPropertyCEN = null; IMPropertyCP iMPropertyCP = null; if (en != null) { dto = new IMPropertyDTOA(); iMPropertyRESTCAD = new IMPropertyRESTCAD(session); iMPropertyCEN = new IMPropertyCEN(iMPropertyRESTCAD); iMPropertyCP = new IMPropertyCP(session); IMPropertyEN enHijo = iMPropertyRESTCAD.ReadOIDDefault(en.Id); // // Attributes dto.Id = en.Id; dto.Name = en.Name; dto.Type = en.Type; dto.Value = en.Value; // // TravesalLink /* Rol: IMProperty o--> Property */ dto.ValueProperty = PropertyAssembler.Convert((PropertyEN)enHijo.Property, session); // // Service } return(dto); }
public void Modify(int p_EntityAttributes_OID, string p_name, MoSIoTGenNHibernate.Enumerated.MosIoT.DataTypeEnum p_type, bool p_isOID, bool p_isWritable, string p_description, string p_value) { EntityAttributesEN entityAttributesEN = null; //Initialized EntityAttributesEN entityAttributesEN = new EntityAttributesEN(); entityAttributesEN.Id = p_EntityAttributes_OID; entityAttributesEN.Name = p_name; entityAttributesEN.Type = p_type; entityAttributesEN.IsOID = p_isOID; entityAttributesEN.IsWritable = p_isWritable; entityAttributesEN.Description = p_description; entityAttributesEN.Value = p_value; //Call to EntityAttributesCAD _IEntityAttributesCAD.Modify(entityAttributesEN); }
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); }
public static IMConditionDTOA Convert(EntityAttributesEN en, NHibernate.ISession session = null) { IMConditionDTOA dto = null; IMConditionRESTCAD iMConditionRESTCAD = null; IMConditionCEN iMConditionCEN = null; IMConditionCP iMConditionCP = null; if (en != null) { dto = new IMConditionDTOA(); iMConditionRESTCAD = new IMConditionRESTCAD(session); iMConditionCEN = new IMConditionCEN(iMConditionRESTCAD); iMConditionCP = new IMConditionCP(session); IMConditionEN enHijo = iMConditionRESTCAD.ReadOIDDefault(en.Id); // // Attributes dto.Id = en.Id; dto.Name = en.Name; dto.Description = en.Description; // // TravesalLink /* Rol: IMCondition o--> Condition */ dto.ValueCondition = ConditionAssembler.Convert((ConditionEN)enHijo.Condition, session); // // Service } return(dto); }
public static EntityAttributesEN Convert(EntityAttributesDTO dto) { EntityAttributesEN newinstance = null; try { if (dto != null) { newinstance = new EntityAttributesEN(); 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); }