public EntityOperationEN ReadOIDDefault(int id ) { EntityOperationEN entityOperationEN = null; try { SessionInitializeTransaction(); entityOperationEN = (EntityOperationEN)session.Get(typeof(EntityOperationEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityOperationCAD.", ex); } finally { SessionClose(); } return(entityOperationEN); }
public int New_(string p_name, MoSIoTGenNHibernate.Enumerated.MosIoT.DataTypeEnum p_type, MoSIoTGenNHibernate.Enumerated.MosIoT.ServiceTypeEnum p_serviceType, string p_description, int p_entity) { EntityOperationEN entityOperationEN = null; int oid; //Initialized EntityOperationEN entityOperationEN = new EntityOperationEN(); entityOperationEN.Name = p_name; entityOperationEN.Type = p_type; entityOperationEN.ServiceType = p_serviceType; entityOperationEN.Description = p_description; if (p_entity != -1) { // El argumento p_entity -> Property entity es oid = false // Lista de oids id entityOperationEN.Entity = new MoSIoTGenNHibernate.EN.MosIoT.EntityEN(); entityOperationEN.Entity.Id = p_entity; } //Call to EntityOperationCAD oid = _IEntityOperationCAD.New_(entityOperationEN); return(oid); }
public int New_(EntityOperationEN entityOperation) { try { SessionInitializeTransaction(); if (entityOperation.Entity != null) { // Argumento OID y no colección. entityOperation.Entity = (MoSIoTGenNHibernate.EN.MosIoT.EntityEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.EntityEN), entityOperation.Entity.Id); entityOperation.Entity.Operations .Add(entityOperation); } session.Save(entityOperation); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityOperationCAD.", ex); } finally { SessionClose(); } return(entityOperation.Id); }
public void Destroy(int id ) { try { SessionInitializeTransaction(); EntityOperationEN entityOperationEN = (EntityOperationEN)session.Load(typeof(EntityOperationEN), id); session.Delete(entityOperationEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityOperationCAD.", ex); } finally { SessionClose(); } }
public EntityOperationEN ReadOID(int id ) { EntityOperationEN entityOperationEN = null; entityOperationEN = _IEntityOperationCAD.ReadOID(id); return(entityOperationEN); }
public void Modify(int p_EntityOperation_OID, string p_name, MoSIoTGenNHibernate.Enumerated.MosIoT.DataTypeEnum p_type, MoSIoTGenNHibernate.Enumerated.MosIoT.ServiceTypeEnum p_serviceType, string p_description) { EntityOperationEN entityOperationEN = null; //Initialized EntityOperationEN entityOperationEN = new EntityOperationEN(); entityOperationEN.Id = p_EntityOperation_OID; entityOperationEN.Name = p_name; entityOperationEN.Type = p_type; entityOperationEN.ServiceType = p_serviceType; entityOperationEN.Description = p_description; //Call to EntityOperationCAD _IEntityOperationCAD.Modify(entityOperationEN); }
public static IMCommandDTOA Convert(EntityOperationEN en, NHibernate.ISession session = null) { IMCommandDTOA dto = null; IMCommandRESTCAD iMCommandRESTCAD = null; IMCommandCEN iMCommandCEN = null; IMCommandCP iMCommandCP = null; if (en != null) { dto = new IMCommandDTOA(); iMCommandRESTCAD = new IMCommandRESTCAD(session); iMCommandCEN = new IMCommandCEN(iMCommandRESTCAD); iMCommandCP = new IMCommandCP(session); IMCommandEN enHijo = iMCommandRESTCAD.ReadOIDDefault(en.Id); // // Attributes dto.Id = en.Id; dto.Name = en.Name; dto.Description = en.Description; // // TravesalLink /* Rol: IMCommand o--> Command */ dto.ValueCommand = CommandAssembler.Convert((CommandEN)enHijo.Command, session); // // Service } return(dto); }
public static EntityOperationDTOA Convert(EntityOperationEN en, NHibernate.ISession session = null) { EntityOperationDTOA dto = null; EntityOperationRESTCAD entityOperationRESTCAD = null; EntityOperationCEN entityOperationCEN = null; EntityOperationCP entityOperationCP = null; if (en != null) { dto = new EntityOperationDTOA(); entityOperationRESTCAD = new EntityOperationRESTCAD(session); entityOperationCEN = new EntityOperationCEN(entityOperationRESTCAD); entityOperationCP = new EntityOperationCP(session); // // Attributes dto.Id = en.Id; dto.Name = en.Name; dto.Type = en.Type; dto.ServiceType = en.ServiceType; dto.Description = en.Description; // // TravesalLink // // Service } return(dto); }
// Modify default (Update all attributes of the class) public void ModifyDefault(EntityOperationEN entityOperation) { try { SessionInitializeTransaction(); EntityOperationEN entityOperationEN = (EntityOperationEN)session.Load(typeof(EntityOperationEN), entityOperation.Id); entityOperationEN.Name = entityOperation.Name; entityOperationEN.Type = entityOperation.Type; entityOperationEN.ServiceType = entityOperation.ServiceType; entityOperationEN.Description = entityOperation.Description; session.Update(entityOperationEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in EntityOperationCAD.", ex); } finally { SessionClose(); } }
public static EntityOperationEN Convert(EntityOperationDTO dto) { EntityOperationEN newinstance = null; try { if (dto != null) { newinstance = new EntityOperationEN(); newinstance.Id = dto.Id; newinstance.Name = dto.Name; newinstance.Type = dto.Type; newinstance.ServiceType = dto.ServiceType; newinstance.Description = dto.Description; if (dto.EntityArgument != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityArgumentCAD entityArgumentCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityArgumentCAD(); newinstance.EntityArgument = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityArgumentEN>(); foreach (EntityArgumentDTO entry in dto.EntityArgument) { newinstance.EntityArgument.Add(EntityArgumentAssemblerDTO.Convert(entry)); } } if (dto.Entity_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD(); newinstance.Entity = entityCAD.ReadOIDDefault(dto.Entity_oid); } if (dto.RuleAction_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IRecipeActionCAD recipeActionCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RecipeActionCAD(); newinstance.RuleAction = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RecipeActionEN>(); foreach (int entry in dto.RuleAction_oid) { newinstance.RuleAction.Add(recipeActionCAD.ReadOIDDefault(entry)); } } if (dto.OriginState_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityStateCAD entityStateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityStateCAD(); newinstance.OriginState = entityStateCAD.ReadOIDDefault(dto.OriginState_oid); } if (dto.TargetState_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityStateCAD entityStateCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityStateCAD(); newinstance.TargetState = entityStateCAD.ReadOIDDefault(dto.TargetState_oid); } if (dto.Triggers_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IRecipeTriggerCAD recipeTriggerCAD = new MoSIoTGenNHibernate.CAD.MosIoT.RecipeTriggerCAD(); newinstance.Triggers = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.RecipeTriggerEN>(); foreach (int entry in dto.Triggers_oid) { newinstance.Triggers.Add(recipeTriggerCAD.ReadOIDDefault(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }