Esempio n. 1
0
        /// <summary>
        /// Counts the order details by product id. --Will
        /// </summary>
        /// <param name="productid">The productid.</param>
        /// <returns></returns>
        public int CountOrderDetailsByProductId(int productid)
        {
            CountOrderDetailsByProductIdRequest request = new CountOrderDetailsByProductIdRequest();

            request.Id = productid;
            CountOrderDetailsByProductIdResponse response = MyChannelFactory.CreateChannel().CountOrderDetailsByProductId(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.count);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the order details by product id.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>
        public CountOrderDetailsByProductIdResponse CountOrderDetailsByProductId(CountOrderDetailsByProductIdRequest request)
        {
            CountOrderDetailsByProductIdResponse response = new CountOrderDetailsByProductIdResponse();
            ProductService service = new ProductService();

            try
            {
                response.count = service.CountOrderDetailsByProductId(request.Id);
            }
            catch (Exception ex)
            {
                response.IsFailed = true;
                response.Message  = ex.Message;
            }

            return(response);
        }