コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public string GetData()
        {
            var service = new DeliveryBLL(new SessionManager().CurrentUserLoginInfo);
            IList <DeliveryEntity> list = new List <DeliveryEntity>();

            //list.Add(new BillStatusModel() { Id = "1", Description = "门店自提" });
            //list.Add(new BillStatusModel() { Id = "2", Description = "门店送货" });
            //list.Add(new BillStatusModel() { Id = "3", Description = "快递配送" });

            list = service.GetAll().ToList();

            string content = string.Empty;

            var jsonData = new JsonData();

            jsonData.totalCount = list.Count.ToString();
            jsonData.data       = list;

            content = jsonData.ToJSON();
            return(content);
        }
コード例 #2
0
        /// <summary>
        /// 获取配送方式列表
        /// </summary>
        private string GetDeliveryList(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <EmptyRequestParameter> >();

            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            DeliveryBLL dService     = new DeliveryBLL(loggingSessionInfo);
            var         deliveryList = dService.GetAll();

            List <DeliveryItemData> list = new List <DeliveryItemData>();

            foreach (var paymentInfo in deliveryList)
            {
                DeliveryItemData info = new DeliveryItemData();
                info.deliveryId   = paymentInfo.DeliveryId;
                info.deliveryName = paymentInfo.DeliveryName;
                info.isAddress    = paymentInfo.IsDelete.ToString();

                //判断是否启用
                if (paymentInfo.DeliveryId == "1")
                {
                    CustomerDeliveryStrategyBLL deliveryStrategyBLL = new CustomerDeliveryStrategyBLL(loggingSessionInfo);
                    var deliveryStrategy = deliveryStrategyBLL.QueryByEntity(
                        new CustomerDeliveryStrategyEntity
                    {
                        CustomerId = loggingSessionInfo.ClientID,
                        DeliveryId = paymentInfo.DeliveryId
                    },
                        null
                        ).FirstOrDefault();

                    if (deliveryStrategy != null)
                    {
                        info.IsOpen = deliveryStrategy.Status == 1 ? true : false;
                    }
                }
                else if (paymentInfo.DeliveryId == "2" || paymentInfo.DeliveryId == "4")
                {
                    //查询提货配置信息
                    CustomerTakeDeliveryBLL takeDeliveryBLL = new CustomerTakeDeliveryBLL(loggingSessionInfo);
                    var takeDelivery = takeDeliveryBLL.QueryByEntity(
                        new CustomerTakeDeliveryEntity()
                    {
                        DeliveryId = paymentInfo.DeliveryId,
                        CustomerId = loggingSessionInfo.ClientID
                    }, null
                        ).FirstOrDefault();

                    if (takeDelivery != null)
                    {
                        info.IsOpen = takeDelivery.Status == 1 ? true : false;
                    }
                }
                list.Add(info);
            }

            var rd = new DeliveryListRD()
            {
                DeliveryList = list
            };

            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }