Exemplo 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(GetFXTrade request)
        {
            logger.Debug(JsonConvert.SerializeObject(request));
            FXTradeValidator validator = new FXTradeValidator();
            ValidationResult results   = validator.Validate(request);

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

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

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

                if (request.FenxiaoID != 0)
                {
                    q = q.Where(u => u.fenxiao_id == request.FenxiaoID);
                }

                if (!string.IsNullOrEmpty(request.SupplierName))
                {
                    q = q.Where(u => u.supplier_username == request.SupplierName);
                }
                if (!string.IsNullOrEmpty(request.DistributorUserName))
                {
                    q = q.Where(u => u.distributor_username == request.DistributorUserName);
                }

                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);
            }
        }
Exemplo 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(GetFXTrade  request)
        {
            logger.Debug(JsonConvert.SerializeObject(request));
            FXTradeValidator validator = new FXTradeValidator();
            ValidationResult results = validator.Validate(request);
            if (!results.IsValid)
            {
                logger.Error(JsonConvert.SerializeObject(results));
                return results;
            }

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

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

                if (request.FenxiaoID  != 0)
                {
                    q = q.Where(u => u.fenxiao_id  == request.FenxiaoID );
                }

                if (!string.IsNullOrEmpty(request.SupplierName ))
                {
                    q = q.Where(u => u.supplier_username  == request.SupplierName );
                }
                if (!string.IsNullOrEmpty(request.DistributorUserName ))
                {
                    q = q.Where(u => u.distributor_username  == request.DistributorUserName );
                }

                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;
            }
        }