Пример #1
0
        /// <summary>
        /// Selects all category.--by Will
        /// </summary>
        /// <returns></returns>
        public List <CategoryBE> SelectAllCategory()
        {
            SelectAllCategoryRequest  request  = new SelectAllCategoryRequest();
            SelectAllCategoryResponse response = MyChannelFactory.CreateChannel().SelectAllCategory(request);

            if (response.IsFailed)
            {
                throw (new Exception(response.Message));
            }
            return(response.CategoryList);
        }
Пример #2
0
        /// <summary>
        /// Selects all category.--by Will
        /// </summary>
        /// <returns></returns>
        public List <CategoryBE> SelectAllCategory()
        {
            SelectAllCategoryRequest  request  = new SelectAllCategoryRequest();
            SelectAllCategoryResponse response = MyChannelFactory.CreateChannel().SelectAllCategory(request);

            if (response.IsFailed)
            {
                ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
                log.Error("error", new Exception(response.Message));
                log.Fatal("fatal", new Exception(response.Message));
                throw (new Exception(response.Message));
            }
            return(response.CategoryList);
        }
Пример #3
0
        /// <summary>
        /// Selects all category.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public SelectAllCategoryResponse SelectAllCategory(SelectAllCategoryRequest request)
        {
            SelectAllCategoryResponse response = new SelectAllCategoryResponse();
            ProductService            service  = new ProductService();

            try
            {
                response.CategoryList = service.SelectAllCategory();
                if (response.CategoryList == null)
                {
                    response.IsFailed = true; response.Message = "We don not have Category";
                }
            }
            catch (Exception ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }

            return(response);
        }