Exemplo n.º 1
0
    protected void Modify_Click(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();
        try
        {
            String oldPassWord = Request.Form["oldPassWord"];
            String newPassWord = Request.Form["newPassWord"];
            String confirmPassWord = Request.Form["confirmPassWord"];
            string BesttoneAccount = base.BestPayAccount;
            strLog.AppendFormat("【开始修改密码,事件:{0}】", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            strLog.AppendFormat("参数:oldPassWord:{0},newPassWord:{1},confirmPassWord:{2},BesttonePayAccount:{3}", oldPassWord, newPassWord, confirmPassWord, BesttoneAccount);

            BestPayEncryptService bpes = new BestPayEncryptService();
            string e_oldPassWord = "";
            string e_newPassWord = "";
            string e_confirmPassWord = "";

            AccountItem ai = new AccountItem();
            String ResCode = "";
            int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BesttoneAccount, out ai,out ResCode, out ErrMsg);
            if (QueryBesttoneAccountResult == 0)
            {
                if (ai != null)
                {
                    e_oldPassWord = bpes.encryptNoKey(oldPassWord, ai.AccountNo);
                    e_newPassWord = bpes.encryptNoKey(newPassWord, ai.AccountNo);
                    e_confirmPassWord = bpes.encryptNoKey(confirmPassWord, ai.AccountNo);

                    strLog.AppendFormat("e_oldPassWord{0},e_newPassWord{1},e_confirmPassWord{2}", e_oldPassWord, e_newPassWord, e_confirmPassWord);

                    int ModifyBestPayPasswordResult = BesttoneAccountHelper.ModifyBestPayPassword(ai.AccountNo, e_oldPassWord, e_newPassWord, e_confirmPassWord, out ErrMsg);

                    if (ModifyBestPayPasswordResult == 0)
                    {
                        success = "0";
                        _ReturnUrl = base.ReturnUrl;
                    }
                    else
                    {
                        strLog.Append(",失败3");
                        Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                    }
                }
                else
                {
                    strLog.Append(",失败2");
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=账户信息未获取");
                }
            }
            else
            {
                strLog.Append(",失败1");
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
            }
        }
        catch (System.Exception ex)
        {
            log(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());

        }
    }
Exemplo n.º 2
0
    public String ChangePayPassword(String SPID, String CustID, String oldPassWord, String newPassWord, String confirmPassWord, String wt)
    {
        Int32 Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        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(oldPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "oldPassword不能为空!");
                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>", "oldPassword不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(newPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "newPassword不能为空!");
                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>", "newPassword不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        if (CommonUtility.IsEmpty(confirmPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "confirmPassWord不能为空!");
                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>", "confirmPassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }

        #endregion

        try
        {
            string BindedBestpayAccount = "";
            string CreateTime = "";
            Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);

            if (Result == 0 && !String.IsNullOrEmpty(BindedBestpayAccount))
            {

                BestPayEncryptService bpes = new BestPayEncryptService();
                string e_oldPassWord = "";
                string e_newPassWord = "";
                string e_confirmPassWord = "";

                AccountItem ai = new AccountItem();
                String ResCode = "";

                int QueryBesttoneAccountResult = BesttoneAccountInfoQuery(BindedBestpayAccount, out ai, out ResCode, out ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if (ai != null)
                    {
                        e_oldPassWord = bpes.encryptNoKey(oldPassWord, ai.AccountNo);
                        e_newPassWord = bpes.encryptNoKey(newPassWord, ai.AccountNo);
                        e_confirmPassWord = bpes.encryptNoKey(confirmPassWord, ai.AccountNo);

                        //strLog.AppendFormat("e_oldPassWord{0},e_newPassWord{1},e_confirmPassWord{2}", e_oldPassWord, e_newPassWord, e_confirmPassWord);

                        int ModifyBestPayPasswordResult = ModifyBestPayPassword(ai.AccountNo, e_oldPassWord, e_newPassWord, e_confirmPassWord, out ErrMsg);

                        if (ModifyBestPayPasswordResult == 0)
                        {
                            //success = "0";

                                // 返回错误信息
                                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
                        {
                            //strLog.Append(",失败3");
                            //Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);

                                // 返回错误信息
                                ResponseMsg.Length = 0;
                                if ("json".Equals(wt))
                                {
                                    ResponseMsg.Append("{");
                                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9916");
                                    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>", "9916");
                                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败!");
                                    ResponseMsg.Append("</PARAMETERS>");
                                    ResponseMsg.Append("</PayPlatRequestParameter>");
                                }
                                return ResponseMsg.ToString();

                        }
                    }
                    else
                    {
                        //strLog.Append(",失败2");
                        //Response.Redirect("ErrorInfo.aspx?ErrorInfo=账户信息未获取");

                            // 返回错误信息
                            ResponseMsg.Length = 0;
                            if ("json".Equals(wt))
                            {
                                ResponseMsg.Append("{");
                                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9917");
                                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>", "9917");
                                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败!账户信息未能获取");
                                ResponseMsg.Append("</PARAMETERS>");
                                ResponseMsg.Append("</PayPlatRequestParameter>");
                            }
                            return ResponseMsg.ToString();

                    }
                }
                else
                {
                    //strLog.Append(",失败1");
                    //Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);

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

                }
            }
            else
            {
                // 未开通账户

                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9919");
                        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>", "9919");
                        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}\",", "9920");
                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>", "9920");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return ResponseMsg.ToString();
        }
        return ResponseMsg.ToString();
    }