Exemplo n.º 1
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());
    }
Exemplo n.º 2
0
    public String UserRegisterClient(String SPID, String AuthenPhone, String Password, String Email, String Sex, String RealName, String Device)
    {
        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(AuthenPhone))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenPhone不能为空!");
                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>", "AuthenPhone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        Result = PhoneBO.SelSendSMSMassage("", AuthenPhone, CheckPhoneCode, out ErrMsg);
        if (Result != 0)
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                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>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "手机验证码验证错误!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        String T_CustID = String.Empty;

        if (!CommonBizRules.HasBesttoneAccount(this.Context, AuthenPhone, 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}\"", AuthenPhone + "该手机号码已经被别的客户作为号码百事通账户!");
                    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>", AuthenPhone + "该手机号码已经被别的客户作为号码百事通账户!");
                    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_UserRegistryClient"; // 不带RegistrationSouce参数
            //cmd.CommandText = "dbo.up_Customer_V3_Interface_UserRegistryClientV2";   // 带RegistrationSouce参数  2.0后做

            int RegistrationSouce = 2; // 默认是web注册

            if ("android".Equals(Device))
            {
                RegistrationSouce = 11;  // 客户端 且 android
            }

            if ("ios".Equals(Device))
            {
                RegistrationSouce = 12;  // 客户端 且 ios
            }

            SqlParameter 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);
            if (String.IsNullOrEmpty(Password))
            {
                parPassword.Value = CryptographyUtil.Encrypt("111111");
            }
            else
            {
                parPassword.Value = CryptographyUtil.Encrypt(Password);
            }
            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);
            if (String.IsNullOrEmpty("RealName"))
            {
                parRealName.Value = "";
            }
            else
            {
                parRealName.Value = RealName;
            }
            cmd.Parameters.Add(parRealName);

            SqlParameter parUserName = new SqlParameter("@UserName", SqlDbType.VarChar, 50);
            if (String.IsNullOrEmpty(UserName))
            {
                parUserName.Value = "";
            }
            else
            {
                parUserName.Value = UserName;
            }
            cmd.Parameters.Add(parUserName);

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

            SqlParameter parEmail = new SqlParameter("@Email", SqlDbType.VarChar, 20);
            if (String.IsNullOrEmpty(Email))
            {
                parEmail.Value = Email;
            }
            else
            {
                parEmail.Value = "";
            }
            cmd.Parameters.Add(parEmail);


            //SqlParameter parRegistrationSource = new SqlParameter("@RegistrationSource", SqlDbType.Int);
            //parRegistrationSource.Value = RegistrationSouce;
            //cmd.Parameters.Add(parRegistrationSource);

            SqlParameter parSex = new SqlParameter("@Sex", SqlDbType.VarChar, 1);
            if (String.IsNullOrEmpty(Sex))
            {
                parSex.Value = "2";
            }
            else
            {
                parSex.Value = Sex;
            }
            cmd.Parameters.Add(parSex);

            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 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();

            ResponseMsg.Length = 0;
            if (Result == 0)
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    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.AppendFormat("<CustID>{0}</CustID>", CustID);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                    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>", "-2508");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
        }
        catch (Exception exp)
        {
            ResponseMsg.Length = 0;
            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());
    }