コード例 #1
0
ファイル: CommonUtil.cs プロジェクト: radtek/crm
        /// <summary>
        /// 生成订单包裹
        /// </summary>
        /// <param name="pParameters">订单参数集</param>
        /// <returns></returns>
        public static string GenerateOrderPackage(Dictionary <string, string> pParameters, WeiXinPayChannel pChannel)
        {
            //参数检查
            if (pParameters == null)
            {
                throw new ArgumentNullException("pParameters");
            }
            if (pChannel == null)
            {
                throw new ArgumentNullException("pChannel");
            }
            if (string.IsNullOrWhiteSpace(pChannel.ParnterKey))
            {
                throw new ArgumentNullException("pChannel.ParnterKey");
            }
            //计算订单包裹签名
            StringBuilder sb1   = new StringBuilder();
            StringBuilder sb2   = new StringBuilder();
            var           items = pParameters.OrderBy(item => item.Key).ToArray();

            foreach (var item in items)
            {
                sb1.AppendFormat("{0}={1}&", item.Key, item.Value);
                sb2.AppendFormat("{0}={1}&", item.Key, HttpUtility.UrlEncode(item.Value));
                //sb2.AppendFormat("{0}={1}&", item.Key, UrlEncoder.UpperCaseUrlEncode(item.Value));
            }
            sb1.AppendFormat("key={0}", pChannel.ParnterKey);
            string sign = MD5Helper.Encryption(sb1.ToString());

            sign = sign.ToUpper();
            //
            sb2.AppendFormat("sign={0}", sign);
            //
            return(sb2.ToString());
        }
コード例 #2
0
        private string SetPassWord(string pRequest)
        {
            var    rp = pRequest.DeserializeJSONTo <APIRequest <SetPassWordRP> >();
            var    loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
            string error    = "";
            string pNewPass = MD5Helper.Encryption(rp.Parameters.pNewPWD);

            //pOldPWD = MD5Helper.Encryption(pOldPWD);
            rp.Parameters.pOldPWD = EncryptManager.Hash(rp.Parameters.pOldPWD, HashProviderType.MD5);
            string res = "{\"success\":\"false\",\"msg\":\"保存失败\"}";

            //组装参数
            JIT.CPOS.BS.Entity.User.UserInfo entity = new JIT.CPOS.BS.Entity.User.UserInfo();
            var serviceBll = new cUserService(loggingSessionInfo);

            entity = serviceBll.GetUserById(loggingSessionInfo, rp.Parameters.pID);
            string apPwd = serviceBll.GetPasswordFromAP(loggingSessionInfo.ClientID, rp.Parameters.pID);

            //if (pOldPWD == entity.User_Password)
            if (rp.Parameters.pOldPWD == apPwd)
            {
                entity.userRoleInfoList = new cUserService(loggingSessionInfo).GetUserRoles(rp.Parameters.pID);//, PageBase.JITPage.GetApplicationId()
                entity.User_Password    = pNewPass;
                entity.ModifyPassword   = true;
                //new cUserService(CurrentUserInfo).SetUserInfo(entity, entity.userRoleInfoList, out error);
                bool bReturn = serviceBll.SetUserPwd(loggingSessionInfo, pNewPass, out error);
                res = "{\"success\":\"true\",\"msg\":\"" + error + "\"}";
            }
            else
            {
                res = "{\"success\":\"false\",\"msg\":\"旧密码不正确\"}";
            }
            return(res);
        }
コード例 #3
0
        private string SetPassWord(string pID, string pOldPWD, string pNewPWD)
        {
            string error    = "";
            string pNewPass = MD5Helper.Encryption(pNewPWD);

            //pOldPWD = MD5Helper.Encryption(pOldPWD);
            pOldPWD = EncryptManager.Hash(pOldPWD, HashProviderType.MD5);
            string res = "{success:false,msg:'保存失败'}";
            //组装参数
            UserInfo entity     = new UserInfo();
            var      serviceBll = new cUserService(CurrentUserInfo);

            entity = serviceBll.GetUserById(CurrentUserInfo, pID);
            string apPwd = serviceBll.GetPasswordFromAP(CurrentUserInfo.ClientID, pID);

            //if (pOldPWD == entity.User_Password)
            if (pOldPWD == apPwd)
            {
                entity.userRoleInfoList = new cUserService(CurrentUserInfo).GetUserRoles(pID, PageBase.JITPage.GetApplicationId());
                entity.User_Password    = pNewPass;
                entity.ModifyPassword   = true;
                //new cUserService(CurrentUserInfo).SetUserInfo(entity, entity.userRoleInfoList, out error);
                bool bReturn = serviceBll.SetUserPwd(CurrentUserInfo, pNewPass, out error);
                res = "{success:true,msg:'" + error + "'}";
            }
            else
            {
                res = "{success:false,msg:'旧密码不正确'}";
            }
            return(res);
        }
コード例 #4
0
        //修改分销商密码
        private string RetailSetPassWord(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <RetailSetPassWordRP> >();
            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            string pNewPass = MD5Helper.Encryption(rp.Parameters.pNewPWD);

            //pOldPWD = MD5Helper.Encryption(pOldPWD);
            rp.Parameters.pOldPWD = EncryptManager.Hash(rp.Parameters.pOldPWD, HashProviderType.MD5);

            //组装参数
            var rd         = new RetailSetPassWordRD();
            var rsp        = new SuccessResponse <IAPIResponseData>(rd);
            var serviceBll = new RetailTraderBLL(loggingSessionInfo);
            var entity     = serviceBll.GetByID(rp.Parameters.pID);//获取分销商实体

            //if (pOldPWD == entity.User_Password)
            if (rp.Parameters.pOldPWD == entity.RetailTraderPass)
            {
                entity.RetailTraderPass = pNewPass;
                entity.LastUpdateBy     = "1";
                entity.LastUpdateTime   = DateTime.Now;
                //new cUserService(CurrentUserInfo).SetUserInfo(entity, entity.userRoleInfoList, out error);
                serviceBll.Update(entity);
                rsp.Message = "";
            }
            else
            {
                rsp.ResultCode = 135;
                rsp.Message    = "旧密码不正确";
            }
            return(rsp.ToJSON());
        }
コード例 #5
0
        protected override EmptyResponseData ProcessRequest(DTO.Base.APIRequest <SetPasswordRP> pRequest)
        {
            //基础数据初始化
            string            error             = "";
            EmptyResponseData emptyResponseData = new EmptyResponseData();

            try
            {
                if (pRequest.Parameters.NewPassword.Length < 6)
                {
                    throw new APIException("新密码不小于6位。")
                          {
                              ErrorCode = ERROR_CODES.INVALID_BUSINESS
                          };
                }


                string newPassword = MD5Helper.Encryption(pRequest.Parameters.NewPassword);
                string oldPassword = EncryptManager.Hash(pRequest.Parameters.OldPassword, HashProviderType.MD5);

                //组装参数
                UserInfo entity     = new UserInfo();
                var      serviceBll = new cUserService(CurrentUserInfo);
                entity = serviceBll.GetUserById(CurrentUserInfo, CurrentUserInfo.UserID);
                string apPassword = serviceBll.GetPasswordFromAP(CurrentUserInfo.ClientID, CurrentUserInfo.UserID);

                if (oldPassword == apPassword)
                {
                    entity.userRoleInfoList = new cUserService(CurrentUserInfo).GetUserRoles(CurrentUserInfo.UserID, PageBase.JITPage.GetApplicationId());
                    entity.User_Password    = newPassword;
                    entity.ModifyPassword   = true;
                    //new cUserService(CurrentUserInfo).SetUserInfo(entity, entity.userRoleInfoList, out error);
                    bool bReturn = serviceBll.SetUserPwd(CurrentUserInfo, newPassword, out error);
                    if (!bReturn)
                    {
                        throw new APIException(error)
                              {
                                  ErrorCode = ERROR_CODES.INVALID_BUSINESS
                              };
                    }
                }
                else
                {
                    throw new APIException("旧密码不正确")
                          {
                              ErrorCode = ERROR_CODES.INVALID_BUSINESS
                          };
                }
                return(emptyResponseData);
            }
            catch (APIException apiEx)
            {
                throw new APIException(apiEx.ErrorCode, apiEx.Message);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #6
0
        public string RevertPassword()
        {
            string             user_id            = Request("user");
            var                responseData       = new ResponseData();
            LoggingSessionInfo loggingSessionInfo = null;

            if (CurrentUserInfo != null)
            {
                loggingSessionInfo = CurrentUserInfo;
            }
            else
            {
                if (string.IsNullOrEmpty(Request("CustomerID")))
                {
                    responseData.success = false;
                    responseData.msg     = "缺少商户标识";
                    return(responseData.ToString());
                }
                else if (string.IsNullOrEmpty(Request("CustomerUserID")))
                {
                    responseData.success = false;
                    responseData.msg     = "缺少登陆员工的标识";
                    return(responseData.ToString());
                }

                else
                {
                    loggingSessionInfo = Default.GetBSLoggingSession(Request("CustomerID"), Request("CustomerUserID"));
                }
            }


            string error = "";

            //   var responseData = new ResponseData();
            try
            {
                UserInfo user        = new UserInfo();
                var      userService = new cUserService(loggingSessionInfo);                                               //使用兼容模式
                userService.SetUserPwd(loggingSessionInfo, user_id, MD5Helper.Encryption(Request("password")), out error); //使用兼容模式
                responseData.success = true;
            }
            catch (Exception)
            {
                responseData.success = false;
                responseData.msg     = "密码重置失败";
            }
            return(responseData.ToJSON());
        }
コード例 #7
0
        /// <summary>
        /// 修改提现密码
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string SetWithdrawalPwd(string pRequest)
        {
            var rsp = new SuccessResponse <IAPIResponseData>();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var rp                    = pRequest.DeserializeJSONTo <APIRequest <SetWithdrawalPwdRP> >();
            var customerId            = loggingSessionInfo.ClientID;
            var Oldpwd                = rp.Parameters.OldWithdrawalPassword; //提现密码
            var NewPwd                = rp.Parameters.NewWithdrawalPassword; //新密码
            var rd                    = new SetWithdrawalPwdRD();
            var bll                   = new CustomerBackBLL(loggingSessionInfo);
            CustomerBackEntity entity = new CustomerBackEntity();

            entity.CustomerId         = customerId; //客户ID
            entity.BackStatus         = 1;          //账户状态
            entity.WithdrawalPassword = rp.Parameters.OldWithdrawalPassword;
            var ds = bll.QueryByEntity(entity, null);

            if (ds.Length > 0)
            {
                entity = (CustomerBackEntity)ds[0];
                string strPwd = string.Empty; //密码
                if (ds.Length > 0 && ds != null)
                {
                    strPwd = ds.FirstOrDefault().WithdrawalPassword;
                    if (!string.IsNullOrWhiteSpace(strPwd) && strPwd == Oldpwd)  //当数据库中存的密码和输入的密码一样,更新密码
                    {
                        entity.WithdrawalPassword = NewPwd;
                        entity.MD5Pwd             = NewPwd.Trim() + MD5Helper.Encryption(customerId.ToString()).Trim();
                        entity.CustomerBackId     = Guid.Parse(ds.FirstOrDefault().CustomerBackId.ToString());
                        bll.Update(entity);//更新密码
                        rsp.ResultCode = 0;
                        rsp.Message    = "OK";
                        return(rsp.ToJSON());
                    }
                }
            }
            else
            {
                rsp.ResultCode = 301;
                rsp.Message    = "提现密码输入错误!请重新输入";
                return(rsp.ToJSON());

                throw new APIException("提现密码输入错误!")
                      {
                          ErrorCode = 301
                      };
            }
            return(rsp.ToJSON());
        }
コード例 #8
0
        public string SaveRetailTrader(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <SaveRetailTraderRP> >();

            if (rp.Parameters.RetailTraderInfo == null)
            {
                throw new APIException("缺少参数【RetailTraderInfo】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }
            if (rp.Parameters.IsNewHeadImg == null)
            {
                throw new APIException("缺少参数【IsNewHeadImg】或参数值为空")
                      {
                          ErrorCode = 135
                      };
            }
            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1");
            var bll = new RetailTraderBLL(loggingSessionInfo);
            var rd  = new SaveRetailTraderRD();
            var rsp = new SuccessResponse <IAPIResponseData>(rd);
            //判断登陆名是否有重复的,要从ap库里取
            var ds = bll.getRetailTraderInfoByLogin2(rp.Parameters.RetailTraderInfo.RetailTraderLogin, "", loggingSessionInfo.ClientID);
            var retailTraderInfo = new RetailTraderInfo();

            //判断账号是否存在
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                var tempDt = ds.Tables[0];
                retailTraderInfo = DataTableToObject.ConvertToObject <RetailTraderInfo>(tempDt.Rows[0]); //直接根据所需要的字段反序列化
                if (retailTraderInfo.RetailTraderID != rp.Parameters.RetailTraderInfo.RetailTraderID)    //如果取出来的实体的id和传过来的参数的id不一样,说明不是同一个实体
                {
                    rsp.Message    = "该登陆账号已经存在,不能重复使用";
                    rsp.ResultCode = 137;
                    return(rsp.ToJSON());//这里要返回
                }
            }


            //从RetailTraderInfo转到RetailTraderEntity
            RetailTraderEntity en = new RetailTraderEntity();

            en.RetailTraderID = rp.Parameters.RetailTraderInfo.RetailTraderID;
            if (rp.Parameters.RetailTraderInfo.RetailTraderID == null || rp.Parameters.RetailTraderInfo.RetailTraderID.ToString() == "")
            {
                en.RetailTraderID = Guid.NewGuid().ToString();
                //获取当前最大的
                //如果是新增,则取本客户下的最大编号作为分销商编号
                en.RetailTraderCode = bll.getMaxRetailTraderCode(rp.CustomerID) + 1;

                en.CreateTime = DateTime.Now;
                en.CreateBy   = rp.UserID;
            }
            en.RetailTraderName  = rp.Parameters.RetailTraderInfo.RetailTraderName;
            en.RetailTraderLogin = rp.Parameters.RetailTraderInfo.RetailTraderLogin;
            if (!string.IsNullOrEmpty(rp.Parameters.RetailTraderInfo.RetailTraderPass))
            {
                en.RetailTraderPass = MD5Helper.Encryption(rp.Parameters.RetailTraderInfo.RetailTraderPass);
            }
            en.RetailTraderMan     = rp.Parameters.RetailTraderInfo.RetailTraderMan;
            en.RetailTraderPhone   = rp.Parameters.RetailTraderInfo.RetailTraderPhone;
            en.RetailTraderAddress = rp.Parameters.RetailTraderInfo.RetailTraderAddress;
            en.CooperateType       = rp.Parameters.RetailTraderInfo.CooperateType;
            en.SalesType           = rp.Parameters.RetailTraderInfo.SalesType;
            en.SellUserID          = rp.Parameters.RetailTraderInfo.SellUserID;
            en.UnitID = rp.Parameters.RetailTraderInfo.UnitID;
            en.Status = "1";//启用状态

            en.LastUpdateTime = DateTime.Now;
            en.LastUpdateBy   = rp.UserID;
            en.IsDelete       = 0;
            en.CustomerId     = rp.CustomerID;
            if (rp.Parameters.RetailTraderInfo.RetailTraderID == null || rp.Parameters.RetailTraderInfo.RetailTraderID.ToString() == "")
            {
                bll.Create(en);
                //  rp.Parameters.RetailTraderInfo.RetailTraderID = en.RetailTraderID;//为了返回数据时使用
            }
            else
            {
                bll.Update(en, null, false);//不更新空值的字段
            }
            //另外要保存到ap库里,这样才能登陆时从ap库里统一取出分销商信息,和对应的customerid
            if (rp.Parameters.RetailTraderInfo.RetailTraderID == null || rp.Parameters.RetailTraderInfo.RetailTraderID.ToString() == "")
            {
                bll.Create2Ap(en);                                                 //ap库里的RetailTraderID和商户里的RetailTraderID是一样的
                rp.Parameters.RetailTraderInfo.RetailTraderID = en.RetailTraderID; //为了返回数据时使用,到这里才赋值***
            }
            else
            {
                bll.Update2Ap(en, null, false);//不更新空值的字段
            }

            //如果IsNewHeadImg为1时,即上传图片时,则删除之前的关联图片(逻辑删除)
            if (rp.Parameters.IsNewHeadImg == 1)
            {
                ObjectImagesBLL    _ObjectImagesBLL = new ObjectImagesBLL(loggingSessionInfo);
                ObjectImagesEntity ObjectImagesEn   = new ObjectImagesEntity();

                _ObjectImagesBLL.DeleteByObjectID(en.RetailTraderID.ToString());
            }

            rd.RetailTraderInfo = rp.Parameters.RetailTraderInfo;


            return(rsp.ToJSON());
        }
コード例 #9
0
        public string AddUser(string pRequest)
        {
            var rd     = new APIResponse <AddUserRD>();
            var rdData = new AddUserRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <AddUserRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var       loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
            T_UserBLL bll = new T_UserBLL(loggingSessionInfo);

            try
            {
                string       email = rp.Parameters.UserEmail, customerID = rp.CustomerID;
                T_UserEntity tue = new T_UserEntity();
                tue = bll.GetUserEntityByEmail(rp.Parameters.UserEmail, customerID);
                if (tue == null)
                {
                    DateTime dt = DateTime.Now;

                    #region 保存用户
                    string userId = Guid.NewGuid().ToString().Replace("-", "").ToUpper();
                    tue = new T_UserEntity()
                    {
                        user_id          = userId,
                        user_code        = rp.Parameters.UserCode,
                        user_name        = rp.Parameters.UserName,
                        user_name_en     = rp.Parameters.UserNameEn,
                        user_email       = rp.Parameters.UserEmail,
                        user_password    = MD5Helper.Encryption("123"),//默认密码
                        user_gender      = rp.Parameters.UserGender,
                        user_birthday    = rp.Parameters.UserBirthday,
                        user_telephone   = rp.Parameters.UserTelephone,
                        user_cellphone   = rp.Parameters.UserCellphone,
                        user_status      = "1",
                        user_status_desc = "正常",
                        fail_date        = string.IsNullOrEmpty(rp.Parameters.FailDate) == true ? "2020-01-01" : rp.Parameters.FailDate,
                        customer_id      = customerID,
                        create_time      = dt.ToString("yyyy-MM-dd HH:mm:ss"),
                        create_user_id   = rp.UserID,
                        modify_time      = dt.ToString("yyyy-MM-dd HH:mm:ss"),
                        modify_user_id   = rp.UserID
                    };
                    //T_User表
                    //Create(tue, tran);
                    bll.Create(tue);
                    #endregion

                    #region 保存用户角色
                    //T_User_Role 表
                    TUserRoleEntity ture = new TUserRoleEntity
                    {
                        user_role_id   = Guid.NewGuid().ToString(),
                        user_id        = userId,
                        role_id        = rp.Parameters.RoleID,
                        unit_id        = rp.Parameters.UnitID,
                        status         = "1",
                        create_time    = dt,
                        create_user_id = rp.UserID,
                        modify_time    = dt,
                        modify_user_id = rp.UserID,
                        default_flag   = "1"
                    };
                    bll.InsertUserRole(ture);
                    #endregion

                    #region 保存部门、职衔
                    UserDeptJobMappingBLL deptJobMapBll = new UserDeptJobMappingBLL(loggingSessionInfo);
                    //UserDeptJobMapping表
                    UserDeptJobMappingEntity udjme = new UserDeptJobMappingEntity
                    {
                        UserDeptID       = Guid.NewGuid(),
                        UserID           = userId,
                        JobFunctionID    = rp.Parameters.JobFunctionID,
                        USERID           = userId,
                        CustomerID       = customerID,
                        CreateTime       = dt,
                        CreateUserID     = rp.UserID,
                        LastUpdateTime   = dt,
                        LastUpdateUserID = rp.UserID,
                        IsDelete         = 0,
                        UnitID           = rp.Parameters.UnitID,
                        LineManagerID    = rp.Parameters.LineManagerID,
                        UserLevel        = "0"//默认0
                    };
                    deptJobMapBll.Create(udjme);
                    #endregion

                    rdData.UserID = userId;
                    rd.ResultCode = 0;
                }
                else
                {
                    rd.ResultCode = 101;
                    rd.Message    = "邮箱已存在";
                }
                rd.Data = rdData;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            return(rd.ToJSON());
        }
コード例 #10
0
        /// <summary>
        /// 华硕校园 专家登录
        /// </summary>
        /// <returns></returns>
        public string AmbassadorLoginIn()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(loggingSessionInfo);

                #region //组装参数
                Dictionary <string, string> pParams = new Dictionary <string, string>();
                if (!string.IsNullOrEmpty(reqObj.special.code))
                {
                    pParams.Add("pCode", reqObj.special.code);
                }
                //是否有此人
                var vip = new VipBLL(loggingSessionInfo).Query(new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "VipCode", Value = reqObj.special.code
                    },
                    new EqualsCondition()
                    {
                        FieldName = "ClientID", Value = customerId
                    }
                }, null).FirstOrDefault();

                if (vip != null)
                {
                    pParams.Add("pPass", MD5Helper.Encryption(MD5Helper.Encryption(reqObj.special.pass) + vip.Col4));
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "专家编号或密码错误";

                    content = respData.ToJSON();
                    return(content);
                }
                #endregion


                var vipInfo = itemService.AmbassadorLoginIn(pParams);
                if (vipInfo != null && vipInfo.Count > 0)
                {
                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    foreach (var item in vipInfo)
                    {
                        ambassadorLoginInRespContentDataItem info = new ambassadorLoginInRespContentDataItem();
                        info.VipID           = item.VIPID;
                        info.VipName         = item.VipName;
                        info.VipRealName     = item.VipRealName;
                        info.VipCode         = item.VipCode;
                        info.Phone           = item.Phone;
                        info.City            = item.City;
                        info.DeliveryAddress = item.DeliveryAddress;
                        info.Province        = item.Province;
                        info.CityCode        = item.CityCode;
                        info.RoleName        = item.RoleName;
                        info.Code            = item.VipCode;
                        list.Add(info);
                    }
                    respData.content.vipList = list;
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "专家编号或密码错误";
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
コード例 #11
0
        public string ExportData(string pCustomerID, LoggingSessionInfo pLoggingSessionInfo, DataTable pExportData, JobFunctionEntity[] pJobFuncE, TUnitEntity[] pDeptE, IList <RoleModel> pRoleE)
        {
            T_UserBLL             tubll         = new T_UserBLL(pLoggingSessionInfo);
            UserDeptJobMappingBLL deptJobMapBll = new UserDeptJobMappingBLL(pLoggingSessionInfo);
            //客户id
            string customerID = pCustomerID;

            //var tran = this.SQLHelper.CreateTransaction();
            //using (tran.Connection)
            //{
            try
            {
                string   createUserID     = pLoggingSessionInfo.CurrentUser.User_Id;
                string   lastUpdateUserID = pLoggingSessionInfo.CurrentUser.User_Id;
                DateTime dt = DateTime.Now;
                int      existsEmaliNum = 0, notExistsEmailNum = 0;
                string   email = string.Empty;

                if (pExportData != null && pExportData.Rows.Count > 0)
                {
                    DataTable    dTable = pExportData;
                    T_UserEntity tue    = null;
                    foreach (DataRow row in dTable.Rows)
                    {
                        dt = DateTime.Now;
                        //检测邮箱是否存在
                        if (row["邮箱"] == null || string.IsNullOrEmpty(row["邮箱"].ToString()))
                        {
                            continue;
                        }
                        email = row["邮箱"].ToString().Trim().ToLower();
                        tue   = tubll.GetUserEntityByEmail(email, customerID);
                        if (tue != null)
                        {
                            //存在
                            existsEmaliNum++;
                            continue;
                        }
                        else
                        {
                            //不存在
                            notExistsEmailNum++;
                            #region 保存用户
                            tue = new T_UserEntity();
                            string userId = Guid.NewGuid().ToString().Replace("-", "").ToUpper();
                            tue.user_id = userId;
                            if (email != null && !string.IsNullOrEmpty(email))
                            {
                                tue.user_email = email;
                            }
                            tue.user_name    = row["用户名称"].ToString();
                            tue.user_name_en = row["英文名"].ToString();
                            if (row["性别"] != null && !string.IsNullOrEmpty(row["性别"].ToString()))
                            {
                                if (row["性别"].ToString().Trim() == "男")
                                {
                                    tue.user_gender = "1";
                                }
                                else if (row["性别"].ToString().Trim() == "女")
                                {
                                    tue.user_gender = "2";
                                }
                                else
                                {
                                    tue.user_gender = "0"; //未知
                                }
                            }
                            else
                            {
                                tue.user_gender = "0";
                            }
                            if (row["生日"] != null && !string.IsNullOrEmpty(row["生日"].ToString()))
                            {
                                tue.user_birthday = Convert.ToDateTime(row["生日"]).ToString("yyyy-MM-dd");
                            }
                            if (row["手机"] != null && !string.IsNullOrEmpty(row["手机"].ToString()))
                            {
                                tue.user_telephone = row["手机"].ToString();
                            }
                            if (row["固话"] != null && !string.IsNullOrEmpty(row["固话"].ToString()))
                            {
                                tue.user_cellphone = row["固话"].ToString();
                            }
                            if (row["用户编码"] != null && !string.IsNullOrEmpty(row["用户编码"].ToString()))
                            {
                                tue.user_code = row["用户编码"].ToString();
                            }

                            tue.user_status      = "1";
                            tue.user_status_desc = "正常";
                            tue.fail_date        = "2020-01-02";
                            tue.user_address     = "";
                            tue.user_password    = MD5Helper.Encryption("123");//默认密码
                            tue.customer_id      = customerID;
                            tue.create_user_id   = tue.modify_user_id = createUserID;
                            tue.create_time      = tue.modify_time = dt.ToString("yyyy-MM-dd HH:mm:ss");
                            tue.msn           = "";
                            tue.qq            = "";
                            tue.blog          = "";
                            tue.user_postcode = "";
                            tue.user_remark   = "";
                            //T_User表
                            //Create(tue, tran);
                            tubll.Create(tue);
                            #endregion

                            #region 保存用户角色
                            //T_User_Role 表
                            string          deptID = pDeptE.Where(a => a.UnitName == row["部门"].ToString().Trim()).First().UnitID.ToString();
                            RoleModel       rm     = pRoleE.Where(a => a.Role_Name == row["角色"].ToString().Trim()).First();
                            TUserRoleEntity ture   = new TUserRoleEntity
                            {
                                user_role_id   = Guid.NewGuid().ToString(),
                                user_id        = userId,
                                role_id        = rm.Role_Id,
                                unit_id        = deptID,
                                status         = "1",
                                create_time    = dt,
                                create_user_id = createUserID,
                                modify_time    = dt,
                                modify_user_id = lastUpdateUserID,
                                default_flag   = "1"
                            };
                            tubll.InsertUserRole(ture);
                            #endregion

                            #region 保存部门、职衔
                            //UserDeptJobMapping表
                            string jobFuncID = pJobFuncE.Where(a => a.Name == row["职衔"].ToString().Trim()).First().JobFunctionID.ToString();
                            UserDeptJobMappingEntity udjme = new UserDeptJobMappingEntity
                            {
                                UserDeptID       = Guid.NewGuid(),
                                UserID           = userId,
                                JobFunctionID    = jobFuncID,
                                USERID           = userId,
                                CustomerID       = customerID,
                                CreateTime       = dt,
                                CreateUserID     = createUserID,
                                LastUpdateTime   = dt,
                                LastUpdateUserID = lastUpdateUserID,
                                IsDelete         = 0,
                                UnitID           = deptID
                            };
                            deptJobMapBll.Create(udjme);
                            #endregion
                        }
                    }
                    Loggers.DEFAULT.Debug(new DebugLogInfo()
                    {
                        Message = "重复:" + existsEmaliNum + "条,新增:" + notExistsEmailNum + "条,共:" + dTable.Rows.Count
                    });
                }
                //tran.Commit();
            }
            catch (Exception ex)
            {
                //回滚&转抛异常
                //tran.Rollback();
                throw;
            }
            return("1|成功");
            //}
        }
コード例 #12
0
        /// <summary>
        /// 校园专家 重置密码
        /// </summary>
        /// <returns></returns>
        public string ForgetPassword()
        {
            string content  = string.Empty;
            var    respData = new ambassadorLoginInRespData();

            try
            {
                //接收参数
                string reqContent = HttpContext.Current.Request["ReqContent"];
                var    reqObj     = reqContent.DeserializeJSONTo <ambassadorLoginInReqData>();
                reqObj = reqObj == null ? new ambassadorLoginInReqData() : reqObj;

                //获取客户ID
                if (!string.IsNullOrEmpty(reqObj.common.customerId))
                {
                    customerId = reqObj.common.customerId;
                }

                //初始化返回对象
                respData.content         = new ambassadorLoginInRespContentData();
                respData.content.vipList = new List <ambassadorLoginInRespContentDataItem>();

                //用户登录信息
                var loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(loggingSessionInfo);

                var vipInfo = itemService.ForgetPassword(reqObj.special.email);
                if (vipInfo != null && vipInfo.Count > 0)
                {
                    //生成随机数 6位
                    Random rd   = new Random();
                    string code = rd.Next(100000, 999999).ToString();

                    VipBLL    vipBLL = new VipBLL(loggingSessionInfo);
                    VipEntity entity = new VipEntity();

                    entity                = vipBLL.GetByID(vipInfo[0].VIPID);
                    entity.VipPasswrod    = MD5Helper.Encryption(MD5Helper.Encryption(code) + entity.Col4);
                    entity.LastUpdateTime = DateTime.Now;
                    vipBLL.Update(entity);

                    #region 邮件发送
                    try
                    {
                        XmlManager xml = new XmlManager(ConfigurationManager.AppSettings["xmlFile"]);

                        FromSetting fs = new FromSetting();
                        fs.SMTPServer = xml.SelectNodeText("//Root/AsusMail//SMTPServer", 0);
                        fs.SendFrom   = xml.SelectNodeText("//Root/AsusMail//MailSendFrom", 0);
                        fs.UserName   = xml.SelectNodeText("//Root/AsusMail//MailUserName", 0);
                        fs.Password   = xml.SelectNodeText("//Root/AsusMail//MailUserPassword", 0);
                        Mail.SendMail(fs, entity.Col7 + "," + xml.SelectNodeText("//Root/AsusMail//MailTo", 0), xml.SelectNodeText("//Root/AsusMail//MailTitle", 0), entity.VipRealName + ":你好,你的新密码为:" + code, null);
                    }
                    catch
                    {
                        respData.code        = "111";
                        respData.description = "邮箱发送失败,请稍后重试";
                        content = respData.ToJSON();
                        return(content);
                    }
                    #endregion

                    List <ambassadorLoginInRespContentDataItem> list = new List <ambassadorLoginInRespContentDataItem>();
                    foreach (var item in vipInfo)
                    {
                        ambassadorLoginInRespContentDataItem info = new ambassadorLoginInRespContentDataItem();
                        info.VipID       = item.VIPID;
                        info.VipPassword = code;
                        info.Email       = item.Email;

                        list.Add(info);
                    }
                    respData.content.vipList = list;
                }
                else
                {
                    respData.code        = "111";
                    respData.description = "邮箱不存在";
                }
            }
            catch (Exception ex)
            {
                respData.code        = "103";
                respData.description = "数据库操作错误";
                respData.exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
コード例 #13
0
        /// <summary>
        /// 申请提现
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string ApplyForWithdrawal(string pRequest)
        {
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            var rd                 = new ApplyForWithdrawalRD();
            var rp                 = pRequest.DeserializeJSONTo <APIRequest <ApplyForWithdrawalRP> >();
            var customerId         = loggingSessionInfo.ClientID;      //客户ID
            var WithdrawalAmount   = rp.Parameters.WithdrawalAmount;   //提现金额
            var WithdrawalPassword = rp.Parameters.WithdrawalPassword; //提现密码
            var rsp                = new SuccessResponse <IAPIResponseData>();

            #region 1.根据CustomerID查询当前客户银行信息
            CustomerBackBLL    BackBLL    = new CustomerBackBLL(loggingSessionInfo);
            CustomerBackEntity BackEntity = new CustomerBackEntity();
            BackEntity.CustomerId = customerId;
            BackEntity.BackStatus = 1;
            var entityBack = BackBLL.QueryByEntity(BackEntity, null);
            if (entityBack != null && entityBack.Length > 0)
            {
                string Password = entityBack.First().WithdrawalPassword;  //提现密码
                if (!WithdrawalPassword.ToString().Equals(Password))
                {
                    rsp.ResultCode = 303;
                    rsp.Message    = "输入密码错误";
                    return(rsp.ToJSON());

                    throw new APIException(string.Format("输入密码错误!"))
                          {
                              ErrorCode = 303
                          };
                }
                else if (Password == "e10adc3949ba59abbe56e057f20f883e")  //1.未修改初始密码.跳转到输入密码页面
                {
                    rsp.ResultCode = 302;
                    return(rsp.ToJSON());

                    throw new APIException(string.Format("您的初始密码没有修改。请修改初始密码!"))
                          {
                              ErrorCode = 302
                          };
                }

                else
                {
                    string MD5Pwd = WithdrawalPassword.ToString().Trim() + MD5Helper.Encryption(customerId.ToString().Trim()); //MD5密码
                    if ((Password.ToString().Trim().Equals(WithdrawalPassword.ToString().Trim())) && entityBack.FirstOrDefault()
                        .MD5Pwd.ToString().Trim().Equals(MD5Pwd))                                                              //2.当客户已经修改密码,并且输入的密码和数据库中客户密码一致.并且数据库中MD5的密码规则一样则提现
                    {
                        #region 根据金额,客户。状态 查询提现主标识
                        #endregion
                        var    bll    = new CustomerWithdrawalBLL(loggingSessionInfo);
                        string UserId = loggingSessionInfo.CurrentUser.User_Id;
                        // string strWithdrawalld = bll.GetWithdrawalID(customerId, 20);
                        var tran = bll.GetTran();
                        try
                        {
                            if (!bll.GetWithdrawalDayByMaxPeriod(customerId))
                            {
                                rsp.ResultCode = 305;
                                rsp.Message    = "没到提现周期。不能提现";
                                return(rsp.ToJSON());

                                throw new APIException("没到提现周期。不能提现")
                                      {
                                          ErrorCode = 305
                                      };
                            }
                            else
                            {
                                #region 老版本提现。废弃
                                //#region 1.根据提现主标识更新对应的状态和更新人。
                                //bll.UpdateWithdrawalStatus(customerId, strWithdrawalld, 30, UserId);
                                //#endregion
                                //#region 2。根据提现主标识,更新订单支付明细的状态和时间
                                ////提现明细
                                //CustomerWithdrawalDetailBLL blldetail = new CustomerWithdrawalDetailBLL(loggingSessionInfo);
                                //CustomerOrderPayBLL orderPayBLL = new CustomerOrderPayBLL(loggingSessionInfo);

                                //orderPayBLL.UpdateOrderPayList(strWithdrawalld, customerId, 30, UserId);
                                //#endregion

                                //#region 根据CustomerId 3更新客户可提取的现金金额。已提取的金额累加,当前余额-提取金额
                                //CustomerAmountBLL amountBLL = new CustomerAmountBLL(loggingSessionInfo);
                                //CustomerAmountEntity amountentity = new CustomerAmountEntity();
                                //amountentity.CustomerId = customerId;//客户ID
                                //decimal strOutAmount, strWithdrawalAmount, strEndAmount;//已提取金额。可提现金额,当前余额
                                //var temp = amountBLL.QueryByEntity(amountentity, null);
                                //if (temp.Length > 0)
                                //{
                                //    strOutAmount = Convert.ToDecimal(temp.FirstOrDefault().OutAmount);
                                //    strWithdrawalAmount = Convert.ToDecimal(temp.FirstOrDefault().WithdrawalAmount);
                                //    strEndAmount = Convert.ToDecimal(temp.FirstOrDefault().EndAmount);
                                //    amountentity = temp[0];
                                //    amountentity.WithdrawalAmount = 0;//可提现金额变为0;
                                //    amountentity.OutAmount = strOutAmount + rp.Parameters.WithdrawalAmount;//已提取金额累加
                                //    amountentity.EndAmount = strEndAmount - WithdrawalAmount; //余额-提现金额
                                //    amountBLL.Update(amountentity, null);
                                //}
                                //#endregion
                                #endregion

                                int returnValue = bll.getApplyForWithdrawal(customerId, UserId, WithdrawalAmount);
                                if (returnValue == 0)
                                {
                                    rsp.ResultCode = 0;
                                    rsp.Message    = "OK";
                                    return(rsp.ToJSON());
                                }
                                if (returnValue == 1)
                                {
                                    rsp.ResultCode = 306;
                                    rsp.Message    = "提现失败!";
                                    return(rsp.ToJSON());
                                }
                                if (returnValue == 304)
                                {
                                    rsp.ResultCode = 304;
                                    rsp.Message    = "没有可提取金额!不能提现";
                                    return(rsp.ToJSON());

                                    throw new APIException("没有可提取金额!不能提现")
                                          {
                                              ErrorCode = 304
                                          };
                                }
                            }

                            tran.Commit();
                        }
                        catch (Exception ex)
                        {
                            tran.Rollback();
                            throw new APIException(ex.Message);
                        }
                    }
                }
            }
            #endregion
            rsp = new SuccessResponse <IAPIResponseData>(rd);
            return(rsp.ToJSON());
        }
コード例 #14
0
        /// <summary>
        /// 登录Action。
        ///1. 验证用户信息
        ///2. 登录
        // 登录: 1)如果登录成功,验证则调用云通讯接口:创建子账号。 并将返回的信息保存在(2050用户与第三方用户关联表TUserThirdPartyMapping)TUserThirdPartyMapping中,
        //
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        private string Login(string reqContent)
        {
            var rd = new APIResponse <UserInfoRD>();

            try
            {
                var rp = reqContent.DeserializeJSONTo <APIRequest <UserInfoRP> >();
                if (rp.Parameters != null)
                {
                    rp.Parameters.Validate();
                }
                var       loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
                T_UserBLL bll = new T_UserBLL(loggingSessionInfo);
                DataSet   ds  = bll.GetUserInfoByEmail(rp.Parameters.Email);
                if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    var user = DataTableToObject.ConvertToList <T_UserEntity>(ds.Tables[0]).FirstOrDefault();
                    if (user.user_password.Equals(MD5Helper.Encryption(rp.Parameters.Password)))  //
                    {
                        var userID = user.user_id;
                        //验证是否在第三方注册
                        TUserThirdPartyMappingBLL    tutpmBll   = new TUserThirdPartyMappingBLL(loggingSessionInfo);
                        TUserThirdPartyMappingEntity tutpmEntiy = tutpmBll.GetByID(userID);

                        UserViewModel userinfo = null;
                        if (tutpmEntiy == null)
                        {
                            ThirdUserViewModel  token   = null;
                            CloudRequestFactory factory = new CloudRequestFactory();
                            //调用云通讯创建子账户
                            Dictionary <string, object> retData = factory.CreateSubAccount("sandboxapp.cloopen.com", "8883", "ff8080813bbcae3f013bcc39c18a0022", "8f32e2023d804e1390a3b0b8b36d6e28", "aaf98f893e7df943013e8728b2b400c7", "user1234544rr656678");
                            string jsonData = getDictionaryData(retData);
                            token = CWHelper.Deserialize <ThirdUserViewModel>(jsonData);
                            if (token.statusCode == MessageStatusCode.Success)
                            {
                                tutpmEntiy = CreateThirdUser(tutpmEntiy, token, userID);
                                tutpmBll.Create(tutpmEntiy);
                            }

                            userinfo = new UserViewModel
                            {
                                UserID      = userID,
                                VoipAccount = token.SubAccount.voipAccount,
                                UserName    = user.user_name,
                                UserImgURL  = ""
                            };
                        }

                        var rdData = new UserInfoRD();
                        rdData.UserInfo = userinfo;
                        rd.Data         = rdData;
                        rd.Message      = "登录成功";
                    }
                    else
                    {
                        rd.ResultCode = 300;
                        rd.Message    = "密码错误";
                    }
                }
                else
                {
                    rd.ResultCode = 300;
                    rd.Message    = "邮箱不存在";
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(rd.ToJSON());
        }
コード例 #15
0
        public string ModifyUserPersonalInfo(string pRequest)
        {
            var rd     = new APIResponse <ModifyUserPersonalInfoRD>();
            var rdData = new ModifyUserPersonalInfoRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <ModifyUserPersonalInfoRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = new LoggingSessionManager().CurrentSession;

            try
            {
                T_UserBLL    bll    = new T_UserBLL(loggingSessionInfo);
                T_UserEntity entity = bll.GetUserEntityByID(rp.Parameters.UserID);
                if (entity != null)
                {
                    entity.user_code      = rp.Parameters.UserCode;
                    entity.user_name      = rp.Parameters.UserName;
                    entity.user_gender    = rp.Parameters.UserGender;
                    entity.user_email     = rp.Parameters.UserEmail;
                    entity.user_telephone = rp.Parameters.UserTelephone;
                    //entity.user_status = rp.Parameters.UserStatus;

                    if (!string.IsNullOrEmpty(rp.Parameters.UserNameEn))
                    {
                        entity.user_name_en = rp.Parameters.UserNameEn;
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.UserBirthday))
                    {
                        entity.user_birthday = rp.Parameters.UserBirthday;
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.UserPassword))
                    {
                        entity.user_password = MD5Helper.Encryption(rp.Parameters.UserPassword);
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.UserCellphone))
                    {
                        entity.user_cellphone = rp.Parameters.UserCellphone;
                    }
                    if (!string.IsNullOrEmpty(rp.Parameters.FailDate))
                    {
                        entity.fail_date = rp.Parameters.FailDate;
                    }

                    bll.Update(entity);

                    //更新LineManagerID
                    UserDeptJobMappingBLL    mappingBll    = new UserDeptJobMappingBLL(loggingSessionInfo);
                    UserDeptJobMappingEntity mappingEntity = mappingBll.GetByUserID(entity.user_id);
                    if (mappingEntity != null)
                    {
                        if (!string.IsNullOrEmpty(rp.Parameters.LineManagerID))
                        {
                            mappingEntity.LineManagerID = rp.Parameters.LineManagerID;
                        }
                        if (!string.IsNullOrEmpty(rp.Parameters.UnitID))
                        {
                            mappingEntity.UnitID = rp.Parameters.UnitID;
                        }
                        if (!string.IsNullOrEmpty(rp.Parameters.JobFunctionID))
                        {
                            mappingEntity.JobFunctionID = rp.Parameters.JobFunctionID;
                        }
                        mappingBll.Update(mappingEntity);
                    }
                    else
                    {
                        mappingEntity               = new UserDeptJobMappingEntity();
                        mappingEntity.UserID        = entity.user_id;
                        mappingEntity.USERID        = entity.user_id;
                        mappingEntity.LineManagerID = rp.Parameters.LineManagerID;
                        mappingEntity.UnitID        = rp.Parameters.UnitID;
                        mappingEntity.JobFunctionID = rp.Parameters.JobFunctionID;
                        mappingBll.Create(mappingEntity);
                    }
                    rdData.IsSuccess = true;
                    rd.ResultCode    = 0;
                }
                else
                {
                    rdData.IsSuccess = false;
                    rd.ResultCode    = 101;
                    rd.Message       = "用户不存在";
                }
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }
コード例 #16
0
ファイル: EncDecUtil.cs プロジェクト: radtek/crm
 /// <summary>
 /// 获取加密密钥
 /// </summary>
 /// <param name="pOriginalKey">原始密钥</param>
 /// <returns></returns>
 public static string GetEncryptKey(string pOriginalKey)
 {
     return(MD5Helper.Encryption(pOriginalKey).ToLower().Substring(0, 24));
     //return MD5Helper.Encryption(pOriginalKey).ToLower();
 }
コード例 #17
0
        /// <summary>
        /// 创建潜在分经销商
        /// </summary>
        /// <param name="loggingSessionInfo">loggingSessionInfo</param>
        /// <param name="vip_no">vip_no</param>
        public void CreatePrepRetailTrader(LoggingSessionInfo loggingSessionInfo, string vip_no)
        {
            VipEntity       vipEntity       = new VipBLL(loggingSessionInfo).GetVipDetailByVipID(vip_no);
            RetailTraderDAO retailTraderDao = new RetailTraderDAO(loggingSessionInfo);

            if (vipEntity == null || string.IsNullOrWhiteSpace(vipEntity.Col20))
            {
                return;
            }

            /// 判断当前vip会员手机号是否存在经销记录
            var entiryList = this.QueryByEntity(new RetailTraderEntity()
            {
                RetailTraderLogin = vipEntity.Phone
            }, null);

            if (entiryList != null && entiryList.Length > 0)
            {
                return;
            }

            t_unitEntity unitEntity = new t_unitBLL(loggingSessionInfo).GetMainUnit(loggingSessionInfo.ClientID);

            int RetailTraderCode = getMaxRetailTraderCode(loggingSessionInfo.ClientID);

            RetailTraderEntity pEntity = new RetailTraderEntity();

            pEntity.RetailTraderID      = Guid.NewGuid().ToString();
            pEntity.RetailTraderType    = "MultiLevelSaler";
            pEntity.RetailTraderCode    = RetailTraderCode + 1;
            pEntity.RetailTraderName    = vipEntity.VipName;
            pEntity.RetailTraderLogin   = vipEntity.Phone;
            pEntity.RetailTraderPass    = MD5Helper.Encryption("888888");
            pEntity.SalesType           = "";
            pEntity.RetailTraderMan     = "";
            pEntity.RetailTraderPhone   = vipEntity.Phone;
            pEntity.RetailTraderAddress = "";
            pEntity.CooperateType       = "";
            pEntity.SellUserID          = "";
            pEntity.UnitID = unitEntity.unit_id;

            pEntity.MultiLevelSalerFromVipId = vip_no;
            if (!string.IsNullOrEmpty(vipEntity.Col20))
            {
                pEntity.HigheRetailTraderID = vipEntity.Col20;
            }
            pEntity.CreateTime     = DateTime.Now;;
            pEntity.CreateBy       = "sys";
            pEntity.LastUpdateBy   = "sys";
            pEntity.LastUpdateTime = DateTime.Now;
            pEntity.IsDelete       = 0;
            pEntity.CustomerId     = loggingSessionInfo.ClientID;
            pEntity.Status         = "2";
            retailTraderDao.Create(pEntity);
            this.Create2Ap(pEntity);//ap库里的RetailTraderID和商户里的RetailTraderID是一样的

            new ObjectImagesBLL(loggingSessionInfo).SaveRetailTraderHeadImg(vipEntity, pEntity);

            // todo
            CommonBLL commonBll = new CommonBLL();
            string    content   = "您的帐号:" + pEntity.RetailTraderLogin + ",密码:888888,已经在连锁掌柜注册成功,请在地址http://app.chainclouds.com/download/chengguo/下载一起发码APP,早下载早成为经销商赚钱";

            JIT.CPOS.BS.Entity.WX.SendMessageEntity messageEntity = new JIT.CPOS.BS.Entity.WX.SendMessageEntity();
            messageEntity.content = content;
            messageEntity.touser  = vipEntity.WeiXinUserId;
            messageEntity.msgtype = "text";
            WApplicationInterfaceEntity[] wApplicationInterfaceEntities = new WApplicationInterfaceBLL(loggingSessionInfo).QueryByEntity(new WApplicationInterfaceEntity {
                CustomerId = loggingSessionInfo.ClientID
            }, null);
            commonBll.SendMessage(messageEntity, wApplicationInterfaceEntities[0].AppID, wApplicationInterfaceEntities[0].AppSecret, loggingSessionInfo);
        }