Ejemplo n.º 1
0
        /// <summary>
        /// Anies the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        /// <remarks>聚石塔WebService</remarks>
        public object Any(GetTBRefund request)
        {
            logger.Debug(JsonConvert.SerializeObject(request));
            TBRefundValidator validator = new TBRefundValidator();
            ValidationResult results = validator.Validate(request);
            if (!results.IsValid)
            {
                logger.Error(JsonConvert.SerializeObject(results));
                return results;
            }

            using (RDSContext db = new RDSContext())
            {
                IQueryable<jdp_tb_refund> q = db.jdp_tb_refund;

                //0:淘宝推送时间;1:订单修改时间;默认0
                if (request.DateType == 0)
                {
                    q = q.Where(u => u.jdp_modified >= request.StartDateTime && u.created <= request.EndDateTime).OrderBy(m => m.jdp_modified);
                }
                else
                {
                    q = q.Where(u => u.modified >= request.StartDateTime && u.created <= request.EndDateTime).OrderBy(m => m.modified);
                }

                //订单状态
                if (request.Status != 0)
                {
                    q = q.Where(u => u.status == ((TBRefundStatus)request.Status ).ToString());
                }
                //订单编号
                if (request.Tid != 0)
                {
                    q = q.Where(u => u.tid == request.Tid);
                }

                //退款单号
                if (request.RefundID  != 0)
                {
                    q = q.Where(u => u.refund_id  == request.RefundID);
                }

                //子订单编号
                if (request.Oid  != 0)
                {
                    q = q.Where(u => u.oid  == request.Oid );
                }

                //店铺
                if (!string.IsNullOrEmpty(request.SellerNick))
                {
                    q = q.Where(u => u.seller_nick == request.SellerNick);
                }
                //买家昵称
                if (!string.IsNullOrEmpty(request.BuyerNick))
                {
                    q = q.Where(u => u.buyer_nick == request.BuyerNick);
                }

                DefaultResponse response = new DefaultResponse();
                response.PageSize = request.PageSize;
                response.RecordCount = q.Count();
                response.PageCount = (int)Math.Ceiling(response.RecordCount * 1.00 / response.PageSize);
                response.Result = q.Skip(request.PageNo * request.PageSize).Take(request.PageSize).Select(u => u.jdp_response).ToList();
                logger.Debug(JsonConvert.SerializeObject(results));
                return response;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Anies the specified request.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns>System.Object.</returns>
        /// <remarks>聚石塔WebService</remarks>
        public object Any(GetTBRefund request)
        {
            logger.Debug(JsonConvert.SerializeObject(request));
            TBRefundValidator validator = new TBRefundValidator();
            ValidationResult  results   = validator.Validate(request);

            if (!results.IsValid)
            {
                logger.Error(JsonConvert.SerializeObject(results));
                return(results);
            }

            using (RDSContext db = new RDSContext())
            {
                IQueryable <jdp_tb_refund> q = db.jdp_tb_refund;

                //0:淘宝推送时间;1:订单修改时间;默认0
                if (request.DateType == 0)
                {
                    q = q.Where(u => u.jdp_modified >= request.StartDateTime && u.created <= request.EndDateTime).OrderBy(m => m.jdp_modified);
                }
                else
                {
                    q = q.Where(u => u.modified >= request.StartDateTime && u.created <= request.EndDateTime).OrderBy(m => m.modified);
                }

                //订单状态
                if (request.Status != 0)
                {
                    q = q.Where(u => u.status == ((TBRefundStatus)request.Status).ToString());
                }
                //订单编号
                if (request.Tid != 0)
                {
                    q = q.Where(u => u.tid == request.Tid);
                }

                //退款单号
                if (request.RefundID != 0)
                {
                    q = q.Where(u => u.refund_id == request.RefundID);
                }

                //子订单编号
                if (request.Oid != 0)
                {
                    q = q.Where(u => u.oid == request.Oid);
                }

                //店铺
                if (!string.IsNullOrEmpty(request.SellerNick))
                {
                    q = q.Where(u => u.seller_nick == request.SellerNick);
                }
                //买家昵称
                if (!string.IsNullOrEmpty(request.BuyerNick))
                {
                    q = q.Where(u => u.buyer_nick == request.BuyerNick);
                }

                DefaultResponse response = new DefaultResponse();
                response.PageSize    = request.PageSize;
                response.RecordCount = q.Count();
                response.PageCount   = (int)Math.Ceiling(response.RecordCount * 1.00 / response.PageSize);
                response.Result      = q.Skip(request.PageNo * request.PageSize).Take(request.PageSize).Select(u => u.jdp_response).ToList();
                logger.Debug(JsonConvert.SerializeObject(results));
                return(response);
            }
        }