Exemple #1
0
    public String selEmail()
    {
        StringBuilder ResponseMsg = new StringBuilder();
        string        msg         = "";
        string        Email       = HttpUtility.HtmlDecode(Request["email"].ToString());
        string        CustId      = HttpUtility.HtmlDecode(Request["custid"].ToString());
        string        ReturnUrl   = HttpUtility.HtmlDecode(Request["returnUrl"].ToString());
        string        Spid        = HttpUtility.HtmlDecode(Request["SPID"].ToString());

        k = SetMail.EmailSel(CustId, Email, Spid, out msg);  // 查看该邮箱是否已经被别人注册   k =0 代表此邮箱尚未被用
        if (k == 0)
        {
            string a          = CommonBizRules.EncryptEmailURlV2(Spid, CustId, Email, ReturnUrl, HttpContext.Current); //这里跟老版本不一样的地方是加了返回地址
            string url        = "点击完成认证:<a href='" + a + "'>" + a + "</a>";
            Random random     = new Random();
            string AuthenCode = random.Next(111111, 999999).ToString();
            y = SetMail.InsertEmailSendMassage(CustId, "2", url, AuthenCode, 1, Email, DateTime.Now, "描述", "中国电信号码百事通:激活邮箱", 0, out msg);
            //Response.Write(y);
            ResponseMsg.Append("[{");
            ResponseMsg.AppendFormat("\"result\":\"{0}\",", "true");
            ResponseMsg.AppendFormat("\"info\":\"{0}\"", y);
            ResponseMsg.Append("}]");
            return(ResponseMsg.ToString());
        }
        else
        {
            //Response.Write(msg);
            ResponseMsg.Append("[{");
            ResponseMsg.AppendFormat("\"result\":\"{0}\",", "false");
            ResponseMsg.AppendFormat("\"info\":\"{0}\"", msg);
            ResponseMsg.Append("}]");
            return(ResponseMsg.ToString());
        }
    }
Exemple #2
0
    public void SelEmail()
    {
        string username = HttpUtility.HtmlDecode(Request.QueryString["name"].ToString());
        string email    = HttpUtility.HtmlDecode(Request.QueryString["email"].ToString());

        if (!ValidateValidateCode())
        {
            Response.Write("验证码错误,请重新输入");
            return;
        }
        else
        {
            int i = SetMail.FindPwdByEmail(username, email, out Msg);
            if (i == 0)
            {
                string[] str    = FindPwd.SelPwdByEmailandName(username, email, out Msg);
                string   Pwd    = CryptographyUtil.Decrypt(str[1].ToString());
                string   CustId = str[0].ToString();
                int      y      = SetMail.InsertEmailSendMassage(CustId, "2", "您的密码是:" + Pwd, "", 1, email, DateTime.Now, "找回密码", "中国电信号码百事通:找回密码", 0, out Msg);
                Response.Write(y);
            }
            else
            {
                Response.Write(Msg);
            }
        }
    }
Exemple #3
0
 /// <summary>
 /// author lihongtu
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string        SPID      = null;
         string        CustID    = null;
         string        Email     = null;
         string        ReturnUrl = null;
         string        url       = Request.Url.AbsoluteUri; //  这个就是邮箱中用户点的那串完整的链接
         List <string> list      = new List <string>();
         //String Digest = CryptographyUtil.GenerateAuthenticator(SPID + "$" + CustID + "$" + Email + "$" + ReturnUrl + "$" + timeTamp, key);
         //String AuthenStrValue = CryptographyUtil.ToBase64String(Encoding.UTF8.GetBytes(CryptographyUtil.Encrypt(SPID + "$" + CustID + "$" +
         //    Email + "$" + ReturnUrl + "$" + timeTamp + "$" + Digest)));
         list      = CommonBizRules.DecryptEmailURLV2(SPID, url, HttpContext.Current);
         SPID      = list[0];
         CustID    = list[1];
         Email     = list[2];
         ReturnUrl = list[3];
         int i = SetMail.SelSendEmailMassage(CustID, Email, out Msg);  // update custinfo set email=@Email,emailclass='2' where custid=@CustID
         if (i == 0)
         {
             CommonBizRules.SuccessRedirect(ReturnUrl, "认证邮箱设置成功", this.Context);
         }
     }
 }
    public int EmailAuth()
    {
        string ErrMsg = "";

        Result = SetMail.EmailSel("", Mail, SPID, out ErrMsg);
        //Result = 1;
        return(Result);
    }
    protected void SendEmail(string CustID, string Mail)
    {
        DateTime datetime = DateTime.Now;
        string   ErrMsg   = "";

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

        SetMail.InsertEmailSendMassage(CustID, "1", url, "", 1, Mail, datetime, "", "中国电信号码百事通:激活邮箱;尊敬的用户,点击此链接激活您的帐号", 0, out ErrMsg);
    }
    /// <summary>
    ///
    /// </summary>
    public void SendCode()
    {
        DateTime datetime = DateTime.Now;
        string   ErrMsg   = "";

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

        SetMail.InsertEmailSendMassage("", "1", url, "", 1, Mail, datetime, "", "中国电信号码百事通:激活邮箱", 0, out ErrMsg);
        //SetMail.InsertEmailSendMassage("", "1", "请点击下面链接", "", 0, Mail, datetime, "", "中国电信号码百事通:激活邮箱", 0, out ErrMsg);
    }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string Spid  = null;
            string Emali = null;
            string Msg   = null;
            if (Request.QueryString["SPID"] != null)
            {
                if (Request.QueryString["SPID"].ToString() != "35000000")
                {
                    Spid = Request.QueryString["SPID"].ToString();
                }
                else
                {
                    Spid = "35000000";
                }
            }
            else
            {
                Spid = "";
            }
            TokenValidate.IsRedircet = true;
            TokenValidate.Validate();
            string CustID = TokenValidate.CustID;
            //  string CustID = "571300100";
            if (CustID != "")
            {
                this.custidtxt.Value = CustID;
            }
            // Emali = SetMail.SelEmailAddress(this.custidtxt.Value, Spid, out Msg);
            DataSet ds = new DataSet();
            ds = SetMail.SelEmailAddress(this.custidtxt.Value, out Msg);
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                this.Emailtxt.Value = ds.Tables[0].Rows[0]["Email"].ToString();

                string Emailclass = ds.Tables[0].Rows[0]["EmailClass"].ToString();
                if (Emailclass == "1")
                {
                    this.EmailClassLab.Text = "一般邮箱";
                }
                else if (Emailclass == "2")
                {
                    this.EmailClassLab.Text = "认证邮箱";
                }
            }
        }
    }
Exemple #8
0
    protected void  btnSubmit_Click(object sender, EventArgs e)
    {
        string ErrMsg = "";
        //SetMail.InsertEmailSendHistory("10", "2", "3", "4", "5",0, "6", "7");
        //return;
        string EMailMessage = txtMessage.Text.Trim();
        string EMailAddress = txtAddress.Text.Trim();
        string SubjectName  = txtSubject.Text.Trim();
        int    Result       = -1;

        string EmailModelPath = txtEmailModelPath.Text.Trim();

        //Result = SetMail.EmailSend(EMailMessage, EMailAddress, EmailModelPath, SubjectName, out ErrMsg);
        Result = SetMail.InsertEmailSendMassage("10", "2", EMailMessage, "11", 0, EMailAddress,
                                                DateTime.Now, "11", SubjectName, 0, out ErrMsg);
        Response.Write("Result-" + Result.ToString() + "ErrMsg-" + ErrMsg);
    }
Exemple #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string        CustID = null;
            string        Email  = null;
            string        url    = Request.Url.AbsoluteUri;
            List <string> list   = new List <string>();
            list   = CommonBizRules.DecryptEmailURL(url, HttpContext.Current);
            CustID = list[0];
            Email  = list[1];

            int i = SetMail.SelSendEmailMassage(CustID, Email, out Msg);
            if (i == 0)
            {
                CommonBizRules.SuccessRedirect("", "认证邮箱设置成功", this.Context);
            }
        }
    }
    public void selEmail()
    {
        string msg    = "";
        string Email  = HttpUtility.HtmlDecode(Request.QueryString["email"].ToString());
        string CustId = HttpUtility.HtmlDecode(Request.QueryString["custid"].ToString());
        string Spid   = HttpUtility.HtmlDecode(Request.QueryString["SPID"].ToString());
        string Pwd    = HttpUtility.HtmlDecode(Request.QueryString["pwd"].ToString());
        string webpwd = CryptographyUtil.Encrypt(Pwd);
        int    i      = FindPwd.SelState(CustId, webpwd, out msg);



        if (!ValidateValidateCode())
        {
            Response.Write("验证码错误,请重新输入");
            return;
        }
        else
        {
            if (i != 0)
            {
                Response.Write("登录密码输入错误,请重新输入");
                return;
            }
            else
            {
                k = SetMail.EmailSel(CustId, Email, Spid, out msg);
                if (k == 0)
                {
                    string a          = CommonBizRules.EncryptEmailURl(CustId, Email, HttpContext.Current);
                    string url        = "点击完成认证:<a href='" + a + "'>" + a + "</a>";
                    Random random     = new Random();
                    string AuthenCode = random.Next(111111, 999999).ToString();
                    y = SetMail.InsertEmailSendMassage(CustId, "2", url, AuthenCode, 1, Email, DateTime.Now, "描述", "中国电信号码百事通:激活邮箱", 0, out msg);
                    Response.Write(y);
                }
                else
                {
                    Response.Write(msg);
                }
            }
        }
    }
Exemple #11
0
 /// <summary>
 /// author lihongtu
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string SPID   = null;
         string CustID = null;
         string Email  = null;
         //string ReturnUrl = null;
         string        url  = Request.Url.AbsoluteUri; //  这个就是邮箱中用户点的那串完整的链接
         List <string> list = new List <string>();
         //String Digest = CryptographyUtil.GenerateAuthenticator(SPID + "$" + CustID + "$" + Email + "$" + ReturnUrl + "$" + timeTamp, key);
         //String AuthenStrValue = CryptographyUtil.ToBase64String(Encoding.UTF8.GetBytes(CryptographyUtil.Encrypt(SPID + "$" + CustID + "$" +
         //    Email + "$" + ReturnUrl + "$" + timeTamp + "$" + Digest)));
         //list = CommonBizRules.DecryptEmailURLV2(SPID, url, HttpContext.Current);
         list   = CommonBizRules.DecryptEmailWithNoReturnUrl(SPID, url, HttpContext.Current);
         SPID   = list[0];
         CustID = list[1];
         Email  = list[2];
         //ReturnUrl = list[3];
         int           i           = SetMail.SelSendEmailMassage(CustID, Email, out Msg); // update custinfo set email=@Email,emailclass='2' where custid=@CustID
         StringBuilder ResponseMsg = new StringBuilder();
         if (i == 0)
         {
             //CommonBizRules.SuccessRedirect(ReturnUrl, "认证邮箱设置成功", this.Context);
             ResponseMsg.Length = 0;
             ResponseMsg.Append("<script type='text/javascript'>");
             ResponseMsg.AppendFormat("alert('{0}');", Msg);
             ResponseMsg.Append("</script>");
         }
         else
         {
             ResponseMsg.Length = 0;
             ResponseMsg.Append("<script type='text/javascript'>");
             ResponseMsg.AppendFormat("alert('{0}');", Msg);
             ResponseMsg.Append("</script>");
         }
     }
 }
Exemple #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String urlParam = Request["UrlParam"] == null ? String.Empty : HttpUtility.UrlDecode(Request["UrlParam"]);

        if (String.IsNullOrEmpty(urlParam))
        {
            this.ResetPanel.Visible = false;
            this.MsgPanel.Visible   = true;
        }
        else
        {
            this.ResetPanel.Visible = true;
            this.MsgPanel.Visible   = false;
            try
            {
                //解析并获取参数
                String   DecryptParam = CryptographyUtil.Decrypt(Encoding.UTF8.GetString(CryptographyUtil.FromBase64String(urlParam)));
                String[] paramArray   = DecryptParam.Split('$');
                String   spid         = paramArray[0];
                String   custid       = paramArray[1];
                String   email        = paramArray[2];
                String   returnUrl    = String.IsNullOrEmpty(paramArray[3]) ? ConstHelper.DefaultInstance.BesttoneLoginPage : paramArray[3];
                String   authenCode   = paramArray[4];
                String   timeTamp     = paramArray[5];
                String   digest       = paramArray[6];
                this.hdCustID.Value     = custid;
                this.hdEmail.Value      = email;
                this.hdAuthenCode.Value = authenCode;

                //对参数进行验证
                SPInfoManager spInfo    = new SPInfoManager();
                Object        SPData    = spInfo.GetSPData(this.Context, "SPData");
                String        key       = spInfo.GetPropertyBySPID(spid, "SecretKey", SPData);
                String        NewDigest = CryptographyUtil.GenerateAuthenticator(spid + "$" + custid + "$" + email + "$" + returnUrl + "$" + authenCode + "$" + timeTamp, key);
                //看是否过期
                DateTime sendMailTime = Convert.ToDateTime(timeTamp);
                Int32    expiredHour  = ConstHelper.DefaultInstance.ResetPwdExpiredHour;

                //签名不正确
                if (String.Equals(digest, NewDigest) == false || (sendMailTime.AddHours(expiredHour) < DateTime.Now))
                {
                    this.ResetPanel.Visible = false;
                    this.MsgPanel.Visible   = true;
                }
                else
                {
                    String ErrMsg = String.Empty;
                    Int32  result = SetMail.CheckEmaklSend(custid, email, authenCode, out ErrMsg);
                    if (result == 0)
                    {
                        this.hdCustID.Value    = custid;
                        this.hdReturnUrl.Value = returnUrl;
                    }
                    else
                    {
                        this.ResetPanel.Visible = false;
                        this.MsgPanel.Visible   = true;
                    }
                }
            }
            catch (Exception ex)
            {
                this.ResetPanel.Visible = false;
                this.MsgPanel.Visible   = true;
            }
        }
    }
Exemple #13
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 selEmail()
    {
        StringBuilder ResponseMsg = new StringBuilder();
        string        msg         = "";
        string        Email       = HttpUtility.HtmlDecode(Request["Email"].ToString());
        string        CustId      = HttpUtility.HtmlDecode(Request["CustID"].ToString());
        string        Spid        = HttpUtility.HtmlDecode(Request["SPID"].ToString());

        wt = Request["wt"];

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

        #endregion


        k = SetMail.EmailSel(CustId, Email, Spid, out msg);  // 查看该邮箱是否已经被别人注册   k =0 代表此邮箱尚未被用
        if (k == 0)
        {
            string a          = CommonBizRules.EncryptEmailWithNoReturnUrl(Spid, CustId, Email, HttpContext.Current);
            string url        = "点击完成认证:<a href='" + a + "'>" + a + "</a>";
            Random random     = new Random();
            string AuthenCode = random.Next(111111, 999999).ToString();
            y = SetMail.InsertEmailSendMassage(CustId, "2", url, AuthenCode, 1, Email, DateTime.Now, "描述", "中国电信号码百事通:激活邮箱", 0, out msg);

            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", y);
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", msg);
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", y);
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", msg);
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        else
        {   // 邮箱已经被注册掉
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", k);
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", msg);
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", k);
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", msg);
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
    }
    /// <summary>
    /// 通过邮箱找回密码
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    public String FindPwdByEmail(String SPID, String Email)
    {
        StringBuilder ResponseMsg = new StringBuilder();
        Int32         Result      = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg      = ErrorDefinition.BT_IError_Result_UnknowError_Msg;
        String        CustID      = String.Empty;

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

        try
        {
            Result = SetMail.EmailSel(Email, out CustID, out ErrMsg);
            if (Result != 0)
            {
                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());
            }
            else
            {
                string encryptPwd = "";
                string Pwd        = "";
                Result = FindPwd.SelPwdByEmailV2(Email, out encryptPwd, out ErrMsg);
                if (Result == 0)
                {
                    Pwd    = CryptographyUtil.Decrypt(encryptPwd);
                    Result = SetMail.InsertEmailSendMassage(CustID, "2", "您的密码是:" + Pwd, "", 1, Email, DateTime.Now, "找回密码", "中国电信号码百事通:找回密码", 0, out ErrMsg);
                    if (Result == 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
                    {
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-930");
                            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>", "-930");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }
                else
                {
                    //密码找回失败
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-940");
                        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>", "-940");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", 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}\",", "-950");
                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>", "-950");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }