protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();

        strLog.AppendFormat("OpenBestToneAccount:Page_Load");
        ParseSPTokenRequest();


        //if (!IsPostBack)
        //{

        if (Result == 0)
        {
            int QueryResult = 0;
            strLog.AppendFormat(String.Format("CustID:{0},SPID{1},HeadFooter:{2},ReturnUrl:{3}", CustID, SPID, HeadFooter, ReturnUrl));
            this.myCustID.Value         = CustID;
            this.myReturnUrl.Value      = ReturnUrl;
            this.HiddenField_SPID.Value = SPID;
            if ("yes".Equals(HeadFooter))
            {
                this.header.Visible = true;
                this.footer.Visible = true;
            }
            else
            {
                this.header.Visible = false;
                this.footer.Visible = false;
            }

            phones = CustBasicInfo.getPhoneRecord(CustID, out QueryResult, out ErrMsg);         //默认行为: 取出登录用户的认证手机作为开户账户号,可能为多个,需用户选择
            if (QueryResult == 0 && phones != null && phones.Length > 0)
            {
                strLog.AppendFormat("getPhoneRecord成功!");
                phoneNum = phones[0].Phone;
                if (!IsPostBack)
                {
                    this.mobile.Text = phoneNum;
                }
                this.hidCheckMobile.Value = phoneNum;
                //this.contactTel.Text = phoneNum;
                strLog.AppendFormat(String.Format("phoneNum:{0}", phoneNum));
            }
            else
            {
                strLog.AppendFormat(String.Format("ErrMsg:{0}", ErrMsg));
                if (!IsPostBack)
                {
                    this.mobile.Text = "";
                }
            }
        }
        else
        {
            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
        }

        //}

        log(strLog.ToString());
    }
Beispiel #2
0
    public void ExistUser()
    {
        //调用用户验证函数
        string UserName = HttpUtility.HtmlDecode(Request.QueryString["UserName"].ToString().Trim());

        Result = CustBasicInfo.IsExistUser(UserName);
        Response.Write(Result);
    }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            TokenValidate.Validate();
            if (CommonBizRules.IsUrlParams(HttpContext.Current.Request.Url.OriginalString))
            {
                if (Request.QueryString["SPID"] != null)
                {
                    SPID = Request.QueryString["SPID"].ToString();
                    //  ReturnUrl = Request.QueryString["ReturnUrl"].ToString();
                }
                else
                {
                    SPID = "35000000";
                }
                //SPID = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());
                //ReturnUrl = HttpUtility.HtmlDecode(Request.QueryString["ReturnUrl"].ToString());
            }

            CustID = TokenValidate.CustID;
            string UserAccount = "";

            try
            {
                string ReturnUrl = HttpUtility.HtmlDecode(Request.QueryString["ReturnUrl"].ToString());
                PageUtility.SetCookie(ReturnUrl, "ReferrerUrl", this.Page);
                //string url = Page.Request.UrlReferrer.ToString();5
                //PageUtility.SetCookie(url, "ReferrerUrl", this.Page);
            }
            catch (System.Exception ex)
            { }
            int Result = CustBasicInfo.GetUserAccount(CustID, out UserAccount, out ErrMsg);
            if (Result == 0)
            {
                //判断此人时候有商旅卡号!
                this.Label1.Text    = "您已经申请过商旅卡了,你的商旅卡号为:" + UserAccount;
                this.Label1.Visible = true;
                btnlogin2.Visible   = true;
            }
            else
            {
                Response.Redirect("bizCard2.aspx?id=6&SPID=" + SPID);
            }
        }
    }
Beispiel #4
0
    public MobileServiceResult MobileServiceUserAuth(string Account, string Password)
    {
        MobileServiceResult result = new MobileServiceResult();


        try{
            string[] MobileServiceReturn = new string[3];

            MobileServiceReturn = CustBasicInfo.MobileServiceUserAuthv2(Account, Password);

            result.Result           = int.Parse(MobileServiceReturn[0]);
            result.ErrorDescription = MobileServiceReturn[1];
            result.ORG_ID           = MobileServiceReturn[2];
            result.Flag             = MobileServiceReturn[3];
        }
        catch (System.Exception ex)
        {
            result.Result           = ErrorDefinition.IError_Result_System_UnknowError_Code;
            result.ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + ex.Message;
        }
        finally
        {
            #region WriteLog
            StringBuilder msg = new StringBuilder();
            msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n");
            msg.Append("软终端名片认证服务 " + DateTime.Now.ToString("u") + "\r\n");

            msg.Append(";IP - " + HttpContext.Current.Request.UserHostAddress);
            msg.Append("\r\n");

            msg.Append("处理结果 - " + result.Result);
            msg.Append("; 错误描述 - " + result.ErrorDescription);
            msg.Append("; ORGID - " + result.ORG_ID);

            msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");

            BTUCenterInterfaceLog.CenterForBizTourLog("MobileServiceUserAuth", msg);
            #endregion
        }

        return(result);
    }
    public void updateCustInfo()
    {
        string custid      = HttpUtility.HtmlDecode(Request.QueryString["custid"].ToString());
        string realname    = HttpUtility.HtmlDecode(Request.QueryString["realname"].ToString());
        string nickname    = HttpUtility.HtmlDecode(Request.QueryString["nickname"].ToString());
        string certificate = HttpUtility.HtmlDecode(Request.QueryString["certificate"].ToString());
        string certno      = HttpUtility.HtmlDecode(Request.QueryString["certno"].ToString());
        string sex         = HttpUtility.HtmlDecode(Request.QueryString["sex"].ToString());
        string birthday    = HttpUtility.HtmlDecode(Request.QueryString["birthday"].ToString());
        string Edu         = HttpUtility.HtmlDecode(Request.QueryString["Edu"].ToString());
        string Income      = HttpUtility.HtmlDecode(Request.QueryString["Income"].ToString());
        string pro         = HttpUtility.HtmlDecode(Request.QueryString["pro"].ToString());
        string area        = HttpUtility.HtmlDecode(Request.QueryString["area"].ToString());
        string spid        = HttpUtility.HtmlDecode(Request.QueryString["spid"].ToString());

        k = CustBasicInfo.UpdateCustInfoById(custid, pro, area, certificate, certno, realname, sex, nickname, DateTime.Now, birthday, Edu, Income, out Msg);
        if (k == 0)
        {
            CIP2BizRules.InsertCustInfoNotify(custid, "2", spid, "", "0", out Msg); // 通知积分商城
            CIP2BizRules.NotifyBesttoneAccountInfo(spid, custid, out Msg);          // 通知融合支付
        }
        Response.Write(k);
    }
Beispiel #6
0
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void ProcessUnifyPlatformReturn()
    {
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID      = Request["SPID"];
            ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            LSID      = Request["LSID"];
            appId     = Request["appId"];
            paras     = Request["paras"];
            sign      = Request["sign"];

            string unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
            string unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];


            strMsg.AppendFormat("【验证参数,DateTime:{0}】:SPID:{1},LSID:{2},ReturnUrl:{3},appId:{4},paras:{5},sign:{6}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, LSID, ReturnUrl, appId, paras, sign);

            string unifyPlatformResponse = CryptographyUtil.XXTeaDecrypt(paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("unifyPlatformResponse:{0}\r\n", unifyPlatformResponse);
            string newsign = CryptographyUtil.HMAC_SHA1(unifyPlatform_appId + paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("newsign:{0},sign:{1}\r\n", newsign, sign);
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if (!newsign.Equals(sign))
            {
                Redirect("ErrMsg", "签名不正确");
            }

            //paras {result,accessToken,timeStamp,userId,productUid,loginNum,nickName,userIconUrl,userIconUrl2,userIconUrl3,isThirdAccount}
            string result         = "";
            string accessToken    = "";
            string timeStamp      = "";
            long   userId         = 0;
            string productUid     = "";
            string loginNum       = "";
            string nickName       = "";
            string userIconUrl    = "";
            string userIconUrl2   = "";
            string userIconUrl3   = "";
            string isThirdAccount = "";


            Dictionary <String, String> parames = new Dictionary <string, string>();
            strMsg.Append("开始解析unifyPlatformResponse\r\n");
            try
            {
                parames = splitParameters(unifyPlatformResponse);
                strMsg.AppendFormat("params:{0}\r\n", parames);
            }
            catch (Exception exp)
            {
                strMsg.AppendFormat(exp.ToString());
            }
            strMsg.Append("解析unifyPlatformResponse完毕\r\n");
            foreach (KeyValuePair <String, String> p in parames)
            {
                if (p.Key.Equals("result"))
                {
                    result = p.Value;
                    strMsg.AppendFormat("result:{0}\r\n", result);
                }
                if (p.Key.Equals("accessToken"))
                {
                    accessToken = p.Value;
                    strMsg.AppendFormat("accessToken:{0}\r\n", accessToken);
                }
                if (p.Key.Equals("timeStamp"))
                {
                    timeStamp = p.Value;
                    strMsg.AppendFormat("timeStamp:{0}\r\n", timeStamp);
                }
                if (p.Key.Equals("userId"))
                {
                    if (!String.IsNullOrEmpty(p.Value))
                    {
                        try
                        {
                            userId = userId = System.Int64.Parse(p.Value);
                        }
                        catch (Exception e)
                        {
                            userId = 0;
                        }
                    }
                    else
                    {
                        userId = 0;
                    }


                    strMsg.AppendFormat("userId:{0}\r\n", userId);
                }
                if (p.Key.Equals("productUid"))
                {
                    productUid = p.Value;
                    strMsg.AppendFormat("productUid:{0}\r\n", productUid);
                }
                if (p.Key.Equals("loginNum"))
                {
                    loginNum = p.Value;
                    strMsg.AppendFormat("loginNum:{0}\r\n", loginNum);
                }
                if (p.Key.Equals("nickName"))
                {
                    nickName = p.Value;
                    strMsg.AppendFormat("nickName:{0}\r\n", nickName);
                }
                if (p.Key.Equals("userIconUrl"))
                {
                    userIconUrl = p.Value;
                    strMsg.AppendFormat("userIconUrl:{0}\r\n", userIconUrl);
                }
                if (p.Key.Equals("userIconUrl2"))
                {
                    userIconUrl2 = p.Value;
                    strMsg.AppendFormat("userIconUrl2:{0}\r\n", userIconUrl2);
                }
                if (p.Key.Equals("userIconUrl3"))
                {
                    userIconUrl3 = p.Value;
                    strMsg.AppendFormat("userIconUrl3:{0}\r\n", userIconUrl3);
                }
                if (p.Key.Equals("isThirdAccount"))
                {
                    isThirdAccount = p.Value;
                    strMsg.AppendFormat("isThirdAccount:{0}\r\n", isThirdAccount);
                }
            }
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            #endregion

            #region 开始注册到号百
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if ("0".Equals(result) && !String.IsNullOrEmpty(accessToken) && !String.IsNullOrEmpty(loginNum))
            {
                String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                CustID = String.Empty;
                Regex  regMobile  = new Regex(@"^1[345678]\d{9}$");
                Regex  regEmail   = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                String MobileName = String.Empty;
                String EmailName  = String.Empty;
                RealName = loginNum;
                if (regMobile.IsMatch(loginNum))
                {
                    MobileName = loginNum;
                }

                if (regEmail.IsMatch(loginNum))
                {
                    EmailName = loginNum;
                }
                String EncrytpPassWord = CryptographyUtil.Encrypt("123456");
                String OperType        = "2"; //1注册、2登录、3单点登录、4帐号提升

                if (!String.IsNullOrEmpty(loginNum))
                {
                    strMsg.Append("【开始注册或绑定到号百】:\r\n");
                    Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, userId, SPID, OperType, out CustID, out ErrMsg);
                    strMsg.Append("【开始注册或绑定到号百的结果】:\r\n");
                    strMsg.AppendFormat("Result:{0},CustID:{1}<->UsesrID:{2},ErrMsg:{3}\r\n", Result, CustID, userId, ErrMsg);

                    //注册成功,种下cookie
                    if (Result == 0)
                    {
                        Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                           out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                           out AreaID, out RegistrationSource);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:客户不存在" + CustID);
                            //客户不存在
                            Redirect("ErrMsg", "客户不存在");
                        }

                        //登录tab写入cookie
                        PageUtility.SetCookie("LoginTabCookie", "UDBTab", 8760);

                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        //生成Ticket
                        ticket = CommonBizRules.CreateTicket();
                        if (userId != null && userId != 0)
                        {
                            OuterID = "123456";
                        }
                        Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", Convert.ToString(userId), "42", out ErrMsg);
                        //insertAccessToken

                        if ((userId != 0) && !String.IsNullOrEmpty(CustID) && !String.IsNullOrEmpty(loginNum))
                        {
                            strMsg.Append("记录AccessToken\r\n");
                            strMsg.AppendFormat("CustID:{0}<->AccessToken:{1}\r\n", CustID, accessToken);
                            String Description = "web登录";
                            Result = CIP2BizRules.InsertAccessToken(SPID, HttpContext.Current.Request.UserHostAddress.ToString(), accessToken, Convert.ToString(userId), CustID, RealName, NickName, loginNum, OperType, Description, out ErrMsg);
                            strMsg.AppendFormat("InsertAccessToken:Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
                        }
                        else
                        {
                            strMsg.Append("因为CustID为空,导致AccessToken无法记录,可能是绑定失败的原因\r\n");
                        }
                        strMsg.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:Ticket生成失败" + ticket);
                            Redirect("ErrMsg", "Ticket生成失败");
                        }
                        strMsg.Append(",Message:生成ticket成功,返回业务系统\r\n");
                        ReturnUrl = Request["ReturnUrl"];
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);
                    }
                    else
                    {
                        strMsg.Append("绑定失败\r\n");
                    }
                }
                else
                {
                    Result = -7766;
                    ErrMsg = "loginNum为空,所以绑定或注册号百客户";
                    strMsg.Append("loginNum为空,所以绑定或注册号百客户\r\n");
                }
                strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            }

            //下面删掉一大段

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
Beispiel #7
0
    protected void UnifyAccountCheck()
    {
        StringBuilder strLog = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            SPID        = Request["SPID"];
            ReturnUrl   = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            AccessToken = Request["accessToken"];
            appId       = Request["appId"];
            paras       = Request["paras"];
            sign        = Request["sign"];
            strLog.AppendFormat("SPID:{0},ReturnUrl:{1},appId:{2},paras:{3},sign:{4},AccessToken:{5}\r\n", SPID, ReturnUrl, appId, paras, sign, AccessToken);
            //查综合平台客户信息
            strLog.Append("查询综合平台客户信息\r\n");
            if (!String.IsNullOrEmpty(AccessToken))
            {
                UnifyAccountInfo accountInfo = new UnifyAccountInfo();
                String           clientIp    = System.Configuration.ConfigurationManager.AppSettings["CIP2_clientIp"];//? 通过f5出去的,这样获得地址不对
                if (String.IsNullOrEmpty(clientIp))
                {
                    clientIp = Request.UserHostAddress;
                }

                String clientAgent                = Request.UserAgent;
                String unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
                String unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];
                String p_version    = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;                 //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_version"];
                String p_clientType = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
                Result = _UDBMBoss.UnifyPlatformGetUserInfo(unifyPlatform_appId, unifyPlatform_appSecretKey, p_version, p_clientType, AccessToken, clientIp, clientAgent, out accountInfo, out ErrMsg);
                strLog.AppendFormat("查询综合平台返回:Result:{0},ErrMsg:{1},UserID:{2}\r\n", Result, ErrMsg, Convert.ToString(accountInfo.userId));
                if (Result == 0 && !String.IsNullOrEmpty(Convert.ToString(accountInfo.userId)))  //这个地方跟登录回来不一致,登录回来是根据loginnum去匹配
                {
                    ///////////////
                    #region 开始注册到号百
                    String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                    CustID = String.Empty;
                    Regex  regMobile  = new Regex(@"^1[345678]\d{9}$");
                    Regex  regEmail   = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                    String MobileName = String.Empty;
                    String EmailName  = String.Empty;

                    if (!String.IsNullOrEmpty(accountInfo.nickName))
                    {
                        RealName = accountInfo.nickName;
                    }
                    else if (!String.IsNullOrEmpty(accountInfo.userName))
                    {
                        RealName = accountInfo.userName;
                    }
                    else if (!String.IsNullOrEmpty(accountInfo.mobileName))
                    {
                        RealName = accountInfo.mobileName;
                    }
                    else if (!String.IsNullOrEmpty(accountInfo.emailName))
                    {
                        RealName = accountInfo.emailName;
                    }
                    else
                    {
                        RealName = "";
                    }

                    if (!String.IsNullOrEmpty(accountInfo.mobileName))
                    {
                        MobileName = accountInfo.mobileName;
                    }

                    if (!String.IsNullOrEmpty(accountInfo.emailName))
                    {
                        EmailName = accountInfo.emailName;
                    }

                    String EncrytpPassWord = CryptographyUtil.Encrypt("123456"); //通过页面注册进来的,不知道密码,给一个默认密码
                    //通过统一注册页面过来的,注册为号百的 “非认证用户”,通过语音注册进来的,注册为号百的 “认证用户”
                    String OperType = "1";                                       // 注册 ,
                    if (!String.IsNullOrEmpty(MobileName) || !String.IsNullOrEmpty(EmailName))
                    {
                        strLog.Append("【开始注册或者绑定到号百】:\r\n");
                        Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);
                        strLog.Append("【开始注册或者绑定到号百的结果】:\r\n");
                        strLog.AppendFormat("Result:{0},CustID:{1},ErrMsg:{2}\r\n", Result, CustID, ErrMsg);
                        //注册成功
                        if (Result == 0)
                        {
                            Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                               out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                               out AreaID, out RegistrationSource);
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            if (Result != 0)
                            {
                                strLog.Append(",ErrMsg:客户不存在" + CustID);
                                Redirect("ErrMsg", "客户不存在");
                            }
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            //生成Ticket
                            ticket = CommonBizRules.CreateTicket();
                            Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", Convert.ToString(accountInfo.userId), "42", out ErrMsg);
                            //insertAccessToken
                            strLog.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            if (Result != 0)
                            {
                                strLog.Append(",ErrMsg:Ticket生成失败" + ticket);
                                Redirect("ErrMsg", "Ticket生成失败");
                            }
                            strLog.Append(",Message:生成ticket成功,返回业务系统\r\n");
                            ReturnUrl = Request["ReturnUrl"];
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            strLog.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);
                            Response.Redirect(ReturnUrl, false);
                        }
                    }
                    else
                    {
                        Result = -7766;
                        ErrMsg = "MobileName,或者EmailName为空,所以不注册号百客户";
                        strLog.Append("MobileName,或者EmailName为空,所以不注册号百客户\r\n");
                        Redirect("ErrMsg", "MobileName,或者EmailName为空,所以不注册号百客户");
                    }
                    strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    //下面删掉一大段
                    #endregion
                    //////////////
                }
                else
                { //查询综合平台客户信息失败,或者account.userid为空
                    strLog.Append("查询综合平台客户信息失败,或者account.userid为空\r\n");
                    Redirect("ErrMsg", "查询综合平台客户信息失败,或者account.userid为空");
                }
            }
            else
            { //accesstoken没有返回
                strLog.Append("综合平台accesstoken没有返回\r\n");
                Redirect("ErrMsg", "综合平台accesstoken没有返回户");
            }
        }
        catch (Exception e)
        {
            strLog.AppendFormat("异常:{0}\r\n", e.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
    public String QueryCustHeadPicInfo(String SPID, String CustID)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;


        #region 数据校验

        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion


        #region  查询

        String HeadPic       = String.Empty;
        Int32  HeadPicLength = 0;
        //CustID = "117663910";
        try
        {
            Result = CustBasicInfo.GetCustHeadPicMLength(CustID, out HeadPicLength, out ErrMsg);
            if (Result == 0)
            {
                Result = CustBasicInfo.GetCustHeadPicInfoM(CustID, HeadPicLength, out HeadPic, out ErrMsg);
            }


            ResponseMsg.Length = 0;
            if (Result == 0)
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\",", ErrMsg);
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    ResponseMsg.AppendFormat("\"HeadPic\":\"{0}\"", HeadPic);
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<CustID>{0}</CustID>", CustID);
                    ResponseMsg.AppendFormat("<HeadPic>{0}</HeadPic>", HeadPic);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
            else
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "970");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg);
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "970");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
        }
        catch (Exception exp)
        {
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
        }



        #endregion
        return(ResponseMsg.ToString());
    }
Beispiel #9
0
    public String RegisterInLowstingHttp(String SPID, String UserName, String PassWord, String PassWord2, String Device, String ShareCode, String wt)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(UserName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AuthenCode))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        String t_CustID = String.Empty;
        String msg      = String.Empty;
        int    k        = PhoneBO.SelSendSMSMassage(t_CustID, UserName, AuthenCode, out msg);
        if (k != 0)
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证码不正确!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码不正确!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        String regMobile = @"^1[345678]\d{9}$";
        //String regEmail = @"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$";
        //String RegularUserName = @"^[a-zA-Z][a-zA-Z0-9]*([-._]?[a-zA-Z0-9]+)*$";
        if (!ValidateUserName(UserName, regMobile))
        //if (!ValidateUserName(UserName, RegularUserName))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "991");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName只能是手机号码!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "991");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName只能是手机号码!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(PassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord2不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord2不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (!PassWord.Equals(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码不一致!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码不一致!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion

        String appId       = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;
        String appSecret   = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret;
        String version     = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;
        String clientType  = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
        String clientIp    = HttpContext.Current.Request.UserHostAddress;
        String clientAgent = HttpContext.Current.Request.UserAgent;
        String sendSms     = UDBConstDefinition.DefaultInstance.UnifyPlatformRegisterAccountSendSms;
        if (String.IsNullOrEmpty(sendSms))
        {
            sendSms = "false";
        }

        //综合平台隐式注册只支持手机,也就是说,用户名模式,放弃注册为天翼账号,仅注册为号百用户
        //既有用户名又有手机的,放弃注册天翼账号
        String Unify_ErrMsg = String.Empty;
        String userId       = String.Empty;
        String o_userName   = String.Empty;
        String accessToken  = String.Empty;
        //msg.AppendFormat("注册天翼账号:\r\n");
        int Unify_Result = CIP2BizRules.RegisterUnifyPlatformAccount(appId, appSecret, version, clientType, clientIp, clientAgent, UserName, PassWord, sendSms, out userId, out o_userName, out accessToken, out Unify_ErrMsg);
        //msg.AppendFormat("注册天翼账号,Result:{0},accessToken:{1},userId:{2},usrName:{3},ErrMsg:{4}\r\n", Unify_Result, accessToken, userId, o_userName, Unify_ErrMsg);


        if (Unify_Result == 0 && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(accessToken))
        {
            //Result = UserRegistry.UserRegisterWebLowStintV3(SPID, UserName, PassWord, Device, ShareCode, out CustID, out ErrMsg);
            UDBMBOSS         _UDBMBoss   = new UDBMBOSS();
            UnifyAccountInfo accountInfo = new UnifyAccountInfo();
            Unify_Result = _UDBMBoss.UnifyPlatformGetUserInfo(appId, appSecret, version, clientType, accessToken, clientIp, clientAgent, out accountInfo, out Unify_ErrMsg);
            String OuterID, Status, CustType, CustLevel, NickName, Email, CertificateCode, CertificateType, Sex, RealName, EnterpriseID, ProvinceID, AreaID, RegistrationSource;

            if (Unify_Result == 0 && !String.IsNullOrEmpty(Convert.ToString(accountInfo.userId)))
            {
                String MobileName = String.Empty;
                String EmailName  = String.Empty;
                if (!String.IsNullOrEmpty(accountInfo.nickName))
                {
                    RealName = accountInfo.nickName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.userName))
                {
                    RealName = accountInfo.userName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.mobileName))
                {
                    RealName = accountInfo.mobileName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.emailName))
                {
                    RealName = accountInfo.emailName;
                }
                else
                {
                    RealName = "";
                }
                if (!String.IsNullOrEmpty(accountInfo.mobileName))
                {
                    MobileName = accountInfo.mobileName;
                }
                if (!String.IsNullOrEmpty(accountInfo.emailName))
                {
                    EmailName = accountInfo.emailName;
                }
                String EncrytpPassWord = CryptographyUtil.Encrypt(PassWord);
                String OperType        = "2"; // 注册 ,

                if (!String.IsNullOrEmpty(MobileName) || !String.IsNullOrEmpty(EmailName))
                {
                    CustID = String.Empty;

                    Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);

                    if (Result == 0 && !String.IsNullOrEmpty(CustID))
                    {
                        Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                           out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                           out AreaID, out RegistrationSource);
                        CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, Request.UserHostAddress.ToString(), "client_zc");

                        String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=" + Device + "&registerCustId=" + CustID;
                        String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                        System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                        //{"returnCode":"00000"}
                        string youhuiquan = "";
                        resuzt.TryGetValue("returnCode", out youhuiquan);
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                            ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                            ResponseMsg.AppendFormat("\"returnCode\":\"{0}\",", youhuiquan);
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册成功!");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<CustID>{0}</CustID>", CustID);
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册成功!");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }
                else
                {
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-11");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "MobileName或EmailName为空不能注册天翼账号所以号百注册也失败!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-11");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "MobileName或EmailName为空不能注册天翼账号所以号百注册也失败!!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
                //http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=ios&registerCustId=134664179
                //"http://116.228.55.13:8113/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=ios&registerCustId=
            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "号百账号注册失败!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-10");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "号百账号注册失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        else
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "天翼账号注册失败!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-10");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "天翼账号注册失败!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Beispiel #10
0
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void ProcessUnifyPlatformReturn()
    {
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID      = Request["SPID"];
            ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            LSID      = Request["LSID"];
            appId     = Request["appId"];
            paras     = Request["paras"];
            sign      = Request["sign"];

            string unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
            string unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];


            strMsg.AppendFormat("【验证参数,DateTime:{0}】:SPID:{1},LSID:{2},ReturnUrl:{3},appId:{4},paras:{5},sign:{6}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, LSID, ReturnUrl, appId, paras, sign);

            string unifyPlatformResponse = CryptographyUtil.XXTeaDecrypt(paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("unifyPlatformResponse:{0}\r\n", unifyPlatformResponse);
            string newsign = CryptographyUtil.HMAC_SHA1(unifyPlatform_appId + paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("newsign:{0},sign:{1}\r\n", newsign, sign);
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if (!newsign.Equals(sign))
            {
                Redirect("ErrMsg", "签名不正确");
            }

            //paras {result,accessToken,timeStamp,userId,productUid,loginNum,nickName,userIconUrl,userIconUrl2,userIconUrl3,isThirdAccount}
            string result         = "";
            string accessToken    = "";
            string timeStamp      = "";
            string userId         = "";
            string productUid     = "";
            string loginNum       = "";
            string nickName       = "";
            string userIconUrl    = "";
            string userIconUrl2   = "";
            string userIconUrl3   = "";
            string isThirdAccount = "";


            Dictionary <String, String> parames = new Dictionary <string, string>();
            strMsg.Append("开始解析unifyPlatformResponse\r\n");
            try
            {
                parames = splitParameters(unifyPlatformResponse);
                strMsg.AppendFormat("params:{0}\r\n", parames);
            }
            catch (Exception exp)
            {
                strMsg.AppendFormat(exp.ToString());
            }
            strMsg.Append("解析unifyPlatformResponse完毕\r\n");
            foreach (KeyValuePair <String, String> p in parames)
            {
                if (p.Key.Equals("result"))
                {
                    result = p.Value;
                    strMsg.AppendFormat("result:{0}\r\n", result);
                }
                if (p.Key.Equals("accessToken"))
                {
                    accessToken = p.Value;
                    strMsg.AppendFormat("accessToken:{0}\r\n", accessToken);
                }
                if (p.Key.Equals("timeStamp"))
                {
                    timeStamp = p.Value;
                    strMsg.AppendFormat("timeStamp:{0}\r\n", timeStamp);
                }
                if (p.Key.Equals("userId"))
                {
                    userId = p.Value;
                    strMsg.AppendFormat("userId:{0}\r\n", userId);
                }
                if (p.Key.Equals("productUid"))
                {
                    productUid = p.Value;
                    strMsg.AppendFormat("productUid:{0}\r\n", productUid);
                }
                if (p.Key.Equals("loginNum"))
                {
                    loginNum = p.Value;
                    strMsg.AppendFormat("loginNum:{0}\r\n", loginNum);
                }
                if (p.Key.Equals("nickName"))
                {
                    nickName = p.Value;
                    strMsg.AppendFormat("nickName:{0}\r\n", nickName);
                }
                if (p.Key.Equals("userIconUrl"))
                {
                    userIconUrl = p.Value;
                    strMsg.AppendFormat("userIconUrl:{0}\r\n", userIconUrl);
                }
                if (p.Key.Equals("userIconUrl2"))
                {
                    userIconUrl2 = p.Value;
                    strMsg.AppendFormat("userIconUrl2:{0}\r\n", userIconUrl2);
                }
                if (p.Key.Equals("userIconUrl3"))
                {
                    userIconUrl3 = p.Value;
                    strMsg.AppendFormat("userIconUrl3:{0}\r\n", userIconUrl3);
                }
                if (p.Key.Equals("isThirdAccount"))
                {
                    isThirdAccount = p.Value;
                    strMsg.AppendFormat("isThirdAccount:{0}\r\n", isThirdAccount);
                }
            }
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            #endregion

            #region 根据UDBTkcket到UDB查询用户信息

            strMsg.Append("【开始查询信息】:");

            UnifyAccountInfo accountInfo = new UnifyAccountInfo();
            String           clientIp    = System.Configuration.ConfigurationManager.AppSettings["CIP2_clientIp"];//? 通过f5出去的,这样获得地址不对
            if (String.IsNullOrEmpty(clientIp))
            {
                clientIp = Request.UserHostAddress;
            }

            String clientAgent = Request.UserAgent;
            ////根据UDBTicket到UDB查询用户信息
            //Result = _UDBMBoss.AccountInfoQuery(UDBSPID, UDBSPID, UDBTicket, UDBKey, out accountInfo, out ErrMsg);
            if ("0".Equals(result) && !String.IsNullOrEmpty(accessToken))
            {
                string p_version    = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_version"];
                string p_clientType = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
                Result = _UDBMBoss.UnifyPlatformGetUserInfo(unifyPlatform_appId, unifyPlatform_appSecretKey, p_version, p_clientType, accessToken, clientIp, clientAgent, out accountInfo, out ErrMsg);
            }

            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            if ("0".Equals(result) && Result == 0)   // 认证成功 并且根据accesstoken查客户信息成功
            {
                String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                //检测对应用户是否在号百系统,不在,则注册进来
                strMsg.Append("【开始注册到号百】:");
                CustID = String.Empty;

                Regex regMobile = new Regex(@"^1[345678]\d{9}$");
                Regex regEmail  = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                Regex regCard   = new Regex(@"^(\d{9}|\d{16})$");

                string AuthenType = "1";
                strMsg.AppendFormat("accountInfo.username:{0}\r\n", accountInfo.userName);
                strMsg.AppendFormat("acountInfo.userId:{0},accountInfo.pUserId:{1}\r\n", accountInfo.userId, accountInfo.pUserId);
                if (regMobile.IsMatch(accountInfo.userName))
                {
                    AuthenType = "2";
                }
                if (regEmail.IsMatch(accountInfo.userName))
                {
                    AuthenType = "4";
                }
                if (regCard.IsMatch(accountInfo.userName))
                {
                    AuthenType = "3";
                }

                if ("2".Equals(AuthenType))
                {
                    //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);
                    String OperType = "1"; // 注册
                    String Password = "";  // 从综合平台注册过来,密码是不知道的
                    RealName = "";
                    Result   = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", accountInfo.mobileName,
                                                                      accountInfo.emailName, RealName, Password, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);
                }
                else
                {
                    Result = -7766;
                }

                //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);

                strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);
                strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                //注册成功
                if (Result == 0)
                {
                    Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                       out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                       out AreaID, out RegistrationSource);
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:客户不存在" + CustID);
                        //客户不存在
                        Redirect("ErrMsg", "客户不存在");
                    }

                    ////登录tab写入cookie
                    //PageUtility.SetCookie("LoginTabCookie", "UDBTab", 8760);

                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    //生成Ticket
                    ticket = CommonBizRules.CreateTicket();
                    Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", Convert.ToString(accountInfo.userId), UDBBusiness.ConvertAuthenType(Convert.ToString(accountInfo.userType)), out ErrMsg);
                    strMsg.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:Ticket生成失败" + ticket);
                        Redirect("ErrMsg", "Ticket生成失败");
                    }
                    strMsg.Append(",Message:生成ticket成功,返回业务系统\r\n");
                    ReturnUrl = Request["ReturnUrl"];
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);

                    //埋综合平台token 6.1 add
                    //String UnifyPlatformCookieName = ConfigurationManager.AppSettings["UnifyPlatformCookieName"];
                    //string AuthenName = UserName;
                    //AuthenType = "2";
                    //SPInfoManager spInfo = new SPInfoManager();
                    //Object SPData = spInfo.GetSPData(this.Context, "SPData");
                    //string key = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                    //UserToken UT = new UserToken();
                    //string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, AuthenName, AuthenType, key, out ErrMsg);
                    //string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                    //PageUtility.SetCookie(UserTokenValue, UnifyPlatformCookieName, this.Page);
                    //埋综合平台token 6.1 end
                }
                else
                {
                    strMsg.Append(",ErrMsg:用户注册到号百失败");
                    Redirect("ErrMsg", "用户注册到号百失败" + ErrMsg);
                }
            }
            else
            {
                strMsg.Append(",ErrMsg:查询用户信息失败");
                Redirect("ErrMsg", "查询用户信息失败");
            }

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
Beispiel #11
0
    public String OneKeyLogin(String imsi)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;

        wt = Request["wt"];   // json or xml


        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        Phone = getMobileSelfReg(imsi);

        if (CommonUtility.IsEmpty(Phone))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", imsi + ":根据imsi号查手机号码失败!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", imsi + ":根据imsi号查手机号码失败!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }



        #endregion

        #region  开始认证
        try
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandTimeout = 15;
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandText    = "dbo.up_Customer_V3_Interface_IsAuthenPhone";

            SqlParameter parSPID = new SqlParameter("@SPID", SqlDbType.VarChar, 8);
            parSPID.Value = SPID;
            cmd.Parameters.Add(parSPID);

            SqlParameter parPhone = new SqlParameter("@Phone", SqlDbType.VarChar, 20);
            parPhone.Value = Phone;
            cmd.Parameters.Add(parPhone);

            SqlParameter parResult = new SqlParameter("@Result", SqlDbType.Int);
            parResult.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(parResult);

            SqlParameter parErrMsg = new SqlParameter("@ErrMsg ", SqlDbType.VarChar, 256);
            parErrMsg.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(parErrMsg);

            SqlParameter parCustID = new SqlParameter("@CustID ", SqlDbType.VarChar, 16);
            parCustID.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(parCustID);

            DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

            Result = int.Parse(parResult.Value.ToString());
            ErrMsg = parErrMsg.Value.ToString();
            CustID = parCustID.Value.ToString();


            if (!String.IsNullOrEmpty(CustID))  // 代表已经注册过,并且有认证手机
            {
                // 根据CustID查询客户信息并返回
                String OuterID         = "";
                String Status          = "";
                String CustLevel       = "";
                String CertificateType = "";
                String Sex             = "";
                String EnterpriseID    = "";
                String ProvinceID      = "";
                String Registration    = "";
                try
                {
                    Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType,
                                                       out CustLevel, out RealName, out UserName, out NickName, out CertificateCode,
                                                       out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID, out AreaID, out Registration);

                    int           QueryResult  = -1;
                    PhoneRecord[] PhoneRecords = CustBasicInfo.getPhoneRecord(CustID, out QueryResult, out ErrMsg);
                    ResponseMsg.Length = 0;
                    if (Result == 0)
                    {
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\",", ErrMsg);
                            ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                            ResponseMsg.AppendFormat("\"Status\":\"{0}\",", Status);
                            ResponseMsg.AppendFormat("\"CustType\":\"{0}\",", CustType);
                            ResponseMsg.AppendFormat("\"CustLevel\":\"{0}\",", CustLevel);
                            ResponseMsg.AppendFormat("\"RealName\":\"{0}\",", RealName);
                            ResponseMsg.AppendFormat("\"UserName\":\"{0}\",", UserName);
                            ResponseMsg.AppendFormat("\"NickName\":\"{0}\",", NickName);
                            ResponseMsg.AppendFormat("\"CertificateCode\":\"{0}\",", CertificateCode);
                            ResponseMsg.AppendFormat("\"CertificateType\":\"{0}\",", CertificateType);
                            ResponseMsg.AppendFormat("\"Sex\":\"{0}\",", Sex);
                            ResponseMsg.AppendFormat("\"Email\":\"{0}\",", Email);
                            ResponseMsg.AppendFormat("\"EnterpriseID\":\"{0}\",", EnterpriseID);
                            ResponseMsg.AppendFormat("\"ProvinceID\":\"{0}\",", ProvinceID);
                            ResponseMsg.AppendFormat("\"AreaID\":\"{0}\",", AreaID);
                            if (QueryResult == 0 && PhoneRecords != null && Registration.Length > 0)
                            {
                                ResponseMsg.AppendFormat("\"Phone\":\"{0}\",", PhoneRecords[0].Phone);
                                ResponseMsg.AppendFormat("\"PhoneClass\":\"{0}\",", PhoneRecords[0].PhoneClass);
                            }
                            ResponseMsg.AppendFormat("\"Registration\":\"{0}\"", Registration);
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }
                catch (Exception ept)
                {
                    // 返回错误信息
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "990");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ept.ToString());
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "990");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ept.ToString());
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
            }
            else // 没有注册过,或者注册过,但未有认证电话 ,因无法根据电话号码是否为认证电话判断客户是否注册过,因此就帮他注册一个(有可能这个用户有用户名但是没有认证手机)
            {
                String T_CustID = String.Empty;
                if (!CommonBizRules.HasBesttoneAccount(this.Context, Phone, out T_CustID, out ErrMsg))
                {
                    if (!String.IsNullOrEmpty(T_CustID))
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "990");
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", Phone + "该手机号码已经被别的客户作为号码百事通账户!");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "990");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", Phone + "该手机号码已经被别的客户作为号码百事通账户!");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }

                #region  开始注册
                try
                {
                    cmd = new SqlCommand();
                    cmd.CommandTimeout = 15;
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "dbo.up_Customer_V3_Interface_UserRegistryClient";

                    parSPID       = new SqlParameter("@SPID", SqlDbType.VarChar, 8);
                    parSPID.Value = SPID;
                    cmd.Parameters.Add(parSPID);

                    SqlParameter parUserType = new SqlParameter("@UserType", SqlDbType.VarChar, 2);
                    parUserType.Value = "42";
                    cmd.Parameters.Add(parUserType);

                    SqlParameter parPassword = new SqlParameter("@Password", SqlDbType.VarChar, 50);
                    parPassword.Value = CryptographyUtil.Encrypt("111111");
                    cmd.Parameters.Add(parPassword);

                    SqlParameter parUProvinceID = new SqlParameter("@UProvinceID", SqlDbType.VarChar, 2);
                    parUProvinceID.Value = "02";
                    cmd.Parameters.Add(parUProvinceID);

                    SqlParameter parAreaCode = new SqlParameter("@AreaCode", SqlDbType.VarChar, 6);
                    parAreaCode.Value = "021";
                    cmd.Parameters.Add(parAreaCode);

                    SqlParameter parRealName = new SqlParameter("@RealName", SqlDbType.VarChar, 50);
                    parRealName.Value = "";
                    cmd.Parameters.Add(parRealName);

                    SqlParameter parUserName = new SqlParameter("@UserName", SqlDbType.VarChar, 50);
                    parUserName.Value = "";
                    cmd.Parameters.Add(parUserName);

                    SqlParameter parAuthenPhone = new SqlParameter("@AuthenPhone", SqlDbType.VarChar, 15);
                    parAuthenPhone.Value = Phone;
                    cmd.Parameters.Add(parAuthenPhone);

                    SqlParameter parEmail = new SqlParameter("@Email", SqlDbType.VarChar, 20);
                    parEmail.Value = "";
                    cmd.Parameters.Add(parEmail);


                    SqlParameter parSex = new SqlParameter("@Sex", SqlDbType.VarChar, 1);
                    parSex.Value = "2";
                    cmd.Parameters.Add(parSex);

                    parResult           = new SqlParameter("@Result", SqlDbType.Int);
                    parResult.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(parResult);

                    parErrMsg           = new SqlParameter("@ErrMsg ", SqlDbType.VarChar, 256);
                    parErrMsg.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(parErrMsg);

                    SqlParameter paroCustID = new SqlParameter("@oCustID ", SqlDbType.VarChar, 16);
                    paroCustID.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(paroCustID);

                    DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

                    Result = int.Parse(parResult.Value.ToString());
                    ErrMsg = parErrMsg.Value.ToString();
                    CustID = paroCustID.Value.ToString();

                    if (Result == 0)    //注册成功
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\",", ErrMsg);
                            ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                            ResponseMsg.AppendFormat("\"Status\":\"{0}\",", "00");
                            ResponseMsg.AppendFormat("\"CustType\":\"{0}\",", "42");
                            ResponseMsg.AppendFormat("\"CustLevel\":\"{0}\",", "3");
                            ResponseMsg.AppendFormat("\"RealName\":\"{0}\",", "");
                            ResponseMsg.AppendFormat("\"UserName\":\"{0}\",", "");
                            ResponseMsg.AppendFormat("\"NickName\":\"{0}\",", "");
                            ResponseMsg.AppendFormat("\"CertificateCode\":\"{0}\",", "");
                            ResponseMsg.AppendFormat("\"CertificateType\":\"{0}\",", "");
                            ResponseMsg.AppendFormat("\"Sex\":\"{0}\",", "2");
                            ResponseMsg.AppendFormat("\"Email\":\"{0}\",", "");
                            ResponseMsg.AppendFormat("\"EnterpriseID\":\"{0}\",", "");
                            ResponseMsg.AppendFormat("\"ProvinceID\":\"{0}\",", "02");
                            ResponseMsg.AppendFormat("\"AreaID\":\"{0}\",", "021");
                            ResponseMsg.AppendFormat("\"Phone\":\"{0}\",", Phone);
                            ResponseMsg.AppendFormat("\"Registration\":\"{0}\"", "");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                    else    //注册失败
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "993");
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册失败!");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "993");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册失败!");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }
                catch (Exception ecp)
                {
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "993");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ecp.ToString());
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "993");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
                #endregion
            }
        }
        catch (Exception exp)
        {
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
        }
        #endregion

        return(ResponseMsg.ToString());
    }
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void BeginUDBSSO()
    {
        logger.Info("unifyplatform call back ...");
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID      = Request["SPID"];
            ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            PassportLoginResponseValue = Request["PassportLoginResponse"];
            strMsg.AppendFormat("从门户过来【验证参数,DateTime:{0}】:SPID:{1},PassportLoginResponse:{2},ReturnUrl:{3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, PassportLoginResponseValue, ReturnUrl);
            UDBKey = System.Configuration.ConfigurationManager.AppSettings["UdbKey"];

            //解析PassportLoginResponseValue
            String[] tempArray = PassportLoginResponseValue.Split('$');
            DesSsDeviceNo = tempArray[0];
            String   tempStr     = CryptographyUtil.Decrypt(tempArray[1], UDBKey);
            String[] digestArray = tempStr.Split('$');
            Result    = Convert.ToInt32(digestArray[0]);
            UDBTicket = digestArray[1];
            String timeStamp = digestArray[2];
            String digest    = digestArray[3];

            String newDigest = CryptographyUtil.ToBase64String(CryptographyUtil.Hash(Result + DesSsDeviceNo + UDBTicket + timeStamp));
            strMsg.AppendFormat(",DesSsDeviceNo:{0},Result:{1},UDBTicket{2},timeStamp:{3},digest:{4},newDigest:{5}\r\n", DesSsDeviceNo, Result, UDBTicket, timeStamp, digest, newDigest);
            if (!digest.Equals(newDigest))
            {
                //digest不吻合,失败
                strMsg.AppendFormat(",ErrMsg:{0}", "digest有误不匹配");
                Redirect("ErrMsg", "digest有误不匹配");
            }
            if (Result != 0)
            {
                //失败,则返回
                strMsg.AppendFormat(",ErrMsg:{0}", "返回Ticket失败");
                Redirect("ErrMsg", "返回Ticket失败");
            }

            #endregion

            #region 根据UDBTkcket到UDB查询用户信息

            strMsg.Append("【开始查询信息】:");

            UDBAccountInfo accountInfo = new UDBAccountInfo();

            //根据UDBTicket到UDB查询用户信息
            //Result = _UDBMBoss.AccountInfoCheck("3500000000408201", "3500000000408201", UDBTicket, UDBKey, out accountInfo, out ErrMsg);
            Result = _UDBMBoss.AccountInfoQuery("3500000000408201", "3500000000408201", UDBTicket, UDBKey, out accountInfo, out ErrMsg);
            accountInfo.SourceSPID = UDBConstDefinition.DefaultInstance.UDBSPID;
            strMsg.AppendFormat(",Result:{0},UserID:{1},UserIDType:{2},UserType:{3},PUserID:{4},Alias:{5},UserIDStatus:{6},UserIDSsStatus:{7},Description:{8},ProvinceID:{9},NumFlag:{10}\r\n",
                                Result, accountInfo.UserID, accountInfo.UserIDType, accountInfo.UserType, accountInfo.PUserID, accountInfo.Alias, accountInfo.UserIDStatus, accountInfo.UserIDSsStatus, accountInfo.Description, accountInfo.ProvinceID, accountInfo.NumFlag);
            if (Result == 0)
            {
                String OuterID, Status, CustType, CustLevel, CertificateType, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                Phone  = accountInfo.UserID;
                Phone1 = accountInfo.PUserID;
                //检测对应用户是否在号百系统,不在,则注册进来
                strMsg.Append("【开始注册到号百】:");
                Result = UserRegistry.getUserRegistryUDB(accountInfo, out CustID, out ErrMsg);
                strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);

                //注册成功
                if (Result == 0)
                {
                    Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                       out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                       out AreaID, out RegistrationSource);

                    logger.Info("CustID=" + CustID + "\r\nOuterID=" + OuterID + "\r\nRealName=" + RealName + "\r\nUserName="******"\r\nNickName=" + NickName);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:客户不存在" + CustID);
                        //客户不存在
                        Redirect("ErrMsg", "客户不存在");
                    }
                    else
                    {
                        if (RealName != null && !"".Equals(RealName))
                        {
                            welcomeName = RealName;
                        }
                        else if (NickName != null && !"".Equals(NickName))
                        {
                            welcomeName = NickName;
                        }
                        else if (UserName != null && !"".Equals(UserName))
                        {
                            welcomeName = UserName;
                        }
                        else
                        {
                            welcomeName = accountInfo.UserID;
                        }

                        if (ReturnUrl.IndexOf("?") > 0)
                        {
                            ReturnUrl = ReturnUrl + "&CustID=" + CustID + "&welcomeName=" + welcomeName + "&UserID=" + accountInfo.UserID + "&PUserID=" + accountInfo.PUserID;
                        }
                        else
                        {
                            ReturnUrl = ReturnUrl + "?CustID=" + CustID + "&welcomeName=" + welcomeName + "&UserID=" + accountInfo.UserID + "&PUserID=" + accountInfo.PUserID;
                        }
                        //Response.Redirect(ReturnUrl, false);
                    }
                }
                else
                {
                    strMsg.Append(",ErrMsg:用户注册到号百失败");
                    //Redirect("ErrMsg", "用户注册到号百失败" + ErrMsg);
                }
            }
            else if (Result == 5)
            {
                strMsg.Append(",ErrMsg:用户已删除");
                //Redirect("ErrMsg", "用户已删除");
            }
            else
            {
                strMsg.Append(",ErrMsg:查询用户信息失败");
                //Redirect("ErrMsg", "查询用户信息失败");
            }

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
Beispiel #13
0
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        UserName = Request.Form["UserName"].ToString().Trim();

        Password = Request.Form["Password"].ToString().Trim();

        Password2 = Request.Form["Password2"].ToString().Trim();

        try
        {
            Result = CustBasicInfo.IsExistUser(UserName);
            if (Result != 0)
            {
                errorHint.InnerHtml = "<script type='text/javascript'>showError('用户名已存在!')</script>";
                return;
            }

            Result = UserRegistry.UserRegisterWebLowStint(SPID, UserName, Password, out CustID, out ErrMsg);

            if (Result == 0)
            {
                // 重定向到欢迎页面

                String IPAddress = Request.UserHostAddress.ToString();
                CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, IPAddress, "client_wap");


                String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToRegist&wt=json&from=" + Device + "&custId=" + CustID;
                String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                //{"returnCode":"00000"}
                string youhuiquan = "";
                resuzt.TryGetValue("returnCode", out youhuiquan);


                String        TimeStamp             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                SPInfoManager spInfo                = new SPInfoManager();
                Object        SPData                = spInfo.GetSPData(this.Context, "SPData");
                String        key                   = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                String        Digest                = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
                String        temp                  = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
                String        RegistryResponseValue = HttpUtility.UrlEncode(temp);

                //给用户写cookie
                UserToken UT             = new UserToken();
                String    RealName       = UserName;
                String    NickName       = UserName;
                string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg);
                string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
                CreateSPTokenRequest();
                StringBuilder URL = new StringBuilder();
                URL.Append("LowSintRegisterMSuccess.aspx?SPID=");
                Response.Redirect(URL.ToString() + SPID + "&SPTokenRequest=" + newSPTokenRequest, true);
            }
            else
            {
                errorHint.InnerHtml = "<script type='text/javascript'>showError('注册失败:" + ErrMsg + "')</script>";
                return;
            }
        }
        catch (Exception exp)
        {
            errorHint.InnerHtml = "<script type='text/javascript'>showError('" + exp.ToString() + "!')</script>";
            return;
        }
    }
    public String ModifyCustInfo(String SPID, String CustID, String RealName, String NickName, String CertificateCode, String CertificateType, String Sex, String Email, String ProvinceID, String AreaID, String Registration, String Birthday, String EduLevel, String IncomeLevel, String Favorite, String Address, String HeadPic)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;
        #region
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(ProvinceID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "ProvinceID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "ProvinceID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AreaID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AreaID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AreaID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(RealName) &&
            CommonUtility.IsEmpty(CertificateCode) &&
            CommonUtility.IsEmpty(CertificateType) &&
            CommonUtility.IsEmpty(Sex))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息参数不能全为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息参数不能全为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        #endregion

        try
        {
            //Result = CustBasicInfo.UpdateCustinfoExtV3(SPID, ProvinceID, AreaID, CustID, RealName, CertificateCode, CertificateType, Birthday, Sex, Email, NickName, EduLevel, IncomeLevel, Favorite, Address, HeadPic, out  ErrMsg);
            //UpdateCustinfoExtV4
            Result = CustBasicInfo.UpdateCustinfoExtV4(SPID, ProvinceID, AreaID, CustID, RealName, CertificateCode, CertificateType, Birthday, Sex, Email, NickName, EduLevel, IncomeLevel, Favorite, Address, HeadPic, out ErrMsg);
            //CustID = "117663910";
            //Result = CustBasicInfo.UpdateCustinfoExtV5(CustID, HeadPic, out ErrMsg);

            if (Result == 0)
            {
                //通知积分平台
                //CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
                // 这里要判断该客户是否已经开过户,如果是开户的,并且修改了身份证的才同步
                //CIP2BizRules.NotifyBesttoneAccountInfo(SPID, CustID, out ErrMsg);   // 通知融合支付

                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息成功!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息成功!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg);
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-989");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        catch (Exception e)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", e.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-989");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", e.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Beispiel #15
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (CertificateType.Value != "")
        {
            certno.Style.Value  = "display:block";
            certnoL.Style.Value = "display:block";
        }
        else
        {
            certno.Style.Value  = "display:none";
            certnoL.Style.Value = "display:none";
        }
        this.areaInfoList.Value = resulttxt.Value.ToString();
        SPID      = Request["SPID"] == null ? ConstHelper.DefaultInstance.BesttoneSPID : HttpUtility.HtmlDecode(Request["SPID"]);
        ReturnUrl = Request["ReturnUrl"] == null ? ConstHelper.DefaultInstance.BesttoneLoginPage : HttpUtility.HtmlDecode(Request["ReturnUrl"]);

        string username = Request.Form["username"].ToString().Trim();
        string fullname = Request.Form["fullname"].ToString().Trim();
        string password = Request.Form["password"].ToString().Trim();

        if (CommonUtility.IsEmpty(password))
        {
            err_password.InnerHtml = "密码不能为空格";
            return;
        }
        string telephone = Request.Form["telephone"].ToString().Trim();
        string phonecode = Request.Form["phone_code"].ToString().Trim();

        if (ViewState["phonestate"] == null)
        {
            ViewState["phonestate"] = Request.Form["phonestate"].ToString();
            string a = (string)ViewState["phonestate"];
        }

        string email            = Request.Form["email"].ToString().Trim();
        string NickName         = Request.Form["NickName"].ToString();
        string CertificateType1 = Request.Form["CertificateType"].ToString();
        string certnoS          = Request.Form["certno"].ToString().Trim();
        string sex         = Request.Form["sex"].ToString();
        string birthday    = Request.Form["birthday"].ToString().Trim();
        string EduLevel    = Request.Form["EduLevel"].ToString().Trim();
        string IncomeLevel = Request.Form["IncomeLevel"].ToString();
        string Province    = stext.Value.ToString();
        string Area        = resulttxt.Value.ToString();
        string ErrMsg      = "";
        int    Result;

        //判断用户名是否存在
        if (CustBasicInfo.IsExistUser(username) != 0)
        {
            err_username.InnerHtml = "该用户名已经存在";

            return;
        }


        if (((string)ViewState["phonestate"]).Equals("0"))
        {
            //判断手机验证码
            Result = PhoneBO.SelSendSMSMassage("", telephone, phonecode, out ErrMsg);
            if (Result != 0)
            {
                err_phone_code.InnerHtml = "手机验证码错误,请重新输入";

                return;
            }

            //判断页面验证码
            if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(Request.Form["page_code"].ToString().Trim().ToUpper()), this.Context))
            {
                err_page_code.InnerHtml = "页面验证码错误,请重新输入";

                return;
            }
        }

        //当为认证邮箱时,判断是否已经被绑定
        if (Chk_Mail.Checked && !CommonUtility.IsEmpty(email))
        {
            Result = SetMail.EmailSel("", email, SPID, out ErrMsg);
            if (Result != 0)
            {
                err_email.InnerHtml = "该邮箱已经被其他用户绑定";

                return;
            }
            emailstate = "0";
        }

        TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        Result    = UserRegistry.getUserRegistryWeb(SPID, username, fullname, password, telephone, (string)ViewState["phonestate"], email, emailstate,
                                                    NickName, CertificateType1, certnoS, sex, birthday, EduLevel, IncomeLevel, Province, Area, out CustID, out ErrMsg);
        if (Result != 0)
        {
            //跳转至错误页面
            if (Result == -30002)
            {
                Err_certno.InnerHtml = ErrMsg;
            }
            else
            {
                CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context);
            }

            return;
        }

        SPInfoManager spInfo = new SPInfoManager();
        Object        SPData = spInfo.GetSPData(this.Context, "SPData");
        string        key    = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);
        string        Digest = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
        string        temp   = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
        string        RegistryResponseValue = HttpUtility.UrlEncode(temp);

        //给用户写cookie
        UserToken UT             = new UserToken();
        string    key2           = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
        string    UserTokenValue = UT.GenerateUserToken(CustID, fullname, username, NickName, "", "42", username, "1", key2, out ErrMsg);
        string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];

        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

        //给客户认证邮箱发EMAIL
        string m   = CommonBizRules.EncryptEmailURl(CustID, email, this.Context);
        string url = "点击完成认证:<a href='" + m + "'>" + m + "</a>";

        if (Chk_Mail.Checked && !CommonUtility.IsEmpty(email))
        {
            DateTime datetime = DateTime.Now;
            SetMail.InsertEmailSendMassage(CustID, "1", url, "", 1, email, datetime, "", "中国电信号码百事通:激活邮箱", 0, out ErrMsg);
        }

        //通知积分平台
        CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
        //记登录日志
        CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg);

        //跳转至成功页面
        if (ReturnUrl.IndexOf("?") > 0)
        {
            CommonBizRules.SuccessRedirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context);
        }
        else
        {
            CommonBizRules.SuccessRedirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context);
        }
    }
    public String QueryCustBasicInfo(String SPID, String CustID)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;

        #region 数据校验

        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }



            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion


        #region  查询
        String OuterID         = String.Empty;
        String Status          = String.Empty;
        String CustType        = String.Empty;
        String CustLevel       = String.Empty;
        String RealName        = String.Empty;
        String UserName        = String.Empty;
        String NickName        = String.Empty;
        String CertificateCode = String.Empty;
        String CertificateType = String.Empty;
        String Sex             = String.Empty;
        String Email           = String.Empty;
        String EnterpriseID    = String.Empty;
        String ProvinceID      = String.Empty;
        String AreaID          = String.Empty;
        String Registration    = String.Empty;


        //扩展字段

        String        Birthday    = String.Empty;
        String        EduLevel    = String.Empty;
        String        IncomeLevel = String.Empty;
        String        Favorite    = String.Empty;
        String        Address     = String.Empty;
        StringBuilder strLog      = new StringBuilder();
        try
        {
            Result = CustBasicInfo.GetCustInfoWithExtendField(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType,
                                                              out CustLevel, out RealName, out UserName, out NickName, out CertificateCode,
                                                              out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID, out AreaID, out Registration,
                                                              out Birthday, out EduLevel, out IncomeLevel, out Favorite, out Address);

            int           QueryPhoneResult = -1;
            String        QueryPhoneErrMSG = String.Empty;
            PhoneRecord[] PhoneRecords     = null;
            String        Mobile           = String.Empty;
            String        PhoneClass       = String.Empty;


            if (Result == 0)
            {
                PhoneRecords = CustBasicInfo.getPhoneRecord(CustID, out QueryPhoneResult, out QueryPhoneErrMSG);
                Result       = QueryPhoneResult;
                ErrMsg       = QueryPhoneErrMSG;
            }

            ResponseMsg.Length = 0;
            if (Result == 0)
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\",", ErrMsg);
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    ResponseMsg.AppendFormat("\"Status\":\"{0}\",", Status);
                    ResponseMsg.AppendFormat("\"CustType\":\"{0}\",", CustType);
                    ResponseMsg.AppendFormat("\"CustLevel\":\"{0}\",", CustLevel);
                    ResponseMsg.AppendFormat("\"RealName\":\"{0}\",", RealName);
                    ResponseMsg.AppendFormat("\"UserName\":\"{0}\",", UserName);
                    ResponseMsg.AppendFormat("\"NickName\":\"{0}\",", NickName);
                    ResponseMsg.AppendFormat("\"CertificateCode\":\"{0}\",", CertificateCode);
                    ResponseMsg.AppendFormat("\"CertificateType\":\"{0}\",", CertificateType);
                    ResponseMsg.AppendFormat("\"Sex\":\"{0}\",", Sex);
                    ResponseMsg.AppendFormat("\"Email\":\"{0}\",", Email);
                    ResponseMsg.AppendFormat("\"EnterpriseID\":\"{0}\",", EnterpriseID);
                    ResponseMsg.AppendFormat("\"ProvinceID\":\"{0}\",", ProvinceID);
                    ResponseMsg.AppendFormat("\"AreaID\":\"{0}\",", AreaID);
                    if (QueryPhoneResult == 0 && PhoneRecords != null && PhoneRecords.Length > 0)
                    {
                        ResponseMsg.AppendFormat("\"Phone\":\"{0}\",", PhoneRecords[0].Phone);
                        ResponseMsg.AppendFormat("\"PhoneClass\":\"{0}\",", PhoneRecords[0].PhoneClass);
                    }
                    ResponseMsg.AppendFormat("\"Birthday\":\"{0}\",", Birthday);
                    ResponseMsg.AppendFormat("\"EduLevel\":\"{0}\",", EduLevel);
                    ResponseMsg.AppendFormat("\"IncomeLevel\":\"{0}\",", IncomeLevel);
                    ResponseMsg.AppendFormat("\"Favorite\":\"{0}\",", Favorite);
                    ResponseMsg.AppendFormat("\"Address\":\"{0}\",", Address);
                    ResponseMsg.AppendFormat("\"Registration\":\"{0}\"", Registration);
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");

                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
            else
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg);
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", Result);
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
        }
        catch (Exception exp)
        {
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
        }
        finally
        {
            //log(strLog.ToString());
        }



        #endregion
        return(ResponseMsg.ToString());
    }
Beispiel #17
0
    public String ModifyCustBasicInfo(string SPID, string CustID, string RealName, string CertificateCode, string CertificateType, string Sex, string Email)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据合法性判断
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }



        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(RealName) &&
            CommonUtility.IsEmpty(CertificateCode) &&
            CommonUtility.IsEmpty(CertificateType) &&
            CommonUtility.IsEmpty(Sex))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息参数不能全为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息参数不能全为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion
        try
        {
            Result = CustBasicInfo.UpdateCustinfo(SPID, CustID, RealName, CertificateCode, CertificateType, Sex, Email, out ErrMsg);
            if (Result == 0)
            {
                //通知积分平台
                CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
                // 这里要判断该客户是否已经开过户,如果是开户的,并且修改了身份证的才同步
                //CIP2BizRules.NotifyBesttoneAccountInfo(SPID, CustID, out ErrMsg);   // 通知融合支付

                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息成功!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息成功!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息失败!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-989");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        catch (Exception exp)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-989");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
    protected void register_Click(object sender, EventArgs e)
    {
        Response.AddHeader("P3P", "CP=CAO PSA OUR");

        UserName = Request.Form["userName"].ToString().Trim();

        PassWord = Request.Form["password"].ToString().Trim();

        PassWord2 = Request.Form["password2"].ToString().Trim();

        checkCode = Request.Form["checkCode"].ToString().Trim();

        String IPAddress = Request.UserHostAddress.ToString();

        System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(Request.Url.AbsoluteUri);
        StringBuilder             sbLog   = new StringBuilder();

        sbLog.AppendFormat("userName:{0}\r\n", UserName);
        sbLog.AppendFormat("password:{0}\r\n", PassWord);
        sbLog.AppendFormat("password2:{0}\r\n", PassWord2);
        sbLog.AppendFormat("checkCode:{0}\r\n", checkCode);
        try
        {
            if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(checkCode), this.Context))
            {
                //hintError提示错误验证码校验未通过
                errorHint.InnerHtml = "验证码校验未通过!";
                sbLog.AppendFormat("验证码校验未通过!");
                return;
            }

            if (!PassWord2.Equals(PassWord))
            {
                errorHint.InnerHtml = "密码不一致!";
                return;
            }

            Result = CustBasicInfo.IsExistUser(UserName);

            if (Result != 0)
            {
                errorHint.InnerHtml = "用户名已经存在!";
                return;
            }

            Result = UserRegistry.UserRegisterWebLowStint(SPID, UserName, PassWord, out CustID, out ErrMsg);

            if (Result == 0)
            {
                //记录注册来源ip地址
                CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, IPAddress, "web_zc");


                if ("35433334".Equals(SPID))
                {
                    String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToRegist&wt=json&from=web&custId=" + CustID;
                    String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                    System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                    //{"returnCode":"00000"}
                    string youhuiquan = "";
                    resuzt.TryGetValue("returnCode", out youhuiquan);
                }


                // 重定向到欢迎页面
                sbLog.AppendFormat("注册成功:{0}\r\n", Result);
                String        TimeStamp             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                SPInfoManager spInfo                = new SPInfoManager();
                Object        SPData                = spInfo.GetSPData(this.Context, "SPData");
                String        key                   = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                String        Digest                = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
                String        temp                  = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
                String        RegistryResponseValue = HttpUtility.UrlEncode(temp);
                sbLog.Append("给用户写Cookie\r\n");
                //给用户写cookie
                UserToken UT             = new UserToken();
                String    RealName       = UserName;
                String    NickName       = UserName;
                string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg);
                string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
                sbLog.Append("创建新的SPTokenRequest\r\n");
                CreateSPTokenRequest();

                StringBuilder URL = new StringBuilder();
                String        RegisterInLowstintSuccessURL = ConfigurationManager.AppSettings["RegisterInLowstintSuccessURL"].ToString(); //// 邮箱指向authenv2.aspx
                if (String.IsNullOrEmpty(RegisterInLowstintSuccessURL))
                {
                    RegisterInLowstintSuccessURL = "RegisterSuccessV2.aspx?SPID=";
                }
                URL.Append(RegisterInLowstintSuccessURL);
                //Response.Redirect(URL.ToString() + SPID + "&ReturnUrl=" + ReturnUrl + "&SPTokenRequest=" + newSPTokenRequest, false);
                //用Redirect 无法从request  的refer 中获得从哪个页面来的

                //     Server.Transfer

                //Server.Transfer方法把执行流程从当前的ASPX文件转到同一服务器上的另一个ASPX页面。调用Server.Transfer时,当前的ASPX页面终止执行,执行流程转入另一个ASPX页面,但新的ASPX页面仍使用前一ASPX页面创建的应答流。

                //如果用Server.Transfer方法实现页面之间的导航,浏览器中的URL不会改变,因为重定向完全在服务器端进行,浏览器根本不知道服务器已经执行了一次页面变换。

                //默认情况下,Server.Transfer方法不会把表单数据或查询字符串从一个页面传递到另一个页面,但只要把该方法的第二个参数设置成True,就可以保留第一个页面的表单数据和查询字符串。

                //同时,使用Server.Transfer时应注意一点:目标页面将使用原始页面创建的应答流,这导致ASP.NET的机器验证检查(Machine    Authentication    Check,MAC)认为新页面的ViewState已被篡改。因此,如果要保留原始页面的表单数据和查询字符串集合,必须把目标页面Page指令的EnableViewStateMac属性设置成False。
                sbLog.Append("重定向:");
                //Response.Redirect(URL.ToString() + SPID + "&ReturnUrl=" + ReturnUrl + "&SPTokenRequest=" + newSPTokenRequest, true);
                Server.Transfer(URL.ToString() + SPID + "&ReturnUrl=" + ReturnUrl + "&SPTokenRequest=" + newSPTokenRequest, true);
            }
            else
            {
                sbLog.AppendFormat("注册失败:{0}\r\n", ErrMsg);
                errorHint.InnerHtml = "注册失败:" + ErrMsg;
                return;
            }
        }
        catch (Exception ex)
        {
            sbLog.Append(ex.Message);
            errorHint.InnerHtml = ex.ToString();
            return;
            //重定向到错误页面
        }
        finally
        {
            log(sbLog.ToString());
        }
    }
Beispiel #19
0
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void BeginUDBSSO()
    {
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID      = Request["SPID"];
            ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            PassportLoginResponseValue = Request["PassportLoginResponse"];
            strMsg.AppendFormat("从门户过来【验证参数,DateTime:{0}】:SPID:{1},PassportLoginResponse:{2},ReturnUrl:{3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, PassportLoginResponseValue, ReturnUrl);


            UDBKey = System.Configuration.ConfigurationManager.AppSettings["UdbKey"];

            //解析PassportLoginResponseValue
            String[] tempArray = PassportLoginResponseValue.Split('$');
            DesSsDeviceNo = tempArray[0];
            String   tempStr     = CryptographyUtil.Decrypt(tempArray[1], UDBKey);
            String[] digestArray = tempStr.Split('$');
            Result    = Convert.ToInt32(digestArray[0]);
            UDBTicket = digestArray[1];
            String timeStamp = digestArray[2];
            String digest    = digestArray[3];

            String newDigest = CryptographyUtil.ToBase64String(CryptographyUtil.Hash(Result + DesSsDeviceNo + UDBTicket + timeStamp));
            strMsg.AppendFormat(",DesSsDeviceNo:{0},Result:{1},UDBTicket{2},timeStamp:{3},digest:{4},newDigest:{5}\r\n", DesSsDeviceNo, Result, UDBTicket, timeStamp, digest, newDigest);
            if (!digest.Equals(newDigest))
            {
                //digest不吻合,失败
                strMsg.AppendFormat(",ErrMsg:{0}", "digest有误不匹配");
                Redirect("ErrMsg", "digest有误不匹配");
            }
            if (Result != 0)
            {
                //失败,则返回
                strMsg.AppendFormat(",ErrMsg:{0}", "返回Ticket失败");
                Redirect("ErrMsg", "返回Ticket失败");
            }

            #endregion

            #region 根据UDBTkcket到UDB查询用户信息

            strMsg.Append("【开始查询信息】:");

            UDBAccountInfo accountInfo = new UDBAccountInfo();

            //根据UDBTicket到UDB查询用户信息
            //Result = _UDBMBoss.AccountInfoCheck("3500000000408201", "3500000000408201", UDBTicket, UDBKey, out accountInfo, out ErrMsg);
            Result = _UDBMBoss.AccountInfoQuery("3500000000408201", "3500000000408201", UDBTicket, UDBKey, out accountInfo, out ErrMsg);
            accountInfo.SourceSPID = UDBConstDefinition.DefaultInstance.UDBSPID;
            strMsg.AppendFormat(",Result:{0},UserID:{1},UserIDType:{2},UserType:{3},PUserID:{4},Alias:{5},UserIDStatus:{6},UserIDSsStatus:{7},Description:{8},ProvinceID:{9},NumFlag:{10}\r\n",
                                Result, accountInfo.UserID, accountInfo.UserIDType, accountInfo.UserType, accountInfo.PUserID, accountInfo.Alias, accountInfo.UserIDStatus, accountInfo.UserIDSsStatus, accountInfo.Description, accountInfo.ProvinceID, accountInfo.NumFlag);
            if (Result == 0)
            {
                String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                //检测对应用户是否在号百系统,不在,则注册进来
                strMsg.Append("【开始注册到号百】:");
                Result = UserRegistry.getUserRegistryUDB(accountInfo, out CustID, out ErrMsg);
                strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);

                //注册成功
                if (Result == 0)
                {
                    Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                       out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                       out AreaID, out RegistrationSource);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:客户不存在" + CustID);
                        //客户不存在
                        Redirect("ErrMsg", "客户不存在");
                    }


                    //登录tab写入cookie
                    PageUtility.SetCookie("LoginTabCookie", "UDBTab", 8760);

                    //生成Ticket
                    String ticket = CommonBizRules.CreateTicket();

                    Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", accountInfo.UserID, UDBBusiness.ConvertAuthenType(accountInfo.NumFlag), out ErrMsg);
                    strMsg.AppendFormat("【生成ticket】:Result:{0},Ticket:{1},ReturnUrl:{2}", Result, ticket, ReturnUrl);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:Ticket生成失败" + ticket);
                        Redirect("ErrMsg", "Ticket生成失败");
                    }
                    strMsg.Append(",Message:生成ticket成功,返回业务系统");


                    Response.Redirect("QuickLogin1.aspx?LoginTicket=" + ticket + "&ReturnUrl=" + ReturnUrl);
                }
                else
                {
                    strMsg.Append(",ErrMsg:用户注册到号百失败");
                    Redirect("ErrMsg", "用户注册到号百失败" + ErrMsg);
                }
            }
            else if (Result == 5)
            {
                strMsg.Append(",ErrMsg:用户已删除");
                Redirect("ErrMsg", "用户已删除");
            }
            else
            {
                strMsg.Append(",ErrMsg:查询用户信息失败");
                Redirect("ErrMsg", "查询用户信息失败");
            }

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if ("yes".Equals(HeadFooter))
        {
            this.header.Visible = true;
            this.footer.Visible = true;
        }
        else
        {
            this.header.Visible = false;
            this.footer.Visible = false;
        }


        string binding  = Request.Form["binding"];
        string register = Request.Form["register"];

        if ("1".Equals(binding))
        {
        }

        if ("1".Equals(register))
        {
            if (!IsPostBack)
            {
                log("OpenBestToneAccount");
                realName    = Request["realName"];
                checkCode   = Request["checkCode"];
                contactMail = Request["contactMail"];
                sex         = Request["sex"];
                certnum     = Request["certnum"];

                ParseSPTokenRequest();

                if (Result == 0)
                {
                    int QueryResult = 0;
                    log(String.Format("CustID:{0},SPID{1},HeadFooter{2}", CustID, SPID, HeadFooter));
                    this.myCustID.Value    = CustID;
                    this.myReturnUrl.Value = ReturnUrl;


                    PhoneRecord[] phones = CustBasicInfo.getPhoneRecord(CustID, out QueryResult, out ErrMsg);
                    if (QueryResult == 0 && phones != null && phones.Length > 0)
                    {
                        log("getPhoneRecord成功!");
                        phoneNum             = phones[0].Phone;
                        this.mobile.Text     = phoneNum;
                        this.contactTel.Text = phoneNum;
                        log(String.Format("phoneNum:{0}", phoneNum));
                    }
                    else
                    {
                        log(String.Format("ErrMsg:{0}", ErrMsg));
                        this.mobile.Text = "";
                    }
                }
                else
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                }
            }
        }
    }
Beispiel #21
0
    public String ModifyCustBasicInfo(string SPID, string CustID, string RealName, string NickName, string CertificateCode, string CertificateType, string Sex, string Email, string Birthday, string EducationLevel, string IncomeLevel, string ProvinceID, string AreaID, string Address, string Favorite, string HeadPic)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据合法性判断
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }



        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(RealName) &&
            CommonUtility.IsEmpty(CertificateCode) &&
            CommonUtility.IsEmpty(CertificateType) &&
            CommonUtility.IsEmpty(Sex))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息参数不能全为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息参数不能全为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }



        if (!CommonUtility.IsEmpty(EducationLevel))
        {
            if (EducationLevel.Equals("1") || EducationLevel.Equals("2") || EducationLevel.Equals("3") || EducationLevel.Equals("4") || EducationLevel.Equals("5") || EducationLevel.Equals("6"))
            {
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "教育水平能1-6!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "教育水平能1-6!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }

        if (!CommonUtility.IsEmpty(IncomeLevel))
        {
            if (IncomeLevel.Equals("1") || IncomeLevel.Equals("2") || IncomeLevel.Equals("3") || IncomeLevel.Equals("4") || IncomeLevel.Equals("5"))
            {
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "收入水平能1-5!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "收入水平能1-5!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }


        if (!CommonUtility.IsEmpty(CertificateType))
        {
            if (CertificateType.Equals("0") || CertificateType.Equals("1") || CertificateType.Equals("2") || CertificateType.Equals("3") || CertificateType.Equals("4") || CertificateType.Equals("5") || CertificateType.Equals("6") || CertificateType.Equals("7") || CertificateType.Equals("8") || CertificateType.Equals("9"))
            {
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "证件类型只能0-9!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "证件类型只能0-9!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }

        // 省代码 地市代码校验

        #endregion
        try
        {
            Result = CustBasicInfo.UpdateCustinfo(SPID, CustID, RealName, CertificateCode, CertificateType, Sex, Email, out ErrMsg);
            if (Result == 0)
            {
                //通知积分平台
                CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
                // 这里要判断该客户是否已经开过户,如果是开户的,并且修改了身份证的才同步
                //CIP2BizRules.NotifyBesttoneAccountInfo(SPID, CustID, out ErrMsg);   // 通知融合支付

                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息成功!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息成功!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改信息失败!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-989");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        catch (Exception exp)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-989");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Int32  Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        StringBuilder strMsg = new StringBuilder();

        SPID = Request["SPID"];
        string appId = Request["appId"];
        string paras = Request["paras"];
        string sign  = Request["sign"];

        string unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
        string unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];

        strMsg.AppendFormat("返回参数:appId:{0},paras:{1},sign:{2}\r\n", appId, paras, sign);

        string unifyPlatformResponse = CryptographyUtil.XXTeaDecrypt(paras, unifyPlatform_appSecretKey);

        strMsg.AppendFormat("unifyPlatformResponse:{0}\r\n", unifyPlatformResponse);
        string newsign = CryptographyUtil.HMAC_SHA1(unifyPlatform_appId + paras, unifyPlatform_appSecretKey);

        strMsg.AppendFormat("newsign:{0},sign:{1}\r\n", newsign, sign);

        if (!newsign.Equals(sign))
        {
            Redirect("ErrMsg", "签名不正确");
        }

        string result         = "";
        string accessToken    = "";
        string timeStamp      = "";
        string userId         = "";
        string productUid     = "";
        string loginNum       = "";
        string nickName       = "";
        string userIconUrl    = "";
        string userIconUrl2   = "";
        string userIconUrl3   = "";
        string isThirdAccount = "";

        Dictionary <String, String> parames = new Dictionary <string, string>();

        strMsg.Append("开始解析unifyPlatformResponse\r\n");
        try
        {
            parames = splitParameters(unifyPlatformResponse);
            strMsg.AppendFormat("params:{0}\r\n", parames);
        }
        catch (Exception exp)
        {
            strMsg.AppendFormat(exp.ToString());
        }
        strMsg.Append("解析unifyPlatformResponse完毕\r\n");

        foreach (KeyValuePair <String, String> p in parames)
        {
            if (p.Key.Equals("result"))
            {
                result = p.Value;
                strMsg.AppendFormat("result:{0}\r\n", result);
            }
            if (p.Key.Equals("accessToken"))
            {
                accessToken = p.Value;
                strMsg.AppendFormat("accessToken:{0}\r\n", accessToken);
            }
            if (p.Key.Equals("timeStamp"))
            {
                timeStamp = p.Value;
                strMsg.AppendFormat("timeStamp:{0}\r\n", timeStamp);
            }
            if (p.Key.Equals("userId"))
            {
                userId = p.Value;
                strMsg.AppendFormat("userId:{0}\r\n", userId);
            }
            if (p.Key.Equals("productUid"))
            {
                productUid = p.Value;
                strMsg.AppendFormat("productUid:{0}\r\n", productUid);
            }
            if (p.Key.Equals("loginNum"))
            {
                loginNum = p.Value;
                strMsg.AppendFormat("loginNum:{0}\r\n", loginNum);
            }
            if (p.Key.Equals("nickName"))
            {
                nickName = p.Value;
                strMsg.AppendFormat("nickName:{0}\r\n", nickName);
            }
            if (p.Key.Equals("userIconUrl"))
            {
                userIconUrl = p.Value;
                strMsg.AppendFormat("userIconUrl:{0}\r\n", userIconUrl);
            }
            if (p.Key.Equals("userIconUrl2"))
            {
                userIconUrl2 = p.Value;
                strMsg.AppendFormat("userIconUrl2:{0}\r\n", userIconUrl2);
            }
            if (p.Key.Equals("userIconUrl3"))
            {
                userIconUrl3 = p.Value;
                strMsg.AppendFormat("userIconUrl3:{0}\r\n", userIconUrl3);
            }
            if (p.Key.Equals("isThirdAccount"))
            {
                isThirdAccount = p.Value;
                strMsg.AppendFormat("isThirdAccount:{0}\r\n", isThirdAccount);
            }
        }

        strMsg.Append("【综合平台 getUserInfo.do】:");

        UnifyAccountInfo accountInfo = new UnifyAccountInfo();
        String           clientIp    = System.Configuration.ConfigurationManager.AppSettings["CIP2_clientIp"];//? 通过f5出去的,这样获得地址不对

        if (String.IsNullOrEmpty(clientIp))
        {
            clientIp = Request.UserHostAddress;
        }

        try
        {
            String clientAgent = Request.UserAgent;
            if ("0".Equals(result) && !String.IsNullOrEmpty(accessToken))                      // result = 0 说明已经处于登录状态 result = 1 说明处于未登录状态
            {
                string p_version    = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_version"];
                string p_clientType = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
                Result = _UDBMBoss.UnifyPlatformGetUserInfo(unifyPlatform_appId, unifyPlatform_appSecretKey, p_version, p_clientType, accessToken, clientIp, clientAgent, out accountInfo, out ErrMsg);

                if (Result == 0)  // 综合平台查询客户信息成功
                {
                    String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                    //检测对应用户是否在号百系统,不在,则注册进来
                    strMsg.Append("【开始注册到号百】:");
                    CustID = String.Empty;
                    System.Text.RegularExpressions.Regex regMobile = new System.Text.RegularExpressions.Regex(@"^1[345678]\d{9}$");
                    System.Text.RegularExpressions.Regex regEmail  = new System.Text.RegularExpressions.Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                    System.Text.RegularExpressions.Regex regCard   = new System.Text.RegularExpressions.Regex(@"^(\d{9}|\d{16})$");

                    string AuthenType = "1";
                    strMsg.AppendFormat("accountInfo.username:{0}\r\n", accountInfo.userName);
                    strMsg.AppendFormat("acountInfo.userId:{0},accountInfo.pUserId:{1}\r\n", accountInfo.userId, accountInfo.pUserId);
                    if (regMobile.IsMatch(accountInfo.userName))
                    {
                        AuthenType = "2";
                    }
                    if (regEmail.IsMatch(accountInfo.userName))
                    {
                        AuthenType = "4";
                    }
                    if (regCard.IsMatch(accountInfo.userName))
                    {
                        AuthenType = "3";
                    }

                    if ("2".Equals(AuthenType))
                    {
                        //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);
                        String OperType = "3"; // 注册
                        String Password = "";  // 从综合平台注册过来,密码是不知道的
                        RealName = "";
                        Result   = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", accountInfo.mobileName,
                                                                          accountInfo.emailName, RealName, Password, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);
                    }
                    else
                    {
                        Result = -7766;
                    }

                    //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);


                    strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    //注册成功
                    if (Result == 0)
                    {
                        Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                           out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                           out AreaID, out RegistrationSource);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:客户不存在" + CustID);
                            //客户不存在
                            Redirect("ErrMsg", "客户不存在");
                        }

                        //埋综合平台token
                        //String UnifyPlatformCookieName = ConfigurationManager.AppSettings["UnifyPlatformCookieName"];
                        //PageUtility.SetCookie(accessToken, UnifyPlatformCookieName, this.Page);

                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000");

                        //埋号百token
                        string AuthenName = UserName;
                        AuthenType = "2";
                        SPInfoManager spInfo         = new SPInfoManager();
                        Object        SPData         = spInfo.GetSPData(this.Context, "SPData");
                        string        key            = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                        UserToken     UT             = new UserToken();
                        string        UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, AuthenName, AuthenType, key, out ErrMsg);
                        string        CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

                        //ReturnUrl = Request["ReturnUrl"] ;
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000");
                        strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000");
                        Response.Redirect(ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000", false);
                    }
                    else
                    {
                        string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                        PageUtility.ExpireCookie(CookieName, this.Page);
                        Response.Redirect(ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000", false);
                    }
                }
            }
            else  // 未登录
            {
                //清楚cookie (登录状态)
                string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                PageUtility.ExpireCookie(CookieName, this.Page);

                //PageUtility.ExpireCookie(UnifyPlatformCookieName, this.Page);

                Response.Redirect(ReturnUrl + "?UnifyAccountCheckResult=1&SPID=35000000", false);
            }

            //if ("0".Equals(result) && Result == 0)   // 认证成功 并且根据accesstoken查客户信息成功
            //{
            //    String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
            //    //检测对应用户是否在号百系统,不在,则注册进来
            //    strMsg.Append("【开始注册到号百】:");
            //    Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);
            //    strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);
            //    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            //    //注册成功
            //    if (Result == 0)
            //    {
            //        Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
            //            out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
            //            out AreaID, out RegistrationSource);
            //        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            //        if (Result != 0)
            //        {
            //            strMsg.Append(",ErrMsg:客户不存在" + CustID);
            //            //客户不存在
            //            Redirect("ErrMsg", "客户不存在");
            //        }

            //        //埋综合平台token
            //        //String UnifyPlatformCookieName = ConfigurationManager.AppSettings["UnifyPlatformCookieName"];
            //        //PageUtility.SetCookie(accessToken, UnifyPlatformCookieName, this.Page);

            //        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            //        //埋号百token
            //        string AuthenName = UserName;
            //        string AuthenType = "2";
            //        SPInfoManager spInfo = new SPInfoManager();
            //        Object SPData = spInfo.GetSPData(this.Context, "SPData");
            //        string key = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
            //        UserToken UT = new UserToken();
            //        string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, AuthenName, AuthenType, key, out ErrMsg);
            //        string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            //        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
            //        //ReturnUrl = Request["ReturnUrl"] ;
            //        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            //        strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);
            //        Response.Redirect(ReturnUrl, false);
            //    }
            //    else
            //    {
            //        strMsg.Append(",ErrMsg:用户注册到号百失败");

            //    }
            //}
        }
        catch (Exception excp)
        {
            strMsg.AppendFormat("异常:{0}\r\n", excp.ToString());
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
        //WriteLog(strMsg.ToString());
    }
    public String QueryCustBasicInfo(String SPID, String CustID)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;

        wt = Request["wt"];   // json or xml

        #region 数据校验

        if (CommonUtility.IsEmpty(SPID))
        {
            Result = ErrorDefinition.BT_IError_Result_InValidSPID_Code;
            ErrMsg = ErrorDefinition.BT_IError_Result_InValidSPID_Msg + ",不能为空";

            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }



            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            Result = ErrorDefinition.BT_IError_Result_InValidRealName_Code;
            ErrMsg = ErrorDefinition.BT_IError_Result_InValidRealName_Msg + ",不能为空";

            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion


        #region  查询
        String OuterID         = String.Empty;
        String Status          = String.Empty;
        String CustType        = String.Empty;
        String CustLevel       = String.Empty;
        String RealName        = String.Empty;
        String UserName        = String.Empty;
        String NickName        = String.Empty;
        String CertificateCode = String.Empty;
        String CertificateType = String.Empty;
        String Sex             = String.Empty;
        String Email           = String.Empty;
        String EnterpriseID    = String.Empty;
        String ProvinceID      = String.Empty;
        String AreaID          = String.Empty;
        String Registration    = String.Empty;

        try
        {
            Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType,
                                               out CustLevel, out RealName, out UserName, out NickName, out CertificateCode,
                                               out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID, out AreaID, out Registration);

            int QueryResult = -1;

            PhoneRecord[] PhoneRecords = CustBasicInfo.getPhoneRecord(CustID, out QueryResult, out ErrMsg);

            ResponseMsg.Length = 0;
            if (Result == 0)
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\",", ErrMsg);
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    ResponseMsg.AppendFormat("\"Status\":\"{0}\",", Status);
                    ResponseMsg.AppendFormat("\"CustType\":\"{0}\",", CustType);
                    ResponseMsg.AppendFormat("\"CustLevel\":\"{0}\",", CustLevel);
                    ResponseMsg.AppendFormat("\"RealName\":\"{0}\",", RealName);
                    ResponseMsg.AppendFormat("\"UserName\":\"{0}\",", UserName);
                    ResponseMsg.AppendFormat("\"NickName\":\"{0}\",", NickName);
                    ResponseMsg.AppendFormat("\"CertificateCode\":\"{0}\",", CertificateCode);
                    ResponseMsg.AppendFormat("\"CertificateType\":\"{0}\",", CertificateType);
                    ResponseMsg.AppendFormat("\"Sex\":\"{0}\",", Sex);
                    ResponseMsg.AppendFormat("\"Email\":\"{0}\",", Email);
                    ResponseMsg.AppendFormat("\"EnterpriseID\":\"{0}\",", EnterpriseID);
                    ResponseMsg.AppendFormat("\"ProvinceID\":\"{0}\",", ProvinceID);
                    ResponseMsg.AppendFormat("\"AreaID\":\"{0}\",", AreaID);
                    if (QueryResult == 0 && PhoneRecords != null && Registration.Length > 0)
                    {
                        ResponseMsg.AppendFormat("\"Phone\":\"{0}\",", PhoneRecords[0].Phone);
                        ResponseMsg.AppendFormat("\"PhoneClass\":\"{0}\",", PhoneRecords[0].PhoneClass);
                    }

                    ResponseMsg.AppendFormat("\"Registration\":\"{0}\"", Registration);
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");

                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
            else
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "970");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "无此用户!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "970");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "无此用户!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
        }
        catch (Exception exp)
        {
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
        }



        #endregion
        return(ResponseMsg.ToString());
    }
Beispiel #24
0
    protected void EditBind()
    {
        Int32  Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;
        String provinceid = String.Empty, areaid = String.Empty;

        try
        {
            //基本信息
            string OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, Registration;
            //扩展信息
            string Birthday, EduLevel, Favorite, IncomeLevel;
            Result = CustBasicInfo.getCustInfo(this.hdSPID.Value, this.hdCustID.Value, out ErrMsg, out OuterID, out Status, out CustType,
                                               out CustLevel, out RealName, out UserName, out NickName, out CertificateCode,
                                               out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID, out AreaID, out Registration);
            if (Result != 0)
            {
            }

            this.txtUserName.Text     = UserName;
            this.txtRealName.Text     = RealName;
            this.txtNickName.Text     = NickName;
            this.DDLSex.SelectedValue = Sex;
            provinceid = ProvinceID;
            areaid     = AreaID;
            this.DDLCertificateType.SelectedValue = CertificateType;
            if (!String.IsNullOrEmpty(CertificateType))
            {
                this.txtCertificateCode.Text = CertificateCode;
            }

            //获取扩展信息
            Result = CustExtendInfo.getCustExtendInfo(this.hdSPID.Value, this.hdCustID.Value, out ErrMsg, out Birthday, out EduLevel, out Favorite, out IncomeLevel);
            if (!String.IsNullOrEmpty(Birthday))
            {
                this.txtBirthday.Text = DateTime.Parse(Birthday).ToString("yyyy-MM-dd");
            }
            this.DDLEdueLevel.SelectedValue   = EduLevel;
            this.DDLIncomeLevel.SelectedValue = IncomeLevel;
        }
        catch (Exception ex)
        {
        }

        #region 绑定省市

        ProvinceInfoManager provinceMgr = new ProvinceInfoManager();
        object   ProData = provinceMgr.GetProvinceData(this.Context);
        DataSet  ds      = (DataSet)ProData;
        ListItem li      = null;

        this.DDLProvinceList.Items.Clear();
        foreach (DataRow row in ds.Tables[0].Rows)
        {
            if (row["ProvinceID"].ToString() == "35" || row["ProvinceName"].ToString() == "全国中心")
            {
                continue;
            }
            li = new ListItem(row["ProvinceName"].ToString(), row["ProvinceID"].ToString());
            this.DDLProvinceList.Items.Add(li);
        }

        this.DDLProvinceList.SelectedValue = provinceid;

        this.DDLAreaList.DataSource     = GetCityName(provinceid);
        this.DDLAreaList.DataTextField  = "AreaName";
        this.DDLAreaList.DataValueField = "AreaID";
        this.DDLAreaList.DataBind();

        this.DDLAreaList.SelectedValue = areaid;
        #endregion
    }
Beispiel #25
0
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void BeginUDBSSO()
    {
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID = Request["SPID"];
            String temp_ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            PassportLoginResponseValue = Request["PassportLoginResponse"];
            strMsg.AppendFormat("【验证参数,DateTime:{0}】:SPID:{1},PassportLoginResponse:{2},temp_ReturnUrl:{3}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, PassportLoginResponseValue, temp_ReturnUrl);
            //根据SPID查询应用系统对应的UDBSPID信息
            UDBSPInfoBO _udbspinfo_bo     = new UDBSPInfoBO();
            UDBSPInfo   _udbspinfo_entity = _udbspinfo_bo.GetBySPID(SPID);
            if (_udbspinfo_entity != null)
            {
                UDBSPID   = _udbspinfo_entity.UDBSPID;
                UDBKey    = _udbspinfo_entity.UDBKey;
                ReturnUrl = _udbspinfo_entity.RedirectUrl;
            }
            else
            {
                UDBSPID   = UDBConstDefinition.DefaultInstance.BesttoneUDBSPID;
                UDBKey    = UDBConstDefinition.DefaultInstance.BesttoneUDBKey;
                ReturnUrl = UDBConstDefinition.DefaultInstance.UDBLoginSuccessRedirectUrl;
            }

            if (String.IsNullOrEmpty(ReturnUrl))
            {
                //其他业务系统的Ticket解析页面是不固定的,通过参数ReturnUrl传递
                ReturnUrl = temp_ReturnUrl;
            }
            else
            {
                //针对精品商城,精品商城的Ticket解析页面是固定的,是配在数据库中,而此时参数ReturnUrl及为最终认证成功的跳转页面
                if (!String.IsNullOrEmpty(temp_ReturnUrl))
                {
                    if (ReturnUrl.IndexOf('?') >= 0)
                    {
                        ReturnUrl += "&ReturnUrl=" + HttpUtility.UrlEncode(temp_ReturnUrl);
                    }
                    else
                    {
                        ReturnUrl += "?ReturnUrl=" + HttpUtility.UrlEncode(temp_ReturnUrl);
                    }
                }
            }

            strMsg.AppendFormat(",ReturnUrl:{0}", ReturnUrl);

            //根据客户信息平台的SPID,获取在客户信息平台的key
            SPInfoManager spInfo = new SPInfoManager();
            Object        SPData = spInfo.GetSPData(this.Context, "SPData");
            key = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);

            //解析PassportLoginResponseValue
            String[] tempArray = PassportLoginResponseValue.Split('$');
            DesSsDeviceNo = tempArray[0];
            String   tempStr     = CryptographyUtil.Decrypt(tempArray[1], UDBKey);
            String[] digestArray = tempStr.Split('$');
            Result    = Convert.ToInt32(digestArray[0]);
            UDBTicket = digestArray[1];
            String timeStamp = digestArray[2];
            String digest    = digestArray[3];

            String newDigest = CryptographyUtil.ToBase64String(CryptographyUtil.Hash(Result + DesSsDeviceNo + UDBTicket + timeStamp));
            strMsg.AppendFormat(",DesSsDeviceNo:{0},Result:{1},UDBTicket{2},timeStamp:{3},digest:{4},newDigest:{5}\r\n", DesSsDeviceNo, Result, UDBTicket, timeStamp, digest, newDigest);
            if (!digest.Equals(newDigest))
            {
                //digest不吻合,失败
                strMsg.AppendFormat(",ErrMsg:{0}", "digest有误不匹配");
                Redirect("ErrMsg", "digest有误不匹配");
            }
            if (Result != 0)
            {
                //失败,则返回
                strMsg.AppendFormat(",ErrMsg:{0}", "返回Ticket失败");
                Redirect("ErrMsg", "返回Ticket失败");
            }

            #endregion

            #region 根据UDBTkcket到UDB查询用户信息

            strMsg.Append("【开始查询信息】:");

            UDBAccountInfo accountInfo = new UDBAccountInfo();

            //根据UDBTicket到UDB查询用户信息
            Result = _UDBMBoss.AccountInfoQuery(UDBSPID, UDBSPID, UDBTicket, UDBKey, out accountInfo, out ErrMsg);
            accountInfo.SourceSPID = UDBConstDefinition.DefaultInstance.UDBSPID;
            strMsg.AppendFormat(",Result:{0},UserID:{1},UserIDType:{2},UserType:{3},PUserID:{4},Alias:{5},UserIDStatus:{6},UserIDSsStatus:{7},Description:{8},ProvinceID:{9},NumFlag:{10}\r\n",
                                Result, accountInfo.UserID, accountInfo.UserIDType, accountInfo.UserType, accountInfo.PUserID, accountInfo.Alias, accountInfo.UserIDStatus, accountInfo.UserIDSsStatus, accountInfo.Description, accountInfo.ProvinceID, accountInfo.NumFlag);

            if (Result == 0)
            {
                String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                //检测对应用户是否在号百系统,不在,则注册进来
                strMsg.Append("【开始注册到号百】:");
                Result = UserRegistry.getUserRegistryUDB(accountInfo, out CustID, out ErrMsg);
                strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);

                //注册成功
                if (Result == 0)
                {
                    Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                       out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                       out AreaID, out RegistrationSource);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:客户不存在" + CustID);
                        //客户不存在
                        Redirect("ErrMsg", "客户不存在");
                    }
                    //生成token
                    UserToken UT             = new UserToken();
                    String    userTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, accountInfo.UserID, UDBBusiness.ConvertAuthenType(accountInfo.NumFlag), key, out ErrMsg);
                    String    CookieName     = ConfigurationManager.AppSettings["CookieName"];
                    PageUtility.SetCookie(CookieName, userTokenValue, this.Page);

                    //生成Ticket
                    String ticket = CommonBizRules.CreateTicket();
                    Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", accountInfo.UserID, UDBBusiness.ConvertAuthenType(accountInfo.NumFlag), out ErrMsg);
                    strMsg.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:Ticket生成失败" + ticket);
                        Redirect("ErrMsg", "Ticket生成失败");
                    }
                    strMsg.Append(",Message:生成ticket成功,返回业务系统");
                    Redirect("Ticket", ticket);
                }
                else
                {
                    strMsg.Append(",ErrMsg:用户注册到号百失败");
                    Redirect("ErrMsg", "用户注册到号百失败" + ErrMsg);
                }
            }
            else if (Result == 5)
            {
                strMsg.Append(",ErrMsg:用户已删除");
                Redirect("ErrMsg", "用户已删除");
            }
            else
            {
                strMsg.Append(",ErrMsg:查询用户信息失败");
                Redirect("ErrMsg", "查询用户信息失败");
            }

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
Beispiel #26
0
    protected String QueryAccountInfo()
    {
        //请求参数
        String CustID = Request["CustID"];
        String SPID   = Request["SPID"];
        String wt     = Request["wt"]; // json or xml

        logger.Info("AccountInfoQuery_log");
        logger.Info("CustID=" + CustID);
        logger.Info("SPID =" + SPID);
        logger.Info("writetype=" + wt);
        //返回参数
        String ErrMsg = String.Empty;
        Int32  Result = 0;
        Int32  ResultQueryCustInfo = 0;

        StringBuilder ResponseMsg = new StringBuilder();

        //账户信息字段
        String AccountNo          = String.Empty;
        String AccountName        = String.Empty;
        String AccountType        = String.Empty;
        String AccountStatus      = String.Empty;
        String AccountBalance     = String.Empty;
        String PredayBalance      = String.Empty;
        String PreMonthBalance    = String.Empty;
        String AvailableBalance   = String.Empty;
        String UnAvailableBalance = String.Empty;
        String AvailableLecash    = String.Empty;
        String CardNum            = String.Empty;
        String CardType           = String.Empty;

        //客户信息字段
        String OuterID         = String.Empty;
        String Status          = String.Empty;
        String CustType        = String.Empty;
        String CustLevel       = String.Empty;
        String RealName        = String.Empty;
        String UserName        = String.Empty;
        String NickName        = String.Empty;
        String CertificateCode = String.Empty;
        String CertificateType = String.Empty;
        String Sex             = String.Empty;
        String Email           = String.Empty;
        String EnterpriseID    = String.Empty;
        String ProvinceID      = String.Empty;
        String AreaID          = String.Empty;
        String Registration    = String.Empty;


        try
        {
            BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
            BesttoneAccount    entity = _besttoneAccount_dao.QueryByCustID(CustID);
            if (entity == null)
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "无此用户");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "无此账户");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                logger.Info("根据custid查账号没查到!");
                return(ResponseMsg.ToString());
            }
            else
            {
                //查询账户余额
                AccountItem item = null;
                ErrMsg = "";
                Result = QueryBesttoneAccount(entity.BestPayAccount, out item, out ErrMsg);
                if (Result == 0)
                {
                    logger.Info("AccountInfoQuery_log:账户查询成功");
                    if (item != null)
                    {
                        AccountNo          = item.AccountNo;
                        AccountName        = item.AccountName;   // 账户名称
                        AccountType        = item.AccountType;   // 账户类型 (资金)
                        AccountStatus      = item.AccountStatus; //  账户状态
                        AccountBalance     = item.AccountBalance.ToString();
                        PredayBalance      = item.PredayBalance.ToString();
                        PreMonthBalance    = item.PreMonthBalance.ToString();
                        AvailableBalance   = item.AvailableBalance.ToString();
                        UnAvailableBalance = item.UnAvailableBalance.ToString();
                        AvailableLecash    = item.AvailableLecash.ToString();
                        CardNum            = item.CardNum;
                        CardType           = item.CardType;

                        logger.Info("AccountNo=" + AccountNo);
                        logger.Info("AccountName=" + AccountName);
                        logger.Info("AccountType=" + AccountType);
                        logger.Info("AccountStatus=" + AccountStatus);
                        logger.Info("AccountBalance=" + AccountBalance);
                        logger.Info("PredayBalance=" + PredayBalance);
                        logger.Info("PreMonthBalance=" + PreMonthBalance);
                        logger.Info("AvailableBalance=" + AvailableBalance);
                        logger.Info("UnAvailableBalance=" + UnAvailableBalance);
                        logger.Info("CardNum=" + CardNum);
                        logger.Info("CardType=" + CardType);
                    }

                    if ("1".Equals(AccountType))
                    {
                        AccountType = "资金账户";
                    }
                    else if ("2".Equals(AccountType))
                    {
                        AccountType = "脱机账户";
                    }
                    else if ("3".Equals(AccountType))
                    {
                        AccountType = "代金券账户";
                    }
                    else if ("4".Equals(AccountType))
                    {
                        AccountType = "积分账户";
                    }

                    if ("0".Equals(AccountStatus))
                    {
                        AccountStatus = "未激活";
                    }
                    else if ("1".Equals(AccountStatus))
                    {
                        AccountStatus = "正常";
                    }
                    else if ("2".Equals(AccountStatus))
                    {
                        AccountStatus = "挂失";
                    }
                    else if ("3".Equals(AccountStatus))
                    {
                        AccountStatus = "冻结";
                    }
                    else if ("4".Equals(AccountStatus))
                    {
                        AccountStatus = "锁定";
                    }
                    else if ("9".Equals(AccountStatus))
                    {
                        AccountStatus = "已销户";
                    }
                    else
                    { //为定义
                        AccountStatus = "未定义";
                    }

                    //客户信息查询
                    ResultQueryCustInfo = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType,
                                                                    out CustLevel, out RealName, out UserName, out NickName, out CertificateCode,
                                                                    out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID, out AreaID, out Registration);

                    if (ResultQueryCustInfo == 0)
                    {
                        logger.Info("AccountInfoQuery_log:客户信息查询成功!");
                    }
                    else
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "客户信息查询失败");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "客户信息查询失败");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        logger.Info("AccountInfoQuery_log:客户信息查询失败!");
                        return(ResponseMsg.ToString());
                    }


                    if (Result == 0 && ResultQueryCustInfo == 0)
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))  // 以json格式 返回
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"AccountNo\":\"{0}\",", AccountNo);
                            ResponseMsg.AppendFormat("\"AccountName\":\"{0}\",", AccountName);
                            ResponseMsg.AppendFormat("\"BesttoneAccount\":\"{0}\",", entity.BestPayAccount);
                            ResponseMsg.AppendFormat("\"RealName\":\"{0}\",", RealName);
                            ResponseMsg.AppendFormat("\"UserName\":\"{0}\",", UserName);
                            ResponseMsg.AppendFormat("\"NickName\":\"{0}\",", NickName);
                            ResponseMsg.AppendFormat("\"Sex\":\"{0}\",", Sex);
                            ResponseMsg.AppendFormat("\"AccountType\":\"{0}\",", AccountType);
                            ResponseMsg.AppendFormat("\"AccountStatus\":\"{0}\",", AccountStatus);
                            ResponseMsg.AppendFormat("\"AccountBalance\":\"{0}\",", AccountBalance);
                            ResponseMsg.AppendFormat("\"PredayBalance\":\"{0}\",", PredayBalance);
                            ResponseMsg.AppendFormat("\"PreMonthBalance\":\"{0}\",", PreMonthBalance);
                            ResponseMsg.AppendFormat("\"AvailableBalance\":\"{0}\",", AvailableBalance);
                            ResponseMsg.AppendFormat("\"UnAvailableBalance\":\"{0}\",", UnAvailableBalance);
                            ResponseMsg.AppendFormat("\"AvailableLecash\":\"{0}\",", AvailableLecash);
                            ResponseMsg.AppendFormat("\"CardNum\":\"{0}\",", CardNum);
                            ResponseMsg.AppendFormat("\"CardType\":\"{0}\"", CardType);
                            ResponseMsg.Append("}");
                        }
                        else
                        {  //  以 xml 格式返回
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>");
                            ResponseMsg.AppendFormat("<AccountNo>{0}</AccountNo>", AccountNo);
                            ResponseMsg.AppendFormat("<AccountName>{0}</AccountName>", AccountName);

                            ResponseMsg.AppendFormat("<RealName>{0}</RealName>", RealName);
                            ResponseMsg.AppendFormat("<UserName>{0}</UserName>", AccountName);
                            ResponseMsg.AppendFormat("<NickName>{0}</NickName>", AccountName);
                            ResponseMsg.AppendFormat("<Sex>{0}</Sex>", AccountName);

                            ResponseMsg.AppendFormat("<AccountType>{0}</AccountType>", AccountType);
                            ResponseMsg.AppendFormat("<AccountStatus>{0}</AccountStatus>", AccountStatus);
                            ResponseMsg.AppendFormat("<AccountBalance>{0}</AccountBalance>", AccountBalance);
                            ResponseMsg.AppendFormat("<PredayBalance>{0}</PredayBalance>", PredayBalance);
                            ResponseMsg.AppendFormat("<PreMonthBalance>{0}</PreMonthBalance>", PreMonthBalance);
                            ResponseMsg.AppendFormat("<AvailableBalance>{0}</AvailableBalance>", AvailableBalance);
                            ResponseMsg.AppendFormat("<UnAvailableBalance>{0}</UnAvailableBalance>", UnAvailableBalance);
                            ResponseMsg.AppendFormat("<AvailableLecash>{0}</AvailableLecash>", AvailableLecash);
                            ResponseMsg.AppendFormat("<CardNum>{0}</CardNum>", CardNum);
                            ResponseMsg.AppendFormat("<CardType>{0}</CardType>", CardType);
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                    }
                }
                else
                {
                    // 返回错误信息
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户查询失败");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户查询失败");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }

                    logger.Info("AccountInfoQuery_log:账户查询失败!");
                }
            }
        }
        catch (Exception ex)
        {
            logger.Info(ex.Message);
        }
        return(ResponseMsg.ToString());
    }
Beispiel #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Top1.Welcome = "号码百事通设置用户信息";
        this.Master.setTopWelcome("号码百事通用户信息");
        if (!Page.IsPostBack)
        {
            string url = Request.Url.AbsoluteUri;
            if (Request.QueryString["SPID"] != null)
            {
                Spid = Request.QueryString["SPID"].ToString();
                this.spidtxt.Value = Spid;
            }

            TokenValidate.IsRedircet = true;        //正式要恢复
            TokenValidate.Validate();               //正式要恢复
            string CustID = TokenValidate.CustID;   //正式要恢复

            if (CustID != "")
            {
                this.custidtxt.Value = CustID;
            }


            #region 定义需要的参数

            //输出错误信息
            string Msg = "";
            //客户姓名
            string RealName = "";
            //昵称
            string NickName = "";
            //证件类型
            string CertificateType = "";
            //证件号码
            string CertificateCode = "";
            //性别
            string Sex = "";
            //客户所属省
            string ProvinceID = "";
            //客户归属地市
            string AreaID = "";
            //生日
            string Birthday = "";
            //文化程度
            string EduLevel = "";
            //收入水平
            string IncomeLevel = "";

            //外部客户ID
            string OuterID = "";
            //状态
            string Status = "";
            //客户类型
            string CustType = "";
            //客户级别
            string CustLevel = "";
            //邮箱
            string Email = "";
            //用户名
            string UserName = "";
            //爱好(废除)
            string Favorite = "";
            //?
            string Registration = "";

            string EnterpriseID = "";
            #endregion

            //调用用户基本信息查询函数将以上的参数带入函数内
            int k = CustBasicInfo.getCustInfo(Spid, CustID, out Msg, out OuterID, out Status, out CustType, out CustLevel, out RealName, out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID, out AreaID, out Registration);

            //判断 如果函数返回0则对页面的HTML文本框赋值
            if (k == 0)
            {
                //string r = null;
                this.realnametxt.Value = RealName;
                this.nicknametxt.Value = NickName;

                this.certificatetxt.Value = CertificateType;
                this.certnotxt.Value      = CertificateCode;

                this.sextxt.Value    = Sex;
                this.stext.Value     = ProvinceID;
                this.resulttxt.Value = AreaID;
                //this.emailtxt.Value = Email;
                //this.usernameTxt.Value = UserName;

                //初始话页面时给省份下拉框绑定所有省份
                ProvinceInfoManager proInfo = new ProvinceInfoManager();
                object   ProData            = proInfo.GetProvinceData(this.Context);
                DataSet  ds = (DataSet)ProData;
                ListItem li = null;
                this.proInfoList.Items.Clear();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    if (row["ProvinceID"].ToString() == "35" || row["ProvinceName"].ToString() == "全国中心")
                    {
                        continue;
                    }
                    li = new ListItem(row["ProvinceName"].ToString(), row["ProvinceID"].ToString());
                    this.proInfoList.Items.Add(li);
                }
                //this.proInfoList.DataSource = ds;
                //this.proInfoList.DataTextField = "ProvinceName";
                //this.proInfoList.DataValueField = "ProvinceID";
                //this.proInfoList.DataBind();

                //初始话页面时给城市下拉绑定所有城市
                this.areaInfoList.DataSource     = GetCityName(this.stext.Value);
                this.areaInfoList.DataTextField  = "AreaName";
                this.areaInfoList.DataValueField = "AreaID";
                this.areaInfoList.DataBind();

                this.areaid.DataSource     = GetCityName(this.stext.Value);
                this.areaid.DataTextField  = "AreaID";
                this.areaid.DataValueField = "AreaID";
                this.areaid.DataBind();

                this.certificateSel.Value = this.certificatetxt.Value;

                this.sexSel.Value       = this.sextxt.Value;
                this.proInfoList.Value  = this.stext.Value;
                this.areaInfoList.Value = this.resulttxt.Value;
                this.areaid.Value       = this.resulttxt.Value;

                if (certificateSel.Value == "")
                {
                    certnotxt.Style.Value = "display:block";
                    certnoL.Style.Value   = "display:block";
                }
            }
            //调用客户扩展信息查询函数将以上参数带入函数内
            int y = CustExtendInfo.getCustExtendInfo(Spid, CustID, out Msg, out Birthday, out EduLevel, out Favorite, out IncomeLevel);
            //判断 如果函数返回0则对页面HTML文本框赋值
            if (y == 0)
            {
                if (!CommonUtility.IsEmpty(Birthday))
                {
                    DateTime da = Convert.ToDateTime(Birthday);
                    this.birthdaytxt.Value = da.ToShortDateString();
                }

                this.Edutxt.Value    = EduLevel;
                this.Incometxt.Value = IncomeLevel;
                this.EduSel.Value    = this.Edutxt.Value;
                this.IncomeSel.Value = this.Incometxt.Value;
            }
        }
    }