// Modify default (Update all attributes of the class) public void ModifyDefault(InheritanceEN inheritance) { try { SessionInitializeTransaction(); InheritanceEN inheritanceEN = (InheritanceEN)session.Load(typeof(InheritanceEN), inheritance.Id); session.Update(inheritanceEN); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in InheritanceCAD.", ex); } finally { SessionClose(); } }
public InheritanceEN ReadOIDDefault(int id ) { InheritanceEN inheritanceEN = null; try { SessionInitializeTransaction(); inheritanceEN = (InheritanceEN)session.Get(typeof(InheritanceEN), id); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in InheritanceCAD.", ex); } finally { SessionClose(); } return(inheritanceEN); }
public int New_(InheritanceEN inheritance) { try { SessionInitializeTransaction(); if (inheritance.Son != null) { // Argumento OID y no colección. inheritance.Son = (MoSIoTGenNHibernate.EN.MosIoT.EntityEN)session.Load(typeof(MoSIoTGenNHibernate.EN.MosIoT.EntityEN), inheritance.Son.Id); inheritance.Son.InheritanceSon .Add(inheritance); } session.Save(inheritance); SessionCommit(); } catch (Exception ex) { SessionRollBack(); if (ex is MoSIoTGenNHibernate.Exceptions.ModelException) { throw ex; } throw new MoSIoTGenNHibernate.Exceptions.DataLayerException("Error in InheritanceCAD.", ex); } finally { SessionClose(); } return(inheritance.Id); }
public InheritanceEN ReadOID(int id ) { InheritanceEN inheritanceEN = null; inheritanceEN = _IInheritanceCAD.ReadOID(id); return(inheritanceEN); }
public void Modify(int p_Inheritance_OID) { InheritanceEN inheritanceEN = null; //Initialized InheritanceEN inheritanceEN = new InheritanceEN(); inheritanceEN.Id = p_Inheritance_OID; //Call to InheritanceCAD _IInheritanceCAD.Modify(inheritanceEN); }
public int New_(int p_son) { InheritanceEN inheritanceEN = null; int oid; //Initialized InheritanceEN inheritanceEN = new InheritanceEN(); if (p_son != -1) { // El argumento p_son -> Property son es oid = false // Lista de oids id inheritanceEN.Son = new MoSIoTGenNHibernate.EN.MosIoT.EntityEN(); inheritanceEN.Son.Id = p_son; } //Call to InheritanceCAD oid = _IInheritanceCAD.New_(inheritanceEN); return(oid); }
public static InheritanceEN Convert(InheritanceDTO dto) { InheritanceEN newinstance = null; try { if (dto != null) { newinstance = new InheritanceEN(); if (dto.Father_oid != null) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD(); newinstance.Father = new System.Collections.Generic.List <MoSIoTGenNHibernate.EN.MosIoT.EntityEN>(); foreach (int entry in dto.Father_oid) { newinstance.Father.Add(entityCAD.ReadOIDDefault(entry)); } } if (dto.Son_oid != -1) { MoSIoTGenNHibernate.CAD.MosIoT.IEntityCAD entityCAD = new MoSIoTGenNHibernate.CAD.MosIoT.EntityCAD(); newinstance.Son = entityCAD.ReadOIDDefault(dto.Son_oid); } newinstance.Id = dto.Id; } } catch (Exception ex) { throw ex; } return(newinstance); }