示例#1
0
        /// <summary>
        /// customerinfo赋值
        /// </summary>
        /// <returns></returns>
        private CustomerLoadInfo GetCustomerLoadInfo()
        {
            var customerBasicSettingBLL = new CustomerBasicSettingBLL(this.CurrentUserInfo);
            CustomerLoadInfo custome    = new CustomerLoadInfo()
            {
                customerID   = this.CurrentUserInfo.ClientID,
                customerName = this.CurrentUserInfo.ClientName
            };
            DataRow dr = customerBasicSettingBLL.GetCustomerInfo(CurrentUserInfo.ClientID).Tables[0].Rows[0];

            custome.customerCode = dr["customer_code"].ToString();

            //商户简称
            var ShortNameData = customerBasicSettingBLL.QueryByEntity(new CustomerBasicSettingEntity()
            {
                CustomerID = this.CurrentUserInfo.ClientID, SettingCode = "CustomerShortName"
            }, null).FirstOrDefault();

            if (ShortNameData == null)
            {
                custome.customerName = dr["customer_name"].ToString();
            }
            else
            {
                custome.customerName = ShortNameData.SettingValue;
            }
            //商户Logo
            var Data = customerBasicSettingBLL.QueryByEntity(new CustomerBasicSettingEntity()
            {
                CustomerID = this.CurrentUserInfo.ClientID, SettingCode = "WebLogo"
            }, null).FirstOrDefault();

            custome.BusinessLogo = Data == null ? "" : Data.SettingValue;
            return(custome);
        }
示例#2
0
        /// <summary>
        /// 种植/更新BasicSetting缓存
        /// </summary>
        /// <param name="strCustomerId"></param>
        /// <param name="basicSettingList"></param>
        public void SetBasicSetting(string strCustomerId)
        {
            try
            {
                LoggingSessionInfo _loggingSessionInfo   = new LoggingSessionInfo();
                LoggingManager     CurrentLoggingManager = new LoggingManager();
                var connection = GetCustomerConn(strCustomerId);

                _loggingSessionInfo.ClientID              = strCustomerId;
                CurrentLoggingManager.Connection_String   = connection;
                _loggingSessionInfo.CurrentLoggingManager = CurrentLoggingManager;

                CustomerBasicSettingBLL           bllBasicSetting  = new CustomerBasicSettingBLL(_loggingSessionInfo);
                List <CustomerBasicSettingEntity> listBasicSetting = bllBasicSetting.QueryByEntity(new CustomerBasicSettingEntity()
                {
                    CustomerID = strCustomerId, IsDelete = 0
                }, null).ToList();

                RedisOpenAPI.Instance.CCBasicSetting().SetBasicSetting(new CC_BasicSetting()
                {
                    CustomerId  = strCustomerId,
                    SettingList = listBasicSetting.Select(b => new Setting
                    {
                        SettingCode  = b.SettingCode,
                        SettingDesc  = b.SettingDesc,
                        SettingValue = b.SettingValue
                    }).ToList()
                });
            }
            catch (Exception ex)
            {
                throw new Exception("设置缓存失败!" + ex.Message);
            }
        }
        /// <summary>
        /// 获取优惠券码
        /// </summary>
        /// <param name="loggingSession"></param>
        /// <param name="strCustomerId"></param>
        /// <returns></returns>
        public string GetCouponNum(LoggingSessionInfo loggingSession, string strCustomerId)
        {
            string uperStr          = StringUtil.GetRandomUperStr(4);
            string strBackInt       = StringUtil.GetRandomStrInt(8);
            string strAllInt        = StringUtil.GetRandomStrInt(12);
            string strCouponNumRole = string.Empty;
            string strCouponCode    = string.Empty;

            //判断是否有特殊的优惠券编码
            BasicSetting.BasicSettingBLL bllBasicSetting = new BasicSetting.BasicSettingBLL();
            var basicSettingList = bllBasicSetting.GetBasicSetting(strCustomerId);

            if (basicSettingList.Count > 0)
            {
                var query = from q in basicSettingList.AsEnumerable()
                            where q.SettingCode.Contains("CouponNumRole")
                            select q;
                if (query.FirstOrDefault() != null)
                {
                    strCouponNumRole = query.FirstOrDefault().SettingValue;
                }
            }
            else
            {
                CustomerBasicSettingBLL bllBasic = new CustomerBasicSettingBLL(loggingSession);
                var entityBasic = bllBasic.QueryByEntity(new CustomerBasicSettingEntity()
                {
                    SettingCode = "CouponNumRole"
                }, null).SingleOrDefault();
                if (entityBasic != null)
                {
                    strCouponNumRole = entityBasic.SettingValue;
                }
            }
            if (!string.IsNullOrEmpty(strCouponNumRole) && strCouponNumRole == "1")//设置了“1”,则使用全是数字的优惠券编码规则
            {
                strCouponCode = strAllInt;
            }
            else
            {
                strCouponCode = uperStr + "-" + strBackInt;
            }
            return(strCouponCode);
        }
示例#4
0
        /// <summary>
        /// pageload
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string content = string.Empty;

            if (string.IsNullOrEmpty(Request["method"]))
            {
                //MenuList = DataLoader.LoadFrom<ClientMenuButtonEntity>(
                //    new SessionManager().CurrentUserLoginInfo.UserOPRight.Tables[0],
                //    new DirectPropertyNameMapping()).Where(c =>
                //        string.IsNullOrEmpty(c.ButtonText)).ToArray();

                //var loggingSessionInfo = this.Session["loggingSessionInfo"] as LoggingSessionInfo;
                var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
                if (loggingSessionInfo == null)
                {
                    this.Response.Redirect("~/GoSso.aspx");
                }
                else
                {
                    if (lblLoginUserName != null)
                    {
                        lblLoginUserName.InnerText = loggingSessionInfo.CurrentUser.User_Name;//因为ChildPage.Master的前台页面Inherits="JIT.CPOS.BS.Web.Framework.MasterPage.CPOS" 但是不含有 lblLoginUserName
                    }
                }
                AppSysService appSysService = new AppSysService(loggingSessionInfo);
                this.MenuList = appSysService.GetRoleMenusList(loggingSessionInfo,
                                                               loggingSessionInfo.CurrentUserRole.RoleId);//根据当前用户的角色,来取他拥有的页面

                var dbMenuIds = appSysService.GetMenuIds(Request.Url);
                if (dbMenuIds.Count == 0 && !string.IsNullOrWhiteSpace(Mid))
                {
                    dbMenuIds.Add(Mid);
                }
                foreach (var dbMenuId in dbMenuIds)
                {
                    string tempMid     = string.Empty;
                    string tempPMenuID = string.Empty;
                    string tempMMenuID = string.Empty;
                    if (!string.IsNullOrWhiteSpace(dbMenuId))
                    {
                        tempMid = dbMenuId;
                    }
                    //PMenuId
                    {
                        var currentMenu = MenuList.Where(p => p.Menu_Id == tempMid).SingleOrDefault();
                        if (currentMenu != null)
                        {
                            if (!string.IsNullOrWhiteSpace(currentMenu.Parent_Menu_Id))
                            {
                                tempPMenuID = currentMenu.Parent_Menu_Id;
                            }
                        }
                    }
                    //MMenuId
                    {
                        var currentMenu = MenuList.Where(p => p.Menu_Id == tempPMenuID).SingleOrDefault();
                        if (currentMenu != null)
                        {
                            if (!string.IsNullOrWhiteSpace(currentMenu.Parent_Menu_Id))
                            {
                                tempMMenuID = currentMenu.Parent_Menu_Id;
                            }
                        }
                    }
                    //防止多条menuId
                    if (!string.IsNullOrWhiteSpace(tempMMenuID))
                    {
                        Mid     = tempMid;
                        PMenuID = tempPMenuID;
                        MMenuID = tempMMenuID;
                        break;
                    }
                    else if (!string.IsNullOrWhiteSpace(tempPMenuID) && string.IsNullOrWhiteSpace(PMenuID))
                    {
                        Mid     = tempMid;
                        PMenuID = tempPMenuID;
                    }
                    else if (!string.IsNullOrWhiteSpace(tempMid) && string.IsNullOrWhiteSpace(Mid))
                    {
                        Mid = tempMid;
                    }
                }

                #region 旧代码
                //this.MenuList = appSysService.GetRoleMenusList(loggingSessionInfo,
                //    loggingSessionInfo.CurrentUserRole.RoleId);//根据当前用户的角色,来取他拥有的页面
                //MMenuID = Request.QueryString["MMenuID"] == null ? "" : Request.QueryString["MMenuID"].ToString();
                //PMenuID = Request.QueryString["PMenuID"] == null ? "" : Request.QueryString["PMenuID"].ToString();
                //if (PMenuID == "")
                //{
                //    var currentMenu = MenuList.Where(p => p.Menu_Id == Mid).SingleOrDefault();
                //    if (currentMenu != null)
                //    {
                //        PMenuID = currentMenu.Parent_Menu_Id;
                //    }



                //}
                //if (MMenuID == "")
                //{
                //    var currentMenu = MenuList.Where(p => p.Menu_Id == PMenuID).SingleOrDefault();
                //    if (currentMenu != null)
                //    {
                //        MMenuID = currentMenu.Parent_Menu_Id;
                //    }

                //}
                #endregion
                if (!IsPostBack)
                {
                    //Jermyn20140703 修改logo图片来源
                    CustomerBasicSettingBLL customerBSServer = new CustomerBasicSettingBLL(loggingSessionInfo);
                    var customerBSList = customerBSServer.QueryByEntity(new CustomerBasicSettingEntity
                    {
                        CustomerID    = loggingSessionInfo.CurrentUser.customer_id.Trim()
                        , SettingCode = "WebLogo"
                        , IsDelete    = 0
                    }, null);
                    if (customerBSList == null || customerBSList.Length == 0 || customerBSList[0] == null ||
                        customerBSList[0].SettingValue == null ||
                        customerBSList[0].SettingValue.Equals(""))
                    {
                        //Jermyn20131202 添加logo图片
                        PropService propServer = new PropService(loggingSessionInfo);
                        string      strLogo    = propServer.GetWebLogo();
                        if (strLogo == null || strLogo.Equals(""))
                        {
                        }
                        else
                        {
                            strWebLogo = strLogo;
                        }
                    }
                    else
                    {
                        strWebLogo = customerBSList[0].SettingValue;
                    }
                }
            }
            else
            {
                switch (Request["method"])
                {
                case "LogOut": content = LogOut(); break;

                case "KeepSession": content = ""; break;
                }
                Response.Write(content);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                //Response.End();
            }
        }
示例#5
0
        protected override GetConfigRD ProcessRequest(DTO.Base.APIRequest <GetConfigRP> pRequest)
        {
            var rd         = new GetConfigRD();
            var customerId = CurrentUserInfo.ClientID;
            var trrBll     = new T_RewardRecordBLL(CurrentUserInfo);//打赏记录
            var userBll    = new T_UserBLL(CurrentUserInfo);
            var cbsBll     = new CustomerBasicSettingBLL(CurrentUserInfo);
            var trcBll     = new T_RewardConfigBLL(CurrentUserInfo);
            var cbsEntity  = cbsBll.QueryByEntity(new CustomerBasicSettingEntity()
            {
                CustomerID = customerId
            }, null).FirstOrDefault();
            var trcEntitys = trcBll.QueryByEntity(new T_RewardConfigEntity()
            {
                CustomerId = customerId
            }, null);
            //获取员工
            var userInfo   = new T_UserEntity();
            var employeeId = pRequest.Parameters.EmployeeID;

            if (!string.IsNullOrEmpty(employeeId))
            {
                userInfo = userBll.QueryByEntity(new T_UserEntity()
                {
                    user_id = employeeId, customer_id = customerId
                }, null).FirstOrDefault();

                //员工头像
                var _ObjectImagesBLL = new ObjectImagesBLL(CurrentUserInfo);
                var userImg          = _ObjectImagesBLL.QueryByEntity(new ObjectImagesEntity()
                {
                    ObjectId = employeeId, CustomerId = customerId
                }, null).OrderByDescending(p => p.CreateTime).FirstOrDefault();

                //星级
                var oeBll  = new ObjectEvaluationBLL(CurrentUserInfo);
                var oeList = oeBll.QueryByEntity(new ObjectEvaluationEntity()
                {
                    ObjectID = employeeId, Type = 4, CustomerID = customerId
                }, null);
                var oeinfo = (from p in oeList.AsEnumerable()
                              group p by p.ObjectID into g
                              select new
                {
                    g.Key,
                    SumValue = g.Average(p => p.StarLevel)
                }).ToArray().FirstOrDefault();

                //打赏数据
                var rewardCount = trrBll.QueryByEntity(new T_RewardRecordEntity()
                {
                    RewardedOP = employeeId, PayStatus = 2, CustomerId = customerId
                }, null).Length;

                //员工信息
                rd.UserInfo = new List <UserInfo>();
                rd.UserInfo.Add(new UserInfo()
                {
                    UserName    = userInfo.user_name,
                    UserPhoto   = userImg != null ? userImg.ImageURL : string.Empty,
                    StarLevel   = oeinfo != null ? Convert.ToInt32(oeinfo.SumValue) : 0,
                    RewardCount = rewardCount
                });
            }

            //打赏类型
            if (cbsEntity != null)
            {
                switch (cbsEntity.SettingValue)
                {
                case "1":
                    rd.Type = 1;
                    break;

                case "2":
                    rd.Type = 2;
                    break;

                default:
                    rd.Type = 0;    //0或空(null)为两者
                    break;
                }
            }
            else
            {
                rd.Type = 0;//两者
            }

            //打赏金额列表
            rd.AmountList = new List <RewardAmountInfo>();
            foreach (var item in trcEntitys)
            {
                rd.AmountList.Add(new RewardAmountInfo()
                {
                    Amount = item.RewardAmount
                });
            }

            return(rd);
        }
示例#6
0
        protected override GetVipIntegralInfoListRD ProcessRequest(DTO.Base.APIRequest <GetVipIntegralInfoListRP> pRequest)
        {
            LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(pRequest.CustomerID, pRequest.UserID);
            SysVipCardTypeBLL  bll = new SysVipCardTypeBLL(loggingSessionInfo);
            VipCardRuleBLL     VipCardRuleService = new VipCardRuleBLL(loggingSessionInfo);
            var vipCardVipMappingBLL = new VipCardVipMappingBLL(loggingSessionInfo);
            var vipCardBLL           = new VipCardBLL(loggingSessionInfo);
            var vipCardTypeBLL       = new SysVipCardTypeBLL(loggingSessionInfo);
            var rd = new GetVipIntegralInfoListRD();

            string[] CustomerBaseSettingCode = new string[] { "IntegralAmountPer", "PointsRedeemLowestLimit", "PointsRedeemUpLimit", "PointsValidPeriod" };
            string[] CustomerBaseSettingDesc = new string[] { "积分抵扣比例", "账户积分累计满", "每单可使用积分上限", "积分有效期" };

            CustomerBasicSettingBLL CustomerBasicSettingService = new CustomerBasicSettingBLL(loggingSessionInfo);

            //循环获取积分信息
            for (int i = 0; i < CustomerBaseSettingCode.Length; i++)
            {
                var entity = CustomerBasicSettingService.QueryByEntity(new CustomerBasicSettingEntity()
                {
                    CustomerID = loggingSessionInfo.ClientID, IsDelete = 0, SettingCode = CustomerBaseSettingCode[i]
                }, null).FirstOrDefault();
                if (entity != null)
                {
                    rd.VipIntegralInfoList.Add(new VipIntegralInfo()
                    {
                        CustomerBaseSettingDesc = CustomerBaseSettingDesc[i], CustomerBaseSettingValue = entity.SettingValue
                    });
                }
                else
                {
                    rd.VipIntegralInfoList.Add(new VipIntegralInfo()
                    {
                        CustomerBaseSettingDesc = CustomerBaseSettingDesc[i], CustomerBaseSettingValue = "0"
                    });
                }
            }
            //获取会员 卡映射关系
            var vipCardMappingInfo = vipCardVipMappingBLL.QueryByEntity(new VipCardVipMappingEntity()
            {
                VIPID = pRequest.UserID, CustomerID = CurrentUserInfo.ClientID
            },
                                                                        new OrderBy[] { new OrderBy()
                                                                                        {
                                                                                            FieldName = "CreateTime", Direction = OrderByDirections.Desc
                                                                                        } }).FirstOrDefault();

            if (vipCardMappingInfo != null)
            {
                //获取卡信息
                var vipCardInfo = vipCardBLL.QueryByEntity(new VipCardEntity()
                {
                    VipCardID = vipCardMappingInfo.VipCardID, VipCardStatusId = 1
                }, null).FirstOrDefault();
                if (vipCardInfo != null)
                {
                    //获取会员卡信息
                    var vipCardTypeInfo = vipCardTypeBLL.QueryByEntity(new SysVipCardTypeEntity()
                    {
                        VipCardTypeID = vipCardInfo.VipCardTypeID
                    }, null).FirstOrDefault();
                    if (vipCardTypeInfo != null)
                    {
                        //获取卡升级规则信息
                        var cardrulemodel = VipCardRuleService.QueryByEntity(new VipCardRuleEntity()
                        {
                            VipCardTypeID = vipCardTypeInfo.VipCardTypeID
                        }, null).FirstOrDefault();
                        if (cardrulemodel != null)
                        {
                            if (cardrulemodel.PaidGivePoints > 0) //积分
                            {
                                rd.VipIntegralInfoList.Add(new VipIntegralInfo()
                                {
                                    CustomerBaseSettingDesc = "每消费" + Convert.ToInt32(cardrulemodel.PaidGivePoints) + "元返 1积分", CustomerBaseSettingValue = Convert.ToInt32(cardrulemodel.PaidGivePoints) + ""
                                });
                            }
                            if (cardrulemodel.PaidGivePercetPoints > 0) //积分比例
                            {
                                rd.VipIntegralInfoList.Add(new VipIntegralInfo()
                                {
                                    CustomerBaseSettingDesc = "消费返积分比例" + Convert.ToInt32(cardrulemodel.PaidGivePercetPoints) + "%", CustomerBaseSettingValue = Convert.ToInt32(cardrulemodel.PaidGivePercetPoints) + ""
                                });
                            }
                        }
                    }
                }
            }
            return(rd);
        }
示例#7
0
        protected override SetSignInRD ProcessRequest(DTO.Base.APIRequest <SetSignInRP> pRequest)
        {
            SetSignInRD rd = new SetSignInRD();

            string customerCode = pRequest.Parameters.CustomerCode;

            string phone = pRequest.Parameters.LoginName;

            string password = pRequest.Parameters.Password;

            if (string.IsNullOrEmpty(customerCode))
            {
                throw new APIException("客户代码不能为空")
                      {
                          ErrorCode = Error_CustomerCode_NotNull
                      };
            }

            WMenuBLL menuServer = new WMenuBLL(Default.GetAPLoggingSession(""));
            string   customerId = menuServer.GetCustomerIDByCustomerCode(customerCode);

            if (string.IsNullOrEmpty(customerId))
            {
                throw new APIException("客户代码对应的客户不存在")
                      {
                          ErrorCode = Error_CustomerCode_NotExist
                      };
            }
            var currentUserInfo = Default.GetBSLoggingSession(customerId, "1");

            VipBLL vipBll = new VipBLL(currentUserInfo);

            #region 判断用户是否存在
            if (!vipBll.JudgeUserExist(phone, customerId))
            {
                throw new APIException("用户名无效")
                      {
                          ErrorCode = Error_UserName_InValid
                      };
            }

            #endregion

            #region 判断密码是否正确
            if (!vipBll.JudgeUserPasswordExist(phone, customerId, password))
            {
                throw new APIException("登录密码错误")
                      {
                          ErrorCode = Error_Password_InValid
                      };
            }

            #endregion
            #region 判断是否有登录连锁掌柜App权限
            var  userRolesDs = vipBll.GetUserRoles(phone, customerId, password);
            bool flag        = false;
            foreach (DataRow row in userRolesDs.Tables[0].Rows)
            {
                if (row["Def_App_Code"].ToString().ToUpper() == "APP")
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                throw new APIException("该账号无权登录本系统")
                      {
                          ErrorCode = Error_Password_InValid
                      };
            }
            #endregion
            #region 判断该客服人员是否有客服或操作订单的权限
            //if (!vipBll.JudgeUserRoleExist(phone, customerId, password))
            //{
            //    throw new APIException("该账号无权登录本系统") { ErrorCode = Error_Password_InValid };
            //}
            #endregion

            #region 获取UserId
            var ds = vipBll.GetUserIdByUserNameAndPassword(phone, customerId, password);
            rd.UserId     = ds.Tables[0].Rows[0]["user_id"].ToString();
            rd.UserName   = ds.Tables[0].Rows[0]["user_name"].ToString();
            rd.Status     = int.Parse(ds.Tables[0].Rows[0]["user_status"].ToString());
            rd.CustomerId = customerId;
            var T_SuperRetailTraderbll  = new T_SuperRetailTraderBLL(currentUserInfo);
            var T_SuperRetailTraderInfo = T_SuperRetailTraderbll.QueryByEntity(new T_SuperRetailTraderEntity()
            {
                CustomerId = customerId, SuperRetailTraderFromId = rd.UserId, SuperRetailTraderFrom = "User"
            }, new OrderBy[] { new OrderBy()
                               {
                                   FieldName = "CreateTime", Direction = OrderByDirections.Desc
                               } }).FirstOrDefault();
            if (T_SuperRetailTraderInfo != null)
            {
                rd.SuperRetailTraderID = T_SuperRetailTraderInfo.SuperRetailTraderID.ToString();
            }
            #endregion
            //如果状态不等于1,就说明已经停用,
            if (rd.Status != 1)
            {
                throw new APIException("该员工已经被停用,请联系管理员")
                      {
                          ErrorCode = Error_Password_InValid
                      };
            }


            #region 获取角色列表
            var roleCodeDs = vipBll.GetRoleCodeByUserId(rd.UserId, customerId);

            var tmp = roleCodeDs.Tables[0].AsEnumerable().Select(t => new RoleCodeInfo()
            {
                RoleCode = t["role_code"].ToString()
            });

            #endregion
            rd.UnitId = vipBll.GetUnitByUserId(rd.UserId);//获取会集店
            TUnitBLL tUnitBLL = new TUnitBLL(currentUserInfo);
            if (!string.IsNullOrEmpty(rd.UnitId))
            {
                rd.UnitName = tUnitBLL.GetByID(rd.UnitId).UnitName;
            }
            else
            {
                rd.UnitName = "";
            }


            //app登陆用户权限 add by henry 2015-3-26
            var roleCodeList = vipBll.GetAppMenuByUserId(rd.UserId);


            //app登陆用户权限 add by henry 2015-3-26
            List <string> lst = new List <string>();
            if (roleCodeDs.Tables[0] != null && roleCodeDs.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow item in roleCodeDs.Tables[0].Rows)
                {
                    var menuList = new JIT.CPOS.BS.DataAccess.AppSysService(currentUserInfo).GetRoleMenus(currentUserInfo.ClientID, item["role_id"] + "");
                    if (menuList != null)
                    {
                        lst.AddRange(menuList.Select(m => m.Menu_Code).Distinct().ToList());
                    }
                }
            }

            rd.MenuCodeList = new List <Menu>();
            foreach (var item in lst.Distinct().ToList())
            {
                rd.MenuCodeList.Add(new Menu()
                {
                    MenuCode = item
                });
            }

            //if (roleCodeList != null)
            //{
            //    rd.MenuCodeList = DataTableToObject.ConvertToList<Menu>(roleCodeList.Tables[0]);
            //}

            rd.RoleCodeList = tmp.ToArray();
            rd.CustomerName = currentUserInfo.ClientName;


            //销售员头像
            ObjectImagesBLL    _ObjectImagesBLL = new ObjectImagesBLL(currentUserInfo);
            ObjectImagesEntity en = new ObjectImagesEntity();
            en.ObjectId = rd.UserId;//根据获取的用户ID
            List <ObjectImagesEntity> ImgList = _ObjectImagesBLL.QueryByEntity(en, null).OrderByDescending(p => p.CreateTime).ToList();
            if (ImgList != null && ImgList.Count != 0)
            {
                // string fileDNS = customerBasicSettingBll.GetSettingValueByCode("FileDNS"); ;//http://182.254.156.57:811
                rd.HeadImg = ImgList[0].ImageURL;
            }


            #region 获取appLogo
            //基础数据初始化
            CustomerBasicSettingBLL      customerBasicSettingBLL = new CustomerBasicSettingBLL(currentUserInfo);
            List <CustomerBasicCodeInfo> customerBasicCodeList   = new List <CustomerBasicCodeInfo>();
            //查询条件
            CustomerBasicSettingEntity customerBasicSettingEntity = new CustomerBasicSettingEntity()
            {
                CustomerID  = currentUserInfo.ClientID,
                SettingCode = "WebLogo"
            };
            //执行查询
            List <CustomerBasicSettingEntity> customerBasicSettingEntityList = customerBasicSettingBLL.QueryByEntity(customerBasicSettingEntity, null).ToList();

            foreach (var a in customerBasicSettingEntityList)
            {
                CustomerBasicCodeInfo customerBasicCodeInfo = new CustomerBasicCodeInfo();

                if (a.SettingCode.Equals("WebLogo"))
                {
                    customerBasicCodeInfo.WebLogo = a.SettingValue.ToString();
                }
                customerBasicCodeList.Add(customerBasicCodeInfo);
            }

            rd.CustomerBasicCodeList = customerBasicCodeList;


            #endregion
            return(rd);
        }
示例#8
0
        protected override GetSetoffToolsRD ProcessRequest(APIRequest <GetSetoffToolsRP> pRequest)
        {
            SetoffToolsBLL    setOffToolsBLL   = new SetoffToolsBLL(CurrentUserInfo);
            IincentiveRuleBLL incentiveRuleBLL = new IincentiveRuleBLL(CurrentUserInfo);
            var para = pRequest.Parameters;
            var setoffToolsEntity = new SetoffToolsEntity();

            if (para.ToolsType != null)
            {
                setoffToolsEntity.ToolType = para.ToolsType.ToString();
            }
            GetSetoffToolsRD setoffToolsRD = new GetSetoffToolsRD();
            var setoffEventBLL             = new SetoffEventBLL(CurrentUserInfo);
            //获取集客活动信息
            string NoticePlatType = string.Empty;

            if (string.IsNullOrEmpty(para.ApplicationType))
            {
                para.ApplicationType = "0";
            }
            else
            {
                switch (para.ApplicationType)
                {
                case "1":
                    NoticePlatType = "1";
                    break;

                case "2":
                    NoticePlatType = "2";
                    break;

                case "3":
                    NoticePlatType = "2";    //传3需要进行平台类型处理 等于3时获取员工集客行动平台
                    break;

                case "4":
                    NoticePlatType = "3";    //传4需要进行平台类型处理 等于4时获取超级分销商推广行动平台
                    break;
                }
            }
            var setOffEventInfo = setoffEventBLL.QueryByEntity(new SetoffEventEntity()
            {
                Status = "10", IsDelete = 0, SetoffType = Convert.ToInt32(NoticePlatType), CustomerId = CurrentUserInfo.CurrentUser.customer_id
            }, null);
            int     SetoffToolsTotalCount = 0;
            DataSet SetoffToolsList       = null;

            if (setOffEventInfo.Length != 0)
            {
                //获取集客活动工具数量
                SetoffToolsTotalCount = setOffToolsBLL.GeSetoffToolsListCount(setoffToolsEntity, para.ApplicationType, para.BeShareVipID, setOffEventInfo[0].SetoffEventID.ToString());
                //获取集客活动工具列表
                SetoffToolsList = setOffToolsBLL.GetSetoffToolsList(setoffToolsEntity, para.ApplicationType, para.BeShareVipID, para.PageIndex, para.PageSize, setOffEventInfo[0].SetoffEventID.ToString());
            }

            //获取集客奖励信息
            var IncentiveRule = incentiveRuleBLL.GetIncentiveRule(para.ApplicationType);

            setoffToolsRD.TotalCount = SetoffToolsTotalCount;
            int remainder = 0;

            if (para.PageSize == 0)
            {
                para.PageSize = 10;
            }
            setoffToolsRD.TotalPageCount = Math.DivRem(SetoffToolsTotalCount, para.PageSize, out remainder);
            if (remainder > 0)
            {
                setoffToolsRD.TotalPageCount++;
            }
            string strHost = ConfigurationManager.AppSettings["website_url"].Trim();

            if (SetoffToolsList != null && SetoffToolsList.Tables[0].Rows.Count > 0)
            {
                //为优惠券和海报添加图片路径
                SetoffToolsList.Tables[0].Columns.Add("ImageUrl", typeof(string));
                var CustomerBasicSettingBLL = new CustomerBasicSettingBLL(CurrentUserInfo);
                var CustomerBasicInfo       = CustomerBasicSettingBLL.QueryByEntity(new CustomerBasicSettingEntity()
                {
                    CustomerID = CurrentUserInfo.CurrentUser.customer_id, SettingCode = "SetoffPosterWeChatDefaultPhoto"
                }, null).FirstOrDefault();
                var    setOffPosterBLL  = new SetoffPosterBLL(CurrentUserInfo);
                var    ObjectImagesBLL  = new ObjectImagesBLL(CurrentUserInfo);
                var    T_CTW_LEventBLL  = new T_CTW_LEventBLL(CurrentUserInfo);
                var    wMaterialTextBLL = new WMaterialTextBLL(CurrentUserInfo);
                string SourceId         = string.Empty;
                if (!string.IsNullOrEmpty(para.ApplicationType))
                {
                    switch (para.ApplicationType)
                    {
                    case "1":
                        SourceId = "3";    //会员集客
                        break;

                    case "2":
                        SourceId = "1";    //APP会员服务;
                        break;

                    case "3":
                        SourceId = "3";    //APP会员服务;
                        break;

                    case "4":
                        SourceId = "4";    //超级分销商;
                        break;
                    }
                }
                string goUrl       = string.Empty;
                string goCouponUrl = strHost + "/HtmlApps/html/common/GatheringClient/Coupon.html?customerId=";                           //拼优惠券详细页面
                string goPosterUrl = strHost + "/HtmlApps/html/common/GatheringClient/poster.html?customerId=";                           //拼海报详细页面
                string strOAuthUrl = strHost + "/WXOAuth/AuthUniversal.aspx?scope=snsapi_userinfo&SourceId=" + SourceId + "&customerId="; //拼OAuth认证
                foreach (DataRow dr in SetoffToolsList.Tables[0].Rows)
                {
                    if (dr["ToolType"].ToString() == "Coupon")
                    {
                        if (CustomerBasicInfo != null)
                        {
                            dr["ImageUrl"] = CustomerBasicInfo.SettingValue;
                        }
                        if (para.ApplicationType == "4")
                        {
                            goUrl     = goCouponUrl + CurrentUserInfo.CurrentUser.customer_id + "&pushType=IsSuperRetail&ShareVipId=" + CurrentUserInfo.UserID + "&couponId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=Coupon&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                        else
                        {
                            //Oauth认证加商品详情页
                            goUrl     = goCouponUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipId=" + CurrentUserInfo.UserID + "&couponId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                    }
                    if (dr["ToolType"].ToString() == "SetoffPoster")
                    {
                        var setOffPosterInfo = setOffPosterBLL.QueryByEntity(new SetoffPosterEntity()
                        {
                            SetoffPosterID = new Guid(dr["ObjectId"].ToString())
                        }, null).FirstOrDefault();
                        if (setOffPosterInfo != null)
                        {
                            var ObjectImgsInfo = ObjectImagesBLL.QueryByEntity(new ObjectImagesEntity()
                            {
                                ImageId = setOffPosterInfo.ImageId
                            }, null).FirstOrDefault();
                            if (ObjectImgsInfo != null)
                            {
                                dr["ImageUrl"] = ObjectImgsInfo.ImageURL;
                            }
                        }
                        if (para.ApplicationType == "4")
                        {
                            goUrl     = goPosterUrl + CurrentUserInfo.CurrentUser.customer_id + "&pushType=IsSuperRetail&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=SetoffPoster&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                        else
                        {
                            //Oauth认证加海报详情页
                            goUrl     = goPosterUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                    }
                    if (dr["ToolType"].ToString() == "CTW")
                    {
                        var T_CTW_LEventInfo = T_CTW_LEventBLL.QueryByEntity(new T_CTW_LEventEntity()
                        {
                            CTWEventId = new Guid(dr["ObjectId"].ToString())
                        }, null).FirstOrDefault();
                        if (T_CTW_LEventInfo != null)
                        {
                            dr["ImageUrl"] = T_CTW_LEventInfo.ImageURL;
                        }
                        if (para.ApplicationType == "4")
                        {
                            goUrl     = dr["URL"].ToString() + "&pushType=IsSuperRetail&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=CTW&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                        else
                        {
                            goUrl     = dr["URL"].ToString() + "&ShareVipId=" + CurrentUserInfo.UserID + "&ObjectId=" + dr["ObjectId"] + "&version=";
                            dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                        }
                    }
                    if (dr["ToolType"].ToString() == "Material")//如果是图文素材
                    {
                        var wMaterialTextInfo = wMaterialTextBLL.QueryByEntity(new WMaterialTextEntity()
                        {
                            TextId = dr["ObjectId"].ToString()
                        }, null).FirstOrDefault();
                        if (wMaterialTextInfo != null)
                        {
                            dr["ImageUrl"] = wMaterialTextInfo.CoverImageUrl;
                        }
                        goUrl     = dr["URL"].ToString();
                        dr["URL"] = strOAuthUrl + CurrentUserInfo.CurrentUser.customer_id + "&objectType=Material&ObjectID=" + dr["ObjectId"] + "&ShareVipID=" + CurrentUserInfo.UserID + "&goUrl=" + System.Web.HttpUtility.UrlEncode(goUrl);
                    }
                }
                setoffToolsRD.SetOffToolsList = DataTableToObject.ConvertToList <SetOffToolsInfo>(SetoffToolsList.Tables[0]);
            }
            if (IncentiveRule != null && IncentiveRule.Tables[0].Rows.Count > 0)
            {
                setoffToolsRD.SetoffRegAwardType = Convert.ToInt32(IncentiveRule.Tables[0].Rows[0]["SetoffRegAwardType"].ToString()); //激励类型
                setoffToolsRD.SetoffRegPrize     = IncentiveRule.Tables[0].Rows[0]["SetoffRegPrize"].ToString();                      //激励值
                setoffToolsRD.SetoffOrderPer     = Convert.ToDecimal(IncentiveRule.Tables[0].Rows[0]["SetoffOrderPer"].ToString());   //订单成交提成比例
            }
            return(setoffToolsRD);
        }
        /// <summary>
        /// 获取配送信息
        /// </summary>
        private string GetDeliveryDetail(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <DeliveryInfoRp> >();

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

            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            //配送信息
            DeliveryInfo DeliveryInfo = new DeliveryInfo();

            //TO DO 查询配送方式信息
            if (rp.Parameters.DeliveryId == "1")
            //送货到家信息
            {
                //查询商户配送策略表
                CustomerDeliveryStrategyBLL deliveryStrategyBLL = new CustomerDeliveryStrategyBLL(loggingSessionInfo);
                var deliveryStrategy = deliveryStrategyBLL.QueryByEntity(
                    new CustomerDeliveryStrategyEntity
                {
                    CustomerId = loggingSessionInfo.ClientID,
                    DeliveryId = rp.Parameters.DeliveryId
                },
                    null
                    ).FirstOrDefault();

                //查询商户基数设置
                CustomerBasicSettingBLL basicSettingBLL = new CustomerBasicSettingBLL(loggingSessionInfo);
                var basicSetting = basicSettingBLL.QueryByEntity(
                    new CustomerBasicSettingEntity
                {
                    SettingCode = "DeliveryStrategy",
                    CustomerID  = loggingSessionInfo.ClientID
                },
                    null
                    ).FirstOrDefault();

                //组织配送信息

                if (deliveryStrategy != null)
                {
                    DeliveryInfo.DeliveryStrategyId = deliveryStrategy.Id.ToString();  //配送策略id
                    DeliveryInfo.Status             = deliveryStrategy.Status;         //是否启用  1启用 0停用
                    DeliveryInfo.DeliveryAmount     = deliveryStrategy.DeliveryAmount; //默认配送费用
                    DeliveryInfo.AmountEnd          = deliveryStrategy.AmountEnd;      //免配送费最低订单金额
                }
                else
                {
                    DeliveryInfo.Status = 0;
                }

                if (basicSetting != null)
                {
                    DeliveryInfo.SettingId   = basicSetting.SettingID.ToString(); //商户基础设置
                    DeliveryInfo.Description = basicSetting.SettingValue;         //描述
                }
            }
            else if (rp.Parameters.DeliveryId == "2" || rp.Parameters.DeliveryId == "4")
            //到点提货信息
            {
                //查询提货配置信息
                CustomerTakeDeliveryBLL takeDeliveryBLL = new CustomerTakeDeliveryBLL(loggingSessionInfo);
                var takeDelivery = takeDeliveryBLL.QueryByEntity(
                    new CustomerTakeDeliveryEntity()
                {
                    DeliveryId = rp.Parameters.DeliveryId,
                    CustomerId = loggingSessionInfo.ClientID
                }, null
                    ).FirstOrDefault();


                DeliveryInfo.DeliveryAmount = 0;
                DeliveryInfo.AmountEnd      = 0;

                if (takeDelivery != null)
                {
                    DeliveryInfo.TakeDeliveryId = takeDelivery.Id.ToString();
                    DeliveryInfo.StockUpPeriod  = takeDelivery.StockUpPeriod;
                    DeliveryInfo.BeginWorkTime  = takeDelivery.BeginWorkTime;
                    DeliveryInfo.EndWorkTime    = takeDelivery.EndWorkTime;
                    DeliveryInfo.MaxDelivery    = takeDelivery.MaxDelivery;
                    DeliveryInfo.Status         = takeDelivery.Status;
                }
                else
                {
                    DeliveryInfo.Status = 0;
                }
                SysTimeQuantumBLL      sysTimeQuantumBll         = new SysTimeQuantumBLL(loggingSessionInfo);
                SysTimeQuantumEntity[] sysTimeQuantumEntityArray =
                    sysTimeQuantumBll.QueryByEntity(
                        new SysTimeQuantumEntity()
                {
                    DeliveryId = rp.Parameters.DeliveryId,
                    CustomerID = loggingSessionInfo.ClientID
                },
                        new OrderBy[] { new OrderBy()
                                        {
                                            FieldName = "Quantum", Direction = OrderByDirections.Asc
                                        } });
                DeliveryInfo.QuantumList = new List <QuantumInfo>();

                if (sysTimeQuantumEntityArray.Length != 0)
                {
                    for (int i = 0; i < sysTimeQuantumEntityArray.Length; i++)
                    {
                        QuantumInfo quantum = new QuantumInfo();
                        quantum.Quantum = sysTimeQuantumEntityArray[i].Quantum;
                        DeliveryInfo.QuantumList.Add(quantum);
                    }
                }
            }
            else
            {
                throw new APIException("DeliveryId不存在.")
                      {
                          ErrorCode = 121
                      };
            }

            var rd = new DeliveryInfoRD
            {
                DeliveryInfo = DeliveryInfo
            };

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

            return(rsp.ToJSON());
        }