protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetOffActionRP> pRequest) { var rd = new EmptyResponseData(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var SetoffEventBll = new SetoffEventBLL(loggingSessionInfo); var IincentiveRuleBll = new IincentiveRuleBLL(loggingSessionInfo); var ObjectImagesBll = new ObjectImagesBLL(loggingSessionInfo); var SetoffToolsBll = new SetoffToolsBLL(loggingSessionInfo); var SetoffPosterBll = new SetoffPosterBLL(loggingSessionInfo); var CustomerBasicSettingBll = new CustomerBasicSettingBLL(loggingSessionInfo); // var pTran = SetoffEventBll.GetTran(); string _CustomerId = loggingSessionInfo.ClientID; if (para.SetOffActionList.Count > 0) { //using (pTran.Connection) //{ try { foreach (var item in para.SetOffActionList) { List <CustomerBasicSettingEntity> settingList = new List <CustomerBasicSettingEntity>(); //基础配置数据 //获取已发布的集客行动 var SetoffEvenResult = SetoffEventBll.QueryByEntity(new SetoffEventEntity() { SetoffType = item.SetoffType, Status = "10", CustomerId = loggingSessionInfo.ClientID }, null).ToList(); if (SetoffEvenResult.Count > 1) { throw new APIException("数据异常,只能有一种集客行动!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; if (SetoffEvenResult.Count > 0) { var Result = SetoffEvenResult.First(); //集客行动 var RuleData = IincentiveRuleBll.QueryByEntity(new IincentiveRuleEntity() { SetoffEventID = Result.SetoffEventID, CustomerId = loggingSessionInfo.ClientID }, null).FirstOrDefault(); if (RuleData == null) { throw new APIException("数据异常,找不到奖励规则!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; //判断奖励是否变动 if (item.SetoffRegAwardType != RuleData.SetoffRegAwardType || item.SetoffRegPrize != RuleData.SetoffRegPrize || item.SetoffOrderPer != RuleData.SetoffOrderPer || item.SetoffOrderTimers != RuleData.SetoffOrderTimers || item.IsEnabled != Convert.ToInt32(RuleData.Status)) { //原集客行动状态设置为失效 SetoffEventBll.SetFailStatus(item.SetoffType, loggingSessionInfo.ClientID); #region 规则变动,重新新建集客行动 //集客行动 //集客行动 var SetoffEvenData = new SetoffEventEntity(); //集客行动 SetoffEvenData.SetoffEventID = System.Guid.NewGuid(); SetoffEvenData.SetoffType = item.SetoffType; SetoffEvenData.Status = "10"; SetoffEvenData.CustomerId = _CustomerId; SetoffEventBll.Create(SetoffEvenData); // var IincentiveRuleData = new IincentiveRuleEntity(); //奖励规则 IincentiveRuleData.IincentiveRuleID = System.Guid.NewGuid(); IincentiveRuleData.SetoffEventID = SetoffEvenData.SetoffEventID; IincentiveRuleData.SetoffType = item.SetoffType; IincentiveRuleData.ApplyUnit = 0; IincentiveRuleData.SetoffRegAwardType = item.SetoffRegAwardType; IincentiveRuleData.SetoffRegPrize = item.SetoffRegPrize; IincentiveRuleData.SetoffOrderPer = item.SetoffOrderPer; IincentiveRuleData.SetoffOrderTimers = item.SetoffOrderTimers; IincentiveRuleData.Status = item.IsEnabled.ToString(); IincentiveRuleData.CustomerId = _CustomerId; IincentiveRuleBll.Create(IincentiveRuleData); // #region 新增集客海报、海报集客工具关系 foreach (var PosterItem in item.SetoffPosterList) { //图片表 var ObjectImageData = new ObjectImagesEntity(); ObjectImageData.ImageId = System.Guid.NewGuid().ToString("N"); ObjectImageData.ImageURL = PosterItem.ImageUrl; ObjectImageData.Description = "集客海报"; ObjectImageData.CustomerId = _CustomerId; ObjectImagesBll.Create(ObjectImageData); // //集客海报 var SetoffPosterData = new SetoffPosterEntity(); SetoffPosterData.SetoffPosterID = System.Guid.NewGuid(); SetoffPosterData.Name = PosterItem.Name; SetoffPosterData.Desc = "集客海报"; SetoffPosterData.ImageId = ObjectImageData.ImageId; SetoffPosterData.Status = "10"; SetoffPosterData.CustomerId = _CustomerId; SetoffPosterBll.Create(SetoffPosterData); //海报工具关系 var SetoffToolsData = new SetoffToolsEntity(); SetoffToolsData.SetoffToolID = System.Guid.NewGuid(); SetoffToolsData.SetoffEventID = SetoffEvenData.SetoffEventID; SetoffToolsData.ToolType = "SetoffPoster"; SetoffToolsData.ObjectId = SetoffPosterData.SetoffPosterID.ToString(); SetoffToolsData.Status = "10"; SetoffToolsData.CustomerId = _CustomerId; SetoffToolsBll.Create(SetoffToolsData); // } #endregion #region 新增集客工具关系 foreach (var ToolsItem in item.SetoffTools) { //判断是否添加重复集客工具 bool Flag = SetoffEventBll.IsToolsRepeat(SetoffEvenData.SetoffEventID.ToString(), ToolsItem.ObjectId); if (Flag) { throw new APIException("集客行动不能添加相同的集客工具!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; var SetoffToolsData = new SetoffToolsEntity(); SetoffToolsData.SetoffToolID = System.Guid.NewGuid(); SetoffToolsData.SetoffEventID = SetoffEvenData.SetoffEventID; SetoffToolsData.ToolType = ToolsItem.ToolType; SetoffToolsData.ObjectId = ToolsItem.ObjectId; SetoffToolsData.Status = "10"; SetoffToolsData.CustomerId = _CustomerId; SetoffToolsBll.Create(SetoffToolsData); // } #endregion #endregion #region 更新配置奖励系数 //集客销售订单分润配置 //var SettingData = CustomerBasicSettingBll.QueryByEntity(new CustomerBasicSettingEntity() { SettingCode = "GetVipUserOrderPer", CustomerID = CurrentUserInfo.ClientID, IsDelete = 0 }, null).FirstOrDefault(); //if (SettingData != null) //{ // SettingData.SettingValue = IincentiveRuleData.SetoffOrderPer.ToString(); // CustomerBasicSettingBll.Update(SettingData); //} if (IincentiveRuleData.SetoffType == 2) { settingList.Add(new CustomerBasicSettingEntity() { SettingCode = "GetVipUserOrderPer", SettingValue = (IincentiveRuleData.SetoffOrderPer ?? 0).ToString() }); } if (IincentiveRuleData.SetoffRegAwardType == 2) { settingList.Add(new CustomerBasicSettingEntity() { SettingCode = "InvitePartnersPoints", SettingValue = (IincentiveRuleData.SetoffRegPrize ?? 0).ToString() }); } CustomerBasicSettingBll.SaveCustomerBasicInfo(loggingSessionInfo.ClientID, settingList); //集客注册奖励配置 #endregion } else { #region 新增集客海报、海报集客工具关系 foreach (var PosterItem in item.SetoffPosterList) { //图片表 var ObjectImageData = new ObjectImagesEntity(); ObjectImageData.ImageId = System.Guid.NewGuid().ToString("N"); ObjectImageData.ImageURL = PosterItem.ImageUrl; ObjectImageData.Description = "集客海报"; ObjectImageData.CustomerId = _CustomerId; ObjectImagesBll.Create(ObjectImageData); // //集客海报 var SetoffPosterData = new SetoffPosterEntity(); SetoffPosterData.SetoffPosterID = System.Guid.NewGuid(); SetoffPosterData.Name = PosterItem.Name; SetoffPosterData.Desc = "集客海报"; SetoffPosterData.ImageId = ObjectImageData.ImageId; SetoffPosterData.Status = "10"; SetoffPosterData.CustomerId = _CustomerId; SetoffPosterBll.Create(SetoffPosterData); //海报工具关系 var SetoffToolsData = new SetoffToolsEntity(); SetoffToolsData.SetoffToolID = System.Guid.NewGuid(); SetoffToolsData.SetoffEventID = Result.SetoffEventID; SetoffToolsData.ToolType = "SetoffPoster"; SetoffToolsData.ObjectId = SetoffPosterData.SetoffPosterID.ToString(); SetoffToolsData.Status = "10"; SetoffToolsData.CustomerId = _CustomerId; SetoffToolsBll.Create(SetoffToolsData); // } #endregion #region 新增集客工具关系 foreach (var ToolsItem in item.SetoffTools) { // if (Result == null) { throw new APIException("数据异常,未找到集客行动!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; //判断是否添加重复集客工具 bool Flag = SetoffEventBll.IsToolsRepeat(Result.SetoffEventID.ToString(), ToolsItem.ObjectId); if (Flag) { throw new APIException("集客行动不能添加相同的集客工具!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; var SetoffToolsData = new SetoffToolsEntity(); SetoffToolsData.SetoffToolID = System.Guid.NewGuid(); SetoffToolsData.SetoffEventID = Result.SetoffEventID; SetoffToolsData.ToolType = ToolsItem.ToolType; SetoffToolsData.ObjectId = ToolsItem.ObjectId; SetoffToolsData.Status = "10"; SetoffToolsData.CustomerId = _CustomerId; SetoffToolsBll.Create(SetoffToolsData); // } #endregion } } else { //原集客行动状态设置为失效 SetoffEventBll.SetFailStatus(item.SetoffType, loggingSessionInfo.ClientID); #region 新建集客行动 //集客行动 var SetoffEvenData = new SetoffEventEntity(); //集客行动 SetoffEvenData.SetoffEventID = System.Guid.NewGuid(); SetoffEvenData.SetoffType = item.SetoffType; SetoffEvenData.Status = "10"; SetoffEvenData.CustomerId = _CustomerId; SetoffEventBll.Create(SetoffEvenData); // var IincentiveRuleData = new IincentiveRuleEntity(); //奖励规则 IincentiveRuleData.IincentiveRuleID = System.Guid.NewGuid(); IincentiveRuleData.SetoffEventID = SetoffEvenData.SetoffEventID; IincentiveRuleData.SetoffType = item.SetoffType; IincentiveRuleData.ApplyUnit = 0; IincentiveRuleData.SetoffRegAwardType = item.SetoffRegAwardType; IincentiveRuleData.SetoffRegPrize = item.SetoffRegPrize; IincentiveRuleData.SetoffOrderPer = item.SetoffOrderPer; IincentiveRuleData.SetoffOrderTimers = item.SetoffOrderTimers; IincentiveRuleData.Status = item.IsEnabled.ToString(); IincentiveRuleData.CustomerId = _CustomerId; IincentiveRuleBll.Create(IincentiveRuleData); // #region 新增集客海报、海报集客工具关系 foreach (var PosterItem in item.SetoffPosterList) { //图片表 var ObjectImageData = new ObjectImagesEntity(); ObjectImageData.ImageId = System.Guid.NewGuid().ToString("N"); ObjectImageData.ImageURL = PosterItem.ImageUrl; ObjectImageData.Description = "集客海报"; ObjectImageData.CustomerId = _CustomerId; ObjectImagesBll.Create(ObjectImageData); // //集客海报 var SetoffPosterData = new SetoffPosterEntity(); SetoffPosterData.SetoffPosterID = System.Guid.NewGuid(); SetoffPosterData.Name = PosterItem.Name; SetoffPosterData.Desc = "集客海报"; SetoffPosterData.ImageId = ObjectImageData.ImageId; SetoffPosterData.Status = "10"; SetoffPosterData.CustomerId = _CustomerId; SetoffPosterBll.Create(SetoffPosterData); //海报工具关系 var SetoffToolsData = new SetoffToolsEntity(); SetoffToolsData.SetoffToolID = System.Guid.NewGuid(); SetoffToolsData.SetoffEventID = SetoffEvenData.SetoffEventID; SetoffToolsData.ToolType = "SetoffPoster"; SetoffToolsData.ObjectId = SetoffPosterData.SetoffPosterID.ToString(); SetoffToolsData.Status = "10"; SetoffToolsData.CustomerId = _CustomerId; SetoffToolsBll.Create(SetoffToolsData); // } #endregion #region 新增集客工具关系 foreach (var ToolsItem in item.SetoffTools) { //判断是否添加重复集客工具 bool Flag = SetoffEventBll.IsToolsRepeat(SetoffEvenData.SetoffEventID.ToString(), ToolsItem.ObjectId); if (Flag) { throw new APIException("集客行动不能添加相同的集客工具!") { ErrorCode = ERROR_CODES.INVALID_BUSINESS } } ; var SetoffToolsData = new SetoffToolsEntity(); SetoffToolsData.SetoffToolID = System.Guid.NewGuid(); SetoffToolsData.SetoffEventID = SetoffEvenData.SetoffEventID; SetoffToolsData.ToolType = ToolsItem.ToolType; SetoffToolsData.ObjectId = ToolsItem.ObjectId; SetoffToolsData.Status = "10"; SetoffToolsData.CustomerId = _CustomerId; SetoffToolsBll.Create(SetoffToolsData); // } #endregion #endregion #region 更新配置奖励系数 if (IincentiveRuleData.SetoffType == 2) { //同步到原CustomerBasicSetting集客销售订单分润配置 //var SettingData = CustomerBasicSettingBll.QueryByEntity(new CustomerBasicSettingEntity() { SettingCode = "GetVipUserOrderPer", CustomerID = CurrentUserInfo.ClientID, IsDelete = 0 }, null).FirstOrDefault(); //if (SettingData != null) //{ // SettingData.SettingValue = (IincentiveRuleData.SetoffOrderPer ?? 0).ToString(); // CustomerBasicSettingBll.Update(SettingData); //} settingList.Add(new CustomerBasicSettingEntity() { SettingCode = "GetVipUserOrderPer", SettingValue = (IincentiveRuleData.SetoffOrderPer ?? 0).ToString() }); } if (IincentiveRuleData.SetoffRegAwardType == 2) { //同步到原CustomerBasicSetting集客销售订单分润配置 //var SettingData = CustomerBasicSettingBll.QueryByEntity(new CustomerBasicSettingEntity() { SettingCode = "InvitePartnersPoints", CustomerID = CurrentUserInfo.ClientID, IsDelete = 0 }, null).FirstOrDefault(); //if (SettingData != null) //{ // SettingData.SettingValue = (IincentiveRuleData.SetoffRegPrize ?? 0).ToString(); // CustomerBasicSettingBll.Update(SettingData); //} settingList.Add(new CustomerBasicSettingEntity() { SettingCode = "InvitePartnersPoints", SettingValue = (IincentiveRuleData.SetoffRegPrize ?? 0).ToString() }); } CustomerBasicSettingBll.SaveCustomerBasicInfo(loggingSessionInfo.ClientID, settingList); #endregion } } // //pTran.Commit(); } catch (APIException ex) { //pTran.Rollback(); throw ex; } //} } return(rd); }
protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetRewardsSettingRP> pRequest) { var rd = new EmptyResponseData(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var customerBasicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo); ResponseData res = new ResponseData(); List <CustomerBasicSettingEntity> list = new List <CustomerBasicSettingEntity>(); if (para.IntegralAmountPer == 0 || para.IntegralAmountPer == null) //控制积分是否能被使用 { para.EnableIntegral = 0; } else { para.EnableIntegral = 1; } if (!string.IsNullOrEmpty(para.RewardsType.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "RewardsType", SettingValue = para.RewardsType.ToString() }); } if (!string.IsNullOrEmpty(para.EnableIntegral.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "EnableIntegral", SettingValue = para.EnableIntegral.ToString() }); } if (!string.IsNullOrEmpty(para.EnableRewardCash.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "EnableRewardCash", SettingValue = para.EnableRewardCash.ToString() }); } if (!string.IsNullOrEmpty(para.RewardPointsPer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "RewardPointsPer", SettingValue = para.RewardPointsPer.ToString() }); } if (!string.IsNullOrEmpty(para.IntegralAmountPer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "IntegralAmountPer", SettingValue = para.IntegralAmountPer.ToString() }); } if (!string.IsNullOrEmpty(para.RewardCashPer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "RewardCashPer", SettingValue = para.RewardCashPer.ToString() }); } if (!string.IsNullOrEmpty(para.PointsRedeemUpLimit.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "PointsRedeemUpLimit", SettingValue = para.PointsRedeemUpLimit.ToString() }); } if (!string.IsNullOrEmpty(para.CashRedeemUpLimit.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "CashRedeemUpLimit", SettingValue = para.CashRedeemUpLimit.ToString() }); } if (!string.IsNullOrEmpty(para.PointsRedeemLowestLimit.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "PointsRedeemLowestLimit", SettingValue = para.PointsRedeemLowestLimit.ToString() }); } if (!string.IsNullOrEmpty(para.CashRedeemLowestLimit.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "CashRedeemLowestLimit", SettingValue = para.CashRedeemLowestLimit.ToString() }); } if (!string.IsNullOrEmpty(para.PointsOrderUpLimit.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "PointsOrderUpLimit", SettingValue = para.PointsOrderUpLimit.ToString() }); } if (!string.IsNullOrEmpty(para.CashOrderUpLimit.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "CashOrderUpLimit", SettingValue = para.CashOrderUpLimit.ToString() }); } if (!string.IsNullOrEmpty(para.PointsValidPeriod.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "PointsValidPeriod", SettingValue = para.PointsValidPeriod.ToString() }); } if (!string.IsNullOrEmpty(para.CashValidPeriod.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "CashValidPeriod", SettingValue = para.CashValidPeriod.ToString() }); } int i = customerBasicSettingBLL.SaveCustomerBasicInfo(loggingSessionInfo.ClientID, list); return(rd); }
/// <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())); }
protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetBusinessBasisConfigRP> pRequest) { var rd = new EmptyResponseData(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var customerBasicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo); //ap库配置 //var APloggingSessionInfo = Default.GetBSLoggingSession(loggingSessionInfo.ClientID, "1"); //APloggingSessionInfo.CurrentLoggingManager.Connection_String = ConfigurationManager.AppSettings["Conn_ap"]; //var t_customerBLL = new t_customerBLL(APloggingSessionInfo); #region 基础配置集合赋值 var list = new List <CustomerBasicSettingEntity>(); if (!string.IsNullOrWhiteSpace(para.CustomerShortName)) { //var APCustomerData = t_customerBLL.GetByID(APloggingSessionInfo.ClientID); //if (APCustomerData != null) //{ // APCustomerData.customer_name = para.customer_name; // t_customerBLL.Update(APCustomerData); //} list.Add(new CustomerBasicSettingEntity() {//商户简称 SettingCode = "CustomerShortName", SettingValue = para.CustomerShortName }); } if (!string.IsNullOrWhiteSpace(para.WebLogo)) { list.Add(new CustomerBasicSettingEntity() {//商户Logo //SettingCode = "BusinessLogo", SettingCode = "WebLogo", SettingValue = para.WebLogo }); } if (!string.IsNullOrWhiteSpace(para.CustomerPhone)) { list.Add(new CustomerBasicSettingEntity() {//客服电话 SettingCode = "CustomerPhone", SettingValue = para.CustomerPhone }); } if (!string.IsNullOrWhiteSpace(para.ForwardingMessageTitle)) { list.Add(new CustomerBasicSettingEntity() {//分享标题 //SettingCode = "ShareTitle", SettingCode = "ForwardingMessageTitle", SettingValue = para.ForwardingMessageTitle }); } if (!string.IsNullOrWhiteSpace(para.ForwardingMessageLogo)) { list.Add(new CustomerBasicSettingEntity() {//分享图片 //SettingCode = "ShareImageUrl", SettingCode = "ForwardingMessageLogo", SettingValue = para.ForwardingMessageLogo }); } if (!string.IsNullOrWhiteSpace(para.ForwardingMessageSummary)) { list.Add(new CustomerBasicSettingEntity() {//分享摘要内容 //SettingCode = "ShareContent", SettingCode = "ForwardingMessageSummary", SettingValue = para.ForwardingMessageSummary }); } if (!string.IsNullOrWhiteSpace(para.GuideLinkUrl)) { list.Add(new CustomerBasicSettingEntity() {//引导链接 SettingCode = "GuideLinkUrl", SettingValue = para.GuideLinkUrl }); } if (!string.IsNullOrWhiteSpace(para.GuideQRCode)) { list.Add(new CustomerBasicSettingEntity() {//引导二维码 SettingCode = "GuideQRCode", SettingValue = para.GuideQRCode }); } if (!string.IsNullOrWhiteSpace(para.CustomerGreeting)) { list.Add(new CustomerBasicSettingEntity() {//客服欢迎语 SettingCode = "CustomerGreeting", SettingValue = para.CustomerGreeting }); } else { list.Add(new CustomerBasicSettingEntity() {//客服欢迎语 SettingCode = "CustomerGreeting", SettingValue = "感谢您关注" + para.CustomerShortName + "!您的支持是我们无限的动力~", }); } #endregion if (list.Count > 0) { customerBasicSettingBLL.SaveCustomerBasicInfo(loggingSessionInfo.ClientID, list); } //发布到js文件里 EmptyRequest commonRequest = new EmptyRequest(); commonRequest.Parameters = new EmptyRequestParameter(); commonRequest.UserID = ""; commonRequest.CustomerID = CurrentUserInfo.ClientID; commonRequest.OpenID = ""; commonRequest.Token = Guid.NewGuid().ToString(); commonRequest.ChannelId = ""; commonRequest.Locale = "1"; //发布 var url = ConfigurationManager.AppSettings["interfacehost"] + "/ApplicationInterface/Gateway.ashx"; //正式 //var url = "http://121.199.42.125:5012/Gateway.ashx"; //测试 if (string.IsNullOrEmpty(url)) { throw new Exception("未配置平台接口URL:interfacehost"); } url += "?type=Product&action=WX.SysPage.CreateCustomerConfig"; var postContent = string.Format("req={0}", commonRequest.ToJSON()); var strAldRsp = HttpWebClient.DoHttpRequest(url, postContent); var aldRsp = strAldRsp.DeserializeJSONTo <CreateCustomerConfigReponse>(); if (aldRsp == null || aldRsp.ResultCode != 0 || !aldRsp.IsSuccess) { throw new Exception("发布配置到文件失败"); } return(rd); }
protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetSalesSettingRP> pRequest) { var rd = new EmptyResponseData(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var customerBasicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo); var setoffEventBLL = new SetoffEventBLL(loggingSessionInfo); //集客行动业务层 var iincentiveRuleBLL = new IincentiveRuleBLL(loggingSessionInfo); //集客奖励业务层 ResponseData res = new ResponseData(); List <CustomerBasicSettingEntity> list = new List <CustomerBasicSettingEntity>(); //获取集客行动信息 var setoffEventList = setoffEventBLL.QueryByEntity(new SetoffEventEntity() { CustomerId = loggingSessionInfo.ClientID, Status = "10" }, null); SetoffEventEntity setoffEventUser = setoffEventList.Where(t => t.SetoffType == 2).FirstOrDefault(); //员工集客活动设置 SetoffEventEntity setoffEventVip = setoffEventList.Where(t => t.SetoffType == 1).FirstOrDefault(); //会员集客活动设置 var iincentiveRuleList = iincentiveRuleBLL.QueryByEntity(new IincentiveRuleEntity() { CustomerId = loggingSessionInfo.ClientID, Status = "10" }, null); IincentiveRuleEntity iincentiveRuleUser = null; //员工奖励 IincentiveRuleEntity iincentiveRuleVip = null; //会员奖励 //获取员工奖励规则 if (setoffEventUser != null) { iincentiveRuleUser = iincentiveRuleList.Where(t => t.SetoffEventID == setoffEventUser.SetoffEventID && t.SetoffType == 2).FirstOrDefault(); } //获取会员奖励规则 if (setoffEventVip != null) { iincentiveRuleVip = iincentiveRuleList.Where(t => t.SetoffEventID == setoffEventVip.SetoffEventID && t.SetoffType == 1).FirstOrDefault(); } if (!string.IsNullOrEmpty(para.SocialSalesType.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "SocialSalesType", SettingValue = para.SocialSalesType.ToString() }); } if (!string.IsNullOrEmpty(para.EnableEmployeeSales.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "EnableEmployeeSales", SettingValue = para.EnableEmployeeSales.ToString() }); } if (!string.IsNullOrEmpty(para.EDistributionPricePer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "EDistributionPricePer", SettingValue = para.EDistributionPricePer.ToString() }); } if (!string.IsNullOrEmpty(para.EOrderCommissionPer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "EOrderCommissionPer", SettingValue = para.EOrderCommissionPer.ToString() }); } if (!string.IsNullOrEmpty(para.EnableVipSales.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "EnableVipSales", SettingValue = para.EnableVipSales.ToString() }); } if (!string.IsNullOrEmpty(para.VDistributionPricePer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "VDistributionPricePer", SettingValue = para.VDistributionPricePer.ToString() }); } if (!string.IsNullOrEmpty(para.VOrderCommissionPer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "VOrderCommissionPer", SettingValue = para.VOrderCommissionPer.ToString() }); } if (!string.IsNullOrEmpty(para.GetVipUserOrderPer.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "GetVipUserOrderPer", SettingValue = para.GetVipUserOrderPer.ToString() }); //同步到集客行动奖励设置(集客销售提成) if (iincentiveRuleUser != null) { iincentiveRuleUser.SetoffOrderPer = Convert.ToDecimal(para.GetVipUserOrderPer); iincentiveRuleBLL.Update(iincentiveRuleUser); } } if (!string.IsNullOrEmpty(para.InvitePartnersPoints.ToString())) { list.Add(new CustomerBasicSettingEntity() { SettingCode = "InvitePartnersPoints", SettingValue = para.InvitePartnersPoints.ToString() }); //同步到集客行动奖励设置(分享获得积分) if (iincentiveRuleVip != null) { iincentiveRuleVip.SetoffRegPrize = Convert.ToDecimal(para.InvitePartnersPoints); iincentiveRuleBLL.Update(iincentiveRuleVip); } } int i = customerBasicSettingBLL.SaveCustomerBasicInfo(loggingSessionInfo.ClientID, list); return(rd); }