Exemple #1
0
        public int Create(CategoryEN category)
        {
            try
            {
                SessionInitializeTransaction();

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

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


            finally
            {
                SessionClose();
            }

            return(category.CategoryId);
        }
Exemple #2
0
        public CategoryEN ReadOIDDefault(int categoryId)
        {
            CategoryEN categoryEN = null;

            try
            {
                SessionInitializeTransaction();
                categoryEN = (CategoryEN)session.Get(typeof(CategoryEN), categoryId);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }

            return(categoryEN);
        }
Exemple #3
0
        public void Modify(CategoryEN category)
        {
            try
            {
                SessionInitializeTransaction();
                CategoryEN categoryEN = (CategoryEN)session.Load(typeof(CategoryEN), category.CategoryId);

                categoryEN.Name = category.Name;


                categoryEN.Descripcion = category.Descripcion;

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

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


            finally
            {
                SessionClose();
            }
        }
Exemple #4
0
        public void Delete(int categoryId)
        {
            try
            {
                SessionInitializeTransaction();
                CategoryEN categoryEN = (CategoryEN)session.Load(typeof(CategoryEN), categoryId);
                session.Delete(categoryEN);
                SessionCommit();
            }

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


            finally
            {
                SessionClose();
            }
        }
Exemple #5
0
        public void Modify(int p_oid, string p_name, string p_descripcion)
        {
            CategoryEN categoryEN = null;

            //Initialized CategoryEN
            categoryEN             = new CategoryEN();
            categoryEN.CategoryId  = p_oid;
            categoryEN.Name        = p_name;
            categoryEN.Descripcion = p_descripcion;
            //Call to CategoryCAD

            _ICategoryCAD.Modify(categoryEN);
        }
Exemple #6
0
        public int Create(int p_categoryId, string p_name, string p_descripcion)
        {
            CategoryEN categoryEN = null;
            int        oid;

            //Initialized CategoryEN
            categoryEN            = new CategoryEN();
            categoryEN.CategoryId = p_categoryId;

            categoryEN.Name = p_name;

            categoryEN.Descripcion = p_descripcion;

            //Call to CategoryCAD

            oid = _ICategoryCAD.Create(categoryEN);
            return(oid);
        }