Exemplo n.º 1
0
 /// <summary>
 /// Obtiene un categoryEntity específico
 /// </summary>
 /// <param name="id">id del CategoryEntity a cargar</param>
 /// <param name="loadRelation">true para cargar las relaciones</param>
 /// <returns>Un CategoryEntity</returns>
 /// <exception cref="ArgumentNullException">
 /// Si <paramref name="categoryEntity"/> is null.
 /// </exception>
 /// <exception cref="UtnEmallBusinessLogicException">
 /// Si una excepción UtnEmallDataAccessException ocurre en el data model.
 /// </exception>
 public CategoryEntity GetCategory(int id, bool loadRelation)
 {
     try
     {
         return(categoryDataAccess.Load(id, loadRelation));
     }
     catch (UtnEmallDataAccessException utnEmallDataAccessException)
     {
         throw new UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Get an specific categoryEntity
        /// </summary>
        /// <param name="id">id of the CategoryEntity to load</param>
        /// <param name="loadRelation">true to load the relations</param>
        /// <param name="session">User's session identifier.</param>
        /// <returns>A CategoryEntity</returns>
        /// <exception cref="ArgumentNullException">
        /// if <paramref name="categoryEntity"/> is null.
        /// </exception>
        /// <exception cref="UtnEmallBusinessLogicException">
        /// If an UtnEmallDataAccessException occurs in DataModel.
        /// </exception>
        public CategoryEntity GetCategory(int id, bool loadRelation, string session)
        {
            bool permited = ValidationService.Instance.ValidatePermission(session, "read", "Category");

            if (!permited)
            {
                ExceptionDetail detail = new ExceptionDetail(new UtnEmall.Server.BusinessLogic.UtnEmallPermissionException("The user hasn't permissions to read an entity"));
                throw new FaultException <ExceptionDetail>(detail);
            }

            try
            {
                return(categoryDataAccess.Load(id, loadRelation));
            }
            catch (UtnEmallDataAccessException utnEmallDataAccessException)
            {
                throw new UtnEmall.Server.BusinessLogic.UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException);
            }
        }