Example #1
0
        public void Modificar(FamiliaPackEN familiaPack)
        {
            try
            {
                SesssionInitializeTransaction();
                FamiliaPackEN familiaPackEN = (FamiliaPackEN)session.Load(typeof(FamiliaPackEN), familiaPack.IdFamPack);

                familiaPackEN.Nombre = familiaPack.Nombre;


                familiaPackEN.Codigo = familiaPack.Codigo;


                familiaPackEN.Color = familiaPack.Color;

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

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


            finally
            {
                SessionClose();
            }
        }
Example #2
0
        public int Crear(FamiliaPackEN familiaPack)
        {
            try
            {
                SesssionInitializeTransaction();

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

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


            finally
            {
                SessionClose();
            }

            return(familiaPack.IdFamPack);
        }
Example #3
0
        public FamiliaPackEN ReadOIDDefault(int idFamPack)
        {
            FamiliaPackEN familiaPackEN = null;

            try
            {
                SesssionInitializeTransaction();
                familiaPackEN = (FamiliaPackEN)session.Load(typeof(FamiliaPackEN),
                                                            idFamPack

                                                            );
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(familiaPackEN);
        }
Example #4
0
        public void Eliminar(int idFamPack)
        {
            try
            {
                SesssionInitializeTransaction();
                FamiliaPackEN familiaPackEN = (FamiliaPackEN)session.Load(typeof(FamiliaPackEN),
                                                                          idFamPack

                                                                          );
                session.Delete(familiaPackEN);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }
        }
Example #5
0
        public static FamiliaPackDTO Convert(FamiliaPackEN en)
        {
            FamiliaPackDTO newinstance = null;

            if (en != null)
            {
                newinstance = new FamiliaPackDTO();



                newinstance.IdFamPack = en.IdFamPack;
                newinstance.Nombre    = en.Nombre;
                newinstance.Codigo    = en.Codigo;
                newinstance.Color     = en.Color;
                if (en.Pack != null)
                {
                    newinstance.Pack_oid = new System.Collections.Generic.List <Int32>();
                    foreach (PersonalHomeGenNHibernate.EN.PersonalHome.PackEN entry in en.Pack)
                    {
                        newinstance.Pack_oid.Add(entry.IdPack);
                    }
                }
                if (en.TipoEstancia != null)
                {
                    newinstance.TipoEstancia_oid = new System.Collections.Generic.List <Int32>();
                    foreach (PersonalHomeGenNHibernate.EN.PersonalHome.TipoEstanciaEN entry in en.TipoEstancia)
                    {
                        newinstance.TipoEstancia_oid.Add(entry.IdTipoEstancia);
                    }
                }
            }

            return(newinstance);
        }
Example #6
0
        public FamiliaPackEN DamePorID(int idFamPack)
        {
            FamiliaPackEN familiaPackEN = null;

            familiaPackEN = _IFamiliaPackCAD.DamePorID(
                idFamPack

                );
            return(familiaPackEN);
        }
Example #7
0
        public void Modificar(int p_FamiliaPack_OID, String p_nombre, String p_codigo, String p_color)
        {
            FamiliaPackEN familiaPackEN = null;

            //Initialized FamiliaPackEN
            familiaPackEN           = new FamiliaPackEN();
            familiaPackEN.IdFamPack = p_FamiliaPack_OID;
            familiaPackEN.Nombre    = p_nombre;
            familiaPackEN.Codigo    = p_codigo;
            familiaPackEN.Color     = p_color;
            //Call to FamiliaPackCAD

            _IFamiliaPackCAD.Modificar(familiaPackEN);
        }
Example #8
0
        public int Crear(String p_nombre, String p_codigo, String p_color)
        {
            FamiliaPackEN familiaPackEN = null;
            int           oid;

            //Initialized FamiliaPackEN
            familiaPackEN        = new FamiliaPackEN();
            familiaPackEN.Nombre = p_nombre;
            familiaPackEN.Codigo = p_codigo;
            familiaPackEN.Color  = p_color;
            //Call to FamiliaPackCAD

            oid = _IFamiliaPackCAD.Crear(familiaPackEN);
            return(oid);
        }
Example #9
0
        public static FamiliaPackEN Convert(FamiliaPackDTO dto)
        {
            FamiliaPackEN newinstance = null;

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



                    newinstance.IdFamPack = dto.IdFamPack;
                    newinstance.Nombre    = dto.Nombre;
                    newinstance.Codigo    = dto.Codigo;
                    newinstance.Color     = dto.Color;
                    if (dto.Pack_oid != null)
                    {
                        PersonalHomeGenNHibernate.CAD.PersonalHome.IPackCAD packCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.PackCAD();

                        newinstance.Pack = new System.Collections.Generic.List <PersonalHomeGenNHibernate.EN.PersonalHome.PackEN>();
                        foreach (int entry in dto.Pack_oid)
                        {
                            newinstance.Pack.Add(packCAD.ReadOIDDefault(entry));
                        }
                    }
                    if (dto.TipoEstancia_oid != null)
                    {
                        PersonalHomeGenNHibernate.CAD.PersonalHome.ITipoEstanciaCAD tipoEstanciaCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.TipoEstanciaCAD();

                        newinstance.TipoEstancia = new System.Collections.Generic.List <PersonalHomeGenNHibernate.EN.PersonalHome.TipoEstanciaEN>();
                        foreach (int entry in dto.TipoEstancia_oid)
                        {
                            newinstance.TipoEstancia.Add(tipoEstanciaCAD.ReadOIDDefault(entry));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newinstance);
        }