コード例 #1
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(CustomerDeliveryStrategyEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
コード例 #2
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(CustomerDeliveryStrategyEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
コード例 #3
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <CustomerDeliveryStrategyEntity> PagedQueryByEntity(CustomerDeliveryStrategyEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
コード例 #4
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public CustomerDeliveryStrategyEntity[] QueryByEntity(CustomerDeliveryStrategyEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
コード例 #5
0
        /// <summary>
        ///保存送货到家配置信息
        /// </summary>
        /// <param name="DeliveryStrategyEntity"></param>
        /// <param name="BasicSettingEntity"></param>
        /// add by donal 2014-10-22 13:29:07
        public void SaveDeliveryStrategyAndBasicSetting(CustomerDeliveryStrategyEntity DeliveryStrategyEntity, CustomerBasicSettingEntity BasicSettingEntity, LoggingSessionInfo loggingSessionInfo, string deliveryId)
        {
            TransactionHelper tranHelper = new TransactionHelper(loggingSessionInfo);
            IDbTransaction    tran       = tranHelper.CreateTransaction();

            CustomerBasicSettingBLL basicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo);

            #region  除信息

            //此商户下送货到家信息
            CustomerDeliveryStrategyEntity[] DeliveryStrategyList = QueryByEntity(
                new CustomerDeliveryStrategyEntity
            {
                CustomerId = loggingSessionInfo.ClientID,
                DeliveryId = DeliveryStrategyEntity.DeliveryId
            },
                null
                );

            //此商户下基数设置(描述)信息
            CustomerBasicSettingEntity[] BasicSettingList = basicSettingBLL.QueryByEntity(new CustomerBasicSettingEntity
            {
                SettingCode = "DeliveryStrategy",
                CustomerID  = loggingSessionInfo.ClientID
            },
                                                                                          null
                                                                                          );

            //除本次保存数据的此商户下送货到家信息
            CustomerDeliveryStrategyEntity[] DeliveryStrategyList_d = DeliveryStrategyList.Where(m => m.Id != DeliveryStrategyEntity.Id).ToArray();
            //除本次保存数据的此商户下基数设置(描述)信息
            CustomerBasicSettingEntity[] BasicSettingList_d = BasicSettingList.Where(m => m.SettingID != BasicSettingEntity.SettingID).ToArray();

            if (DeliveryStrategyList_d != null && DeliveryStrategyList_d.Count() > 0)
            {
                Delete(DeliveryStrategyList_d, tran);
            }
            if (BasicSettingList_d != null && BasicSettingList_d.Count() > 0)
            {
                basicSettingBLL.Delete(BasicSettingList_d, tran);
            }
            #endregion

            #region 保存

            if (DeliveryStrategyEntity.Id == null || string.IsNullOrWhiteSpace(DeliveryStrategyEntity.Id.ToString()))
            {
                DeliveryStrategyEntity.Id = Guid.NewGuid();
                Create(DeliveryStrategyEntity, tran);
            }
            else
            {
                Update(DeliveryStrategyEntity, tran);
            }

            if (BasicSettingEntity.SettingID == null || string.IsNullOrWhiteSpace(BasicSettingEntity.SettingID.ToString()))
            {
                BasicSettingEntity.SettingID = Guid.NewGuid();
                basicSettingBLL.Create(BasicSettingEntity, tran);
            }
            else
            {
                basicSettingBLL.Update(BasicSettingEntity, tran);
            }

            //修改配送方式状态
            DeliveryBLL deliveryBll = new DeliveryBLL(loggingSessionInfo);
            deliveryBll.Update(
                new DeliveryEntity()
            {
                DeliveryId = deliveryId,
                Status     = DeliveryStrategyEntity.Status
            }
                , tran
                );
            #endregion
            tran.Commit();
        }
コード例 #6
0
        /// <summary>
        /// 保存客户信息
        /// </summary>
        /// <param name="rParams"></param>
        /// <returns></returns>
        public string SaveustomerBasicrInfo(NameValueCollection rParams)
        {
            SttingCode   entity  = Request("form").DeserializeJSONTo <SttingCode>();
            SttingCode   entity1 = Request("form1").DeserializeJSONTo <SttingCode>();
            SttingCode   entity2 = Request("form2").DeserializeJSONTo <SttingCode>();
            SttingCode   entity3 = Request("form3").DeserializeJSONTo <SttingCode>();
            SttingCode   entity4 = Request("form4").DeserializeJSONTo <SttingCode>();
            var          customerBasicSettingBLL = new CustomerBasicSettingBLL(this.CurrentUserInfo);
            ResponseData res = new ResponseData();
            List <CustomerBasicSettingEntity> list = new List <CustomerBasicSettingEntity>();

            #region
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "WebLogo",
                SettingValue = rParams["imageurl"].ToString()
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "CustomerType",
                SettingValue = entity.customerType
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "AboutUs",
                SettingValue = ImageHandler(Request("aboutUs"))
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "BrandStory",
                SettingValue = ImageHandler(Request("brandStory"))
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "BrandRelated",
                SettingValue = ImageHandler(Request("brandRelated"))
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "IntegralAmountPer",
                SettingValue = entity.IntegralAmountPer
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "SMSSign",
                SettingValue = entity.SMSSign
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "ForwardingMessageLogo",
                SettingValue = rParams["forwardingMessageLogourl"].ToString()
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "ForwardingMessageTitle",
                SettingValue = entity.ForwardingMessageTitle
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "ForwardingMessageSummary",
                SettingValue = entity.ForwardingMessageSummary
            });

            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "WhatCommonPoints",
                SettingValue = ImageHandler(Request("whatCommonPoints"))
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "GetPoints",
                SettingValue = ImageHandler(Request("getPoints"))
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "SetSalesPoints",
                SettingValue = ImageHandler(Request("setSalesPoints"))
            });

            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "VipCardLogo",
                SettingValue = rParams["imagecfurl"].ToString()
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "CustomerMobile",
                SettingValue = entity1.CustomerMobile
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "MemberBenefits",
                SettingValue = ImageHandler(Request("memberBenefits"))
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "RangeAccessoriesStores",
                SettingValue = entity2.RangeAccessoriesStores
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "IsSearchAccessoriesStores",
                SettingValue = entity2.IsSearchAccessoriesStores
            });
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "IsAllAccessoriesStores",
                SettingValue = entity2.IsAllAccessoriesStores
            });
            if (true)
            {
            }
            if (IsAld() == "1")
            {
                list.Add(new CustomerBasicSettingEntity()
                {
                    SettingCode  = "AppLogo",
                    SettingValue = rParams["appLogo"]
                });
                list.Add(new CustomerBasicSettingEntity()
                {
                    SettingCode  = "AppTopBackground",
                    SettingValue = rParams["appTopBackground"]
                });
            }
            list.Add(new CustomerBasicSettingEntity()
            {
                SettingCode  = "DeliveryStrategy",
                SettingValue = entity3.DeliveryStrategy
            });

            //微信分享页面
            if (!string.IsNullOrWhiteSpace(entity4.ShareWeixinPage))
            {
                list.Add(new CustomerBasicSettingEntity()
                {
                    SettingCode  = "ShareWeixinPage",
                    SettingValue = entity4.ShareWeixinPage
                });
            }

            #endregion
            int i = customerBasicSettingBLL.SaveCustomerBasicInfo(this.CurrentUserInfo.ClientID, list);
            #region 配送费保存

            decimal AmountEnd      = 0;
            decimal DeliveryAmount = 0;

            decimal.TryParse(entity3.AmountEnd, out AmountEnd);
            decimal.TryParse(entity3.DeliveryAmount, out DeliveryAmount);

            if (AmountEnd != 0 && DeliveryAmount != 0)
            // 如果页面有配送费才做保存
            {
                var deliveryStrategyBll = new CustomerDeliveryStrategyBLL(this.CurrentUserInfo);
                //查询是否已设置
                var deliverStrategayList = deliveryStrategyBll.Query(new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "CustomerID", Value = this.CurrentUserInfo.ClientID
                    }
                }, null);

                if (deliverStrategayList.Count() > 0)//已设置执行修改
                {
                    deliverStrategayList[0].AmountEnd      = AmountEnd;
                    deliverStrategayList[0].DeliveryAmount = DeliveryAmount;
                    deliveryStrategyBll.Update(deliverStrategayList[0]);
                }
                else//未设置执行创建
                {
                    CustomerDeliveryStrategyEntity deliveryStrategyEntity = new CustomerDeliveryStrategyEntity()
                    {
                        AmountBegin    = 0,
                        AmountEnd      = AmountEnd,
                        CustomerId     = this.CurrentUserInfo.ClientID,
                        DeliveryAmount = DeliveryAmount,
                        Status         = 1,
                        DeliveryId     = "1"
                    };
                    deliveryStrategyBll.Create(deliveryStrategyEntity);
                }
            }

            #endregion
            if (i > 0)
            {
                res.msg     = "操作成功";
                res.success = true;
            }
            return(string.Format("{{\"ResponseData\":{0}}}", res.ToJSON()));
        }
コード例 #7
0
        /// <summary>
        /// 保存配送信息
        /// </summary>
        private string SaveDelivery(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <DeliveryInfoRp> >();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            if (string.IsNullOrWhiteSpace(rp.Parameters.DeliveryId) ||
                (rp.Parameters.DeliveryId != "1" && rp.Parameters.DeliveryId != "2" && rp.Parameters.DeliveryId != "4"))
            {
                throw new APIException("请求参数中缺少DeliveryId或值为空.")
                      {
                          ErrorCode = 121
                      };
            }

            if (loggingSessionInfo == null)
            {
                throw new APIException("请重新登录")
                      {
                          ErrorCode = 122
                      };
            }

            if (rp.Parameters.DeliveryId == "1")
            //保存送货到家信息
            {
                CustomerDeliveryStrategyBLL deliveryStrategyBLL = new CustomerDeliveryStrategyBLL(loggingSessionInfo);
                CustomerBasicSettingBLL     basicSettingBLL     = new CustomerBasicSettingBLL(loggingSessionInfo);

                //if (rp.Parameters.AmountEnd<=0)
                //{
                //    throw new APIException("请求参数中AmountEnd值为空,或者不正确") { ErrorCode = 123 };
                //}
                //if (rp.Parameters.DeliveryAmount<=0)
                //{
                //    throw new APIException("请求参数中DeliveryAmount值为空,或者不正确") { ErrorCode = 124 };
                //}
                if (rp.Parameters.Status != 0 && rp.Parameters.Status != 1)
                {
                    throw new APIException("请求参数中Status值为空,或者不正确")
                          {
                              ErrorCode = 125
                          };
                }
                if (string.IsNullOrWhiteSpace(rp.Parameters.Description))
                {
                    throw new APIException("请求参数中Description值为空,或者不正确")
                          {
                              ErrorCode = 126
                          };
                }

                //要保存的送货到家信息
                CustomerDeliveryStrategyEntity DeliveryStrategyEntity = new CustomerDeliveryStrategyEntity()
                {
                    CustomerId     = loggingSessionInfo.ClientID,
                    AmountBegin    = 0m,
                    AmountEnd      = rp.Parameters.AmountEnd,
                    DeliveryAmount = rp.Parameters.DeliveryAmount,
                    Status         = rp.Parameters.Status,
                    DeliveryId     = "1"
                };

                if (!string.IsNullOrWhiteSpace(rp.Parameters.DeliveryStrategyId))
                {
                    DeliveryStrategyEntity.Id = new Guid(rp.Parameters.DeliveryStrategyId);
                }

                //要保存的基数设置(描述)信息
                CustomerBasicSettingEntity BasicSettingEntity = new CustomerBasicSettingEntity()
                {
                    CustomerID   = loggingSessionInfo.ClientID,
                    SettingCode  = "DeliveryStrategy",
                    SettingValue = rp.Parameters.Description
                };

                if (!string.IsNullOrWhiteSpace(rp.Parameters.SettingId))
                {
                    BasicSettingEntity.SettingID = new Guid(rp.Parameters.SettingId);
                }

                deliveryStrategyBLL.SaveDeliveryStrategyAndBasicSetting(DeliveryStrategyEntity, BasicSettingEntity, loggingSessionInfo, rp.Parameters.DeliveryId);
            }

            if (rp.Parameters.DeliveryId == "2" || rp.Parameters.DeliveryId == "4")
            //保存到店提货信息
            {
                //if (rp.Parameters.StockUpPeriod<=0)
                //{
                //    throw new APIException("请求参数中StockUpPeriod值为空,或者不正确") { ErrorCode = 127 };
                //}

                //if (rp.Parameters.BeginWorkTime==null)
                //{
                //     throw new APIException("请求参数中BeginWorkTime值为空,或者不正确") { ErrorCode = 127 };
                //}

                //if (rp.Parameters.EndWorkTime==null)
                //{
                //    throw new APIException("请求参数中EndWorkTime值为空,或者不正确") { ErrorCode = 127 };
                //}

                //if (rp.Parameters.MaxDelivery <= 0)
                //{
                //    throw new APIException("请求参数中MaxDelivery值为空,或者不正确") { ErrorCode = 127 };
                //}

                //if (rp.Parameters.Status!=1&&rp.Parameters.Status!=0)
                //{
                //    throw new APIException("请求参数中Status值为空,或者不正确") { ErrorCode = 127 };
                //}

                CustomerTakeDeliveryEntity takeDeliveryEntity = new CustomerTakeDeliveryEntity()
                {
                    CustomerId    = loggingSessionInfo.ClientID,
                    StockUpPeriod = rp.Parameters.StockUpPeriod,
                    BeginWorkTime = rp.Parameters.BeginWorkTime,
                    EndWorkTime   = rp.Parameters.EndWorkTime,
                    MaxDelivery   = rp.Parameters.MaxDelivery,
                    Status        = rp.Parameters.Status,
                    DeliveryId    = rp.Parameters.DeliveryId
                };

                #region 配送时间段

                SysTimeQuantumBLL      sysTimeQuantumBll         = new SysTimeQuantumBLL(loggingSessionInfo);
                SysTimeQuantumEntity[] sysTimeQuantumEntityArray = sysTimeQuantumBll.QueryByEntity(new SysTimeQuantumEntity()
                {
                    CustomerID = loggingSessionInfo.ClientID
                }, null);

                if (rp.Parameters.QuantumList.Count != 0)
                {
                    for (int i = 0; i < sysTimeQuantumEntityArray.Length; i++)
                    {
                        if (i < rp.Parameters.QuantumList.Count)
                        {
                            sysTimeQuantumEntityArray[i].Quantum = rp.Parameters.QuantumList[i].Quantum;
                            sysTimeQuantumBll.Update(sysTimeQuantumEntityArray[i]);
                        }
                        else
                        {
                            sysTimeQuantumBll.Delete(sysTimeQuantumEntityArray[i]);
                        }
                    }
                    if (sysTimeQuantumEntityArray.Length < rp.Parameters.QuantumList.Count)
                    {
                        for (int i = sysTimeQuantumEntityArray.Length; i < rp.Parameters.QuantumList.Count; i++)
                        {
                            SysTimeQuantumEntity sysTimeQuantumEntity = new SysTimeQuantumEntity()
                            {
                                QuantumID  = Guid.NewGuid().ToString(),
                                Quantum    = rp.Parameters.QuantumList[i].Quantum,
                                Type       = 10,
                                CustomerID = loggingSessionInfo.ClientID,
                                DeliveryId = rp.Parameters.DeliveryId
                            };
                            sysTimeQuantumBll.Create(sysTimeQuantumEntity);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < sysTimeQuantumEntityArray.Length; i++)
                    {
                        sysTimeQuantumBll.Delete(sysTimeQuantumEntityArray[i]);
                    }
                }
                #endregion

                if (!string.IsNullOrWhiteSpace(rp.Parameters.TakeDeliveryId))
                {
                    takeDeliveryEntity.Id = new Guid(rp.Parameters.TakeDeliveryId);
                }

                //查询提货配置信息
                CustomerTakeDeliveryBLL takeDeliveryBLL = new CustomerTakeDeliveryBLL(loggingSessionInfo);
                takeDeliveryBLL.SaveCustomerTakeDelivery(takeDeliveryEntity, loggingSessionInfo, rp.Parameters.DeliveryId);
            }

            var rsp = new SuccessResponse <IAPIResponseData>(new EmptyResponseData());
            return(rsp.ToJSON());
        }