Exemplo n.º 1
0
        protected void EBtnBatchDelete_Click(object sender, EventArgs e)
        {
            string strItemId = this.EgvUser.SelectList.ToString();

            this.CheckSelectListIsEmpty(strItemId, "<li>对不起,您还没选择要删除的会员!</li>");
            if (ApiData.IsAPiEnable())
            {
                string str2 = "";
                if (!DataValidator.IsValidId(strItemId))
                {
                    AdminPage.WriteErrMsg("<li>删除失败!</li>");
                }
                foreach (string str3 in strItemId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    UserInfo userById = Users.GetUserById(DataConverter.CLng(str3));
                    str2 = str2 + userById.UserName + ",";
                }
                string str4 = ApiFunction.DeleteUsers(str2.Remove(str2.Length - 1));
                if (str4 != "true")
                {
                    AdminPage.WriteErrMsg("<li>" + str4 + "</li><br><li>删除失败!</li>");
                }
            }
            if (Users.Delete(strItemId))
            {
                BasePage.ResponseRedirect("UserManage.aspx");
            }
            else
            {
                AdminPage.WriteErrMsg("<li>删除失败!</li>");
            }
        }
Exemplo n.º 2
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            if (this.TxtPasswords.Text != this.TxtConfirmPassword.Text)
            {
                DynamicPage.WriteErrMsg("<li>确认密码与新密码不一致!</li>");
            }
            UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);

            if (StringHelper.MD5(this.TxtOldPassword.Text.Trim()) != usersByUserName.UserPassword)
            {
                DynamicPage.WriteErrMsg("<li>输入的旧密码不正确!</li>");
            }
            else
            {
                usersByUserName.UserPassword = StringHelper.MD5(this.TxtPasswords.Text);
                if (ApiData.IsAPiEnable())
                {
                    string str = ApiFunction.UpdateUser(usersByUserName.UserName, this.TxtPasswords.Text, null, null, null, null, null, null, null, null, null, null, null, null, null);
                    if (str != "true")
                    {
                        DynamicPage.WriteErrMsg("<li>" + str + "</li>");
                    }
                }
                Users.Update(usersByUserName);
                DynamicPage.WriteSuccessMsg("<li>密码修改成功!</li>");
            }
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (PEContext.Current.User.Identity.IsAuthenticated)
     {
         UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);
         if (ApiData.IsAPiEnable())
         {
             ApiFunction.LogOff(usersByUserName.UserName);
         }
         FormsAuthentication.SignOut();
     }
     base.Response.Write("<script language=\"JavaScript\">window.location='../Default.aspx';</script>");
 }
Exemplo n.º 4
0
        protected void BtnStep3_Click(object sender, EventArgs e)
        {
            UserInfo usersByUserName = Users.GetUsersByUserName(this.TxtUserName.Text);

            usersByUserName.UserPassword = StringHelper.MD5(this.TxtPassword.Text);
            if (ApiData.IsAPiEnable())
            {
                string str = ApiFunction.UpdateUser(usersByUserName.UserName, this.TxtPassword.Text, null, null, null, null, null, null, null, null, null, null, null, null, null);
                if (str != "true")
                {
                    DynamicPage.WriteErrMsg("<li>" + str + "</li>");
                }
            }
            if (Users.Update(usersByUserName))
            {
                DynamicPage.WriteSuccessMsg("修改密码成功!", "default.aspx");
            }
        }
Exemplo n.º 5
0
 protected void BtnDelete_Click(object sender, EventArgs e)
 {
     if (ApiData.IsAPiEnable())
     {
         if (!DataValidator.IsValidId(this.userId.ToString()))
         {
             AdminPage.WriteErrMsg("<li>删除失败!</li>");
         }
         string str2 = ApiFunction.DeleteUsers(Users.GetUserById(this.userId).UserName);
         if (str2 != "true")
         {
             AdminPage.WriteErrMsg("<li>" + str2 + "</li><br><li>删除失败!</li>");
         }
     }
     if (Users.Delete(this.userId.ToString()))
     {
         BasePage.ResponseRedirect("UserManage.aspx");
     }
     else
     {
         AdminPage.WriteErrMsg("<li>删除会员失败!</li>");
     }
 }
Exemplo n.º 6
0
        private void UserLogin(XmlDocument xmlDoc)
        {
            bool          flag;
            DateTime      now;
            DateTime      time2;
            string        str7;
            UserPrincipal principal;
            string        nodeInnerText = GetNodeInnerText(xmlDoc, "//username");
            string        str2          = GetNodeInnerText(xmlDoc, "//password");
            string        str3          = GetNodeInnerText(xmlDoc, "//checkcode");
            string        str4          = GetNodeInnerText(xmlDoc, "//expiration");

            if (string.IsNullOrEmpty(nodeInnerText))
            {
                this.PutErrMessage("用户名不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(str2))
            {
                this.PutErrMessage("密码不能为空!");
                return;
            }
            if (SiteConfig.UserConfig.EnableCheckCodeOfLogOn && string.IsNullOrEmpty(str3))
            {
                this.PutErrMessage("验证码不能为空!");
                return;
            }
            UserInfo userInfo = new UserInfo();

            userInfo.UserName     = nodeInnerText;
            userInfo.UserPassword = str2;
            if (SiteConfig.UserConfig.EnableCheckCodeOfLogOn)
            {
                string strB = (this.Session["ValidateCodeSession"] == null) ? "" : this.Session["ValidateCodeSession"].ToString();
                if (string.Compare(str3, strB, StringComparison.OrdinalIgnoreCase) > 0)
                {
                    this.PutErrMessage("您输入的验证码错误!");
                    return;
                }
            }
            UserStatus status = Users.ValidateUser(userInfo);

            if ((Int32)status >= 100)
            {
                this.PutErrMessage("用户登录名称或用户密码不对!");
                return;
            }
            switch (status)
            {
            case UserStatus.None:
                flag  = false;
                now   = DateTime.Now;
                time2 = DateTime.Now;
                switch (str4)
                {
                case "None":
                    flag  = false;
                    time2 = now.AddMinutes(20.0);
                    break;

                case "Day":
                    flag  = true;
                    time2 = now.AddDays(1.0);
                    break;

                case "Month":
                    flag  = true;
                    time2 = now.AddMonths(1);
                    break;

                case "Year":
                    flag  = true;
                    time2 = now.AddYears(1);
                    break;
                }
                flag  = false;
                time2 = now.AddMinutes(20.0);
                break;

            case UserStatus.Locked:
                this.PutErrMessage("用户帐户被锁定!");
                return;

            case UserStatus.WaitValidateByEmail:
                this.PutErrMessage("用户帐户等待邮件验证!");
                return;

            case UserStatus.WaitValidateByAdmin:
                this.PutErrMessage("用户帐户等待管理员验证!");
                return;

            case UserStatus.WaitValidateByMobile:
                this.PutErrMessage("用户帐户等待手机验证!");
                return;

            default:
                this.PutErrMessage("用户登录名称或用户密码不对!");
                return;
            }
            string savecookie = "";

            if (!ApiData.IsAPiEnable())
            {
                goto Label_028F;
            }
            string str13 = str4;

            if (str13 != null)
            {
                if (!(str13 == "None"))
                {
                    if (str13 == "Day")
                    {
                        savecookie = "1";
                        goto Label_0263;
                    }
                    if (str13 == "Month")
                    {
                        savecookie = "30";
                        goto Label_0263;
                    }
                    if (str13 == "Year")
                    {
                        savecookie = "365";
                        goto Label_0263;
                    }
                }
                else
                {
                    savecookie = "-1";
                    goto Label_0263;
                }
            }
            savecookie = "-1";
Label_0263:
            str7 = ApiFunction.LogOn(nodeInnerText, str2, savecookie);
            if (str7 != "true")
            {
                this.PutErrMessage("登陆失败!" + str7);
                return;
            }
Label_028F:
            principal              = new UserPrincipal();
            principal.UserName     = userInfo.UserName;
            principal.LastPassword = userInfo.LastPassword;
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userInfo.UserName, now, time2, flag, principal.SerializeToString());
            string     str8   = FormsAuthentication.Encrypt(ticket);
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, str8);

            if (flag)
            {
                cookie.Expires = time2;
            }
            base.Response.Cookies.Add(cookie);
            HttpCookie cookie2 = new HttpCookie(FormsAuthentication.FormsCookieName + "IsUserLogOut", "false");

            cookie2.HttpOnly = true;
            cookie2.Path     = FormsAuthentication.FormsCookiePath;
            cookie2.Secure   = FormsAuthentication.RequireSSL;
            base.Response.Cookies.Add(cookie2);
            this.Session["UserName"] = userInfo.UserName;
            this.XmlResponseWriter.WriteElementString("status", "ok");
            this.XmlResponseWriter.WriteElementString("username", userInfo.UserName);
            this.XmlResponseWriter.WriteElementString("usergroup", userInfo.GroupName);
            if (ApiData.IsAPiEnable())
            {
                ApiData data   = new ApiData();
                string  apiKey = data.ApiKey;
                apiKey = StringHelper.MD5GB2312(userInfo.UserName + apiKey).Substring(8, 0x10);
                string str10 = "";
                foreach (string str11 in data.Urls)
                {
                    str10 = str10 + "<iframe width=\"0\" height=\"0\" src=\"" + str11 + "?syskey=" + apiKey + "&username="******"GB2312")) + "&password="******"&savecookie=" + savecookie + "\"></iframe>";
                }
                this.XmlResponseWriter.WriteElementString("API_Enable", "1");
                this.XmlResponseWriter.WriteElementString("LoginString", str10);
            }
            else
            {
                this.XmlResponseWriter.WriteElementString("API_Enable", "0");
            }
        }
Exemplo n.º 7
0
        protected void IbtnEnter_Click(object sender, ImageClickEventArgs e)
        {
            string        str2;
            UserPrincipal principal;
            UserInfo      userInfo = new UserInfo();

            userInfo.UserName     = this.TxtUserName.Text.Trim();
            userInfo.UserPassword = this.TxtPassword.Text.Trim();
            if (SiteConfig.UserConfig.EnableCheckCodeOfLogOn && (string.Compare(this.TxtValidateCode.Text.Trim(), this.VcodeLogOn.ValidateCodeValue, StringComparison.OrdinalIgnoreCase) != 0))
            {
                DynamicPage.WriteErrMsg("<li>您输入的验证码和系统产生的不一致,请重新输入。</li>");
            }
            UserStatus status = Users.ValidateUser(userInfo);

            if ((int)status >= 100)
            {
                DynamicPage.WriteErrMsg("<li>用户登录名称或用户密码不对!</li>");
            }
            if (status != UserStatus.None)
            {
                switch (status)
                {
                case UserStatus.Locked:
                    DynamicPage.WriteErrMsg("<li>用户帐户被锁定!</li>");
                    return;

                case UserStatus.WaitValidateByEmail:
                    DynamicPage.WriteErrMsg("<li>用户帐户等待邮件验证!</li>");
                    return;

                case (UserStatus.WaitValidateByEmail | UserStatus.Locked):
                    goto Label_0344;

                case UserStatus.WaitValidateByAdmin:
                    DynamicPage.WriteErrMsg("<li>用户帐户等待管理员验证!</li>");
                    return;

                case UserStatus.WaitValidateByMobile:
                    DynamicPage.WriteErrMsg("<li>用户帐户等待手机验证!</li>");
                    return;
                }
                goto Label_0344;
            }
            bool     isPersistent  = false;
            DateTime now           = DateTime.Now;
            DateTime expiration    = DateTime.Now;
            string   selectedValue = this.DropExpiration.SelectedValue;

            if (selectedValue != null)
            {
                if (!(selectedValue == "None"))
                {
                    if (selectedValue == "Day")
                    {
                        isPersistent = true;
                        expiration   = now.AddDays(1.0);
                        goto Label_013F;
                    }
                    if (selectedValue == "Month")
                    {
                        isPersistent = true;
                        expiration   = now.AddMonths(1);
                        goto Label_013F;
                    }
                    if (selectedValue == "Year")
                    {
                        isPersistent = true;
                        expiration   = now.AddYears(1);
                        goto Label_013F;
                    }
                }
                else
                {
                    isPersistent = false;
                    expiration   = now.AddDays(1.0);
                    goto Label_013F;
                }
            }
            isPersistent = false;
            expiration   = now.AddMinutes(20.0);
Label_013F:
            if (!ApiData.IsAPiEnable())
            {
                goto Label_0230;
            }
            string savecookie = "";
            string str5       = this.DropExpiration.SelectedValue;

            if (str5 != null)
            {
                if (!(str5 == "None"))
                {
                    if (str5 == "Day")
                    {
                        savecookie = "1";
                        goto Label_01C5;
                    }
                    if (str5 == "Month")
                    {
                        savecookie = "30";
                        goto Label_01C5;
                    }
                    if (str5 == "Year")
                    {
                        savecookie = "365";
                        goto Label_01C5;
                    }
                }
                else
                {
                    savecookie = "-1";
                    goto Label_01C5;
                }
            }
            savecookie = "-1";
Label_01C5:
            str2 = ApiFunction.LogOn(this.TxtUserName.Text, this.TxtPassword.Text, savecookie);
            if (str2 != "true")
            {
                DynamicPage.WriteErrMsg(str2 + "<br><li>用户登录名称或用户密码不对或用户帐号处于非正常状态!</li>");
                return;
            }
            str2 = ApiFunction.RegLogOn(this.TxtUserName.Text, this.TxtPassword.Text, savecookie);
            base.Response.Write(str2);
Label_0230:
            principal              = new UserPrincipal();
            principal.UserName     = userInfo.UserName;
            principal.LastPassword = userInfo.LastPassword;
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userInfo.UserName, now, expiration, isPersistent, principal.SerializeToString());
            string     str3   = FormsAuthentication.Encrypt(ticket);
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, str3);

            if (isPersistent)
            {
                cookie.Expires = expiration;
            }
            cookie.HttpOnly = true;
            cookie.Path     = FormsAuthentication.FormsCookiePath;
            cookie.Secure   = FormsAuthentication.RequireSSL;
            base.Response.Cookies.Add(cookie);
            this.Session["UserName"] = userInfo.UserName;
            base.Response.Write("<script language=\"JavaScript\">window.location='" + GetRedirectUrl() + "';</script>");
            return;

Label_0344:
            DynamicPage.WriteErrMsg("<li>用户登录名称或用户密码不对!</li>");
        }
Exemplo n.º 8
0
        protected void BtnLogOn_Click(object sender, EventArgs e)
        {
            bool          flag;
            DateTime      now;
            DateTime      time2;
            string        str2;
            UserPrincipal principal;
            UserInfo      userInfo = new UserInfo();

            userInfo.UserName     = this.TxtUserName.Text.Trim();
            userInfo.UserPassword = this.TxtPassword.Text.Trim();
            if (SiteConfig.UserConfig.EnableCheckCodeOfLogOn && (string.Compare(this.TxtValidateCode.Text.Trim(), this.VcodeLogOn.ValidateCodeValue, StringComparison.OrdinalIgnoreCase) != 0))
            {
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitMessage.Text         = "<li>您输入的验证码和系统产生的不一致,请重新输入。</li>";
            }
            UserStatus status = Users.ValidateUser(userInfo);

            if ((int)status >= 100)
            {
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitErrorMessage.Text    = "<li>用户登录名称或用户密码不对!</li><br />";
                return;
            }
            switch (status)
            {
            case UserStatus.None:
                flag  = false;
                now   = DateTime.Now;
                time2 = DateTime.Now;
                switch (this.DropExpiration.SelectedValue)
                {
                case "None":
                    flag  = false;
                    time2 = now.AddDays(1.0);
                    break;

                case "Day":
                    flag  = true;
                    time2 = now.AddDays(1.0);
                    break;

                case "Month":
                    flag  = true;
                    time2 = now.AddMonths(1);
                    break;

                case "Year":
                    flag  = true;
                    time2 = now.AddYears(1);
                    break;
                }
                flag  = false;
                time2 = now.AddMinutes(20.0);
                break;

            case UserStatus.Locked:
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitErrorMessage.Text    = "<li>用户帐号被锁定!</li><br />";
                return;

            case UserStatus.WaitValidateByEmail:
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitErrorMessage.Text    = "<li>用户帐号等待邮件验证!</li><br />";
                return;

            case UserStatus.WaitValidateByAdmin:
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitErrorMessage.Text    = "<li>用户帐号等待管理员验证!</li><br />";
                return;

            case UserStatus.WaitValidateByMobile:
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitErrorMessage.Text    = "<li>用户帐号等待手机验证!</li><br />";
                return;

            default:
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitErrorMessage.Text    = "<li>用户登录名称或用户密码不对或用户帐号处于非正常状态!</li><br />";
                return;
            }
            if (!ApiData.IsAPiEnable())
            {
                goto Label_02B0;
            }
            string savecookie    = "";
            string selectedValue = this.DropExpiration.SelectedValue;

            if (selectedValue != null)
            {
                if (!(selectedValue == "None"))
                {
                    if (selectedValue == "Day")
                    {
                        savecookie = "1";
                        goto Label_0247;
                    }
                    if (selectedValue == "Month")
                    {
                        savecookie = "30";
                        goto Label_0247;
                    }
                    if (selectedValue == "Year")
                    {
                        savecookie = "365";
                        goto Label_0247;
                    }
                }
                else
                {
                    savecookie = "-1";
                    goto Label_0247;
                }
            }
            savecookie = "-1";
Label_0247:
            str2 = ApiFunction.LogOn(this.TxtUserName.Text, this.TxtPassword.Text, savecookie);
            if (str2 != "true")
            {
                this.PnlLogOnMessage.Visible = true;
                this.PnlLogOn.Visible        = false;
                this.PnlLogOnStatus.Visible  = false;
                this.LitErrorMessage.Text    = "<li>登陆失败</li><br>" + str2;
                return;
            }
Label_02B0:
            principal              = new UserPrincipal();
            principal.UserName     = userInfo.UserName;
            principal.LastPassword = userInfo.LastPassword;
            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userInfo.UserName, now, time2, flag, principal.SerializeToString());
            string     str3   = FormsAuthentication.Encrypt(ticket);
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, str3);

            if (flag)
            {
                cookie.Expires = time2;
            }
            cookie.HttpOnly = true;
            cookie.Path     = FormsAuthentication.FormsCookiePath;
            cookie.Secure   = FormsAuthentication.RequireSSL;
            base.Response.Cookies.Add(cookie);
            this.Session["UserName"] = userInfo.UserName;
            base.Response.Redirect(base.Request.RawUrl);
        }
Exemplo n.º 9
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);

            if (!string.IsNullOrEmpty(this.TxtUserPassword.Text))
            {
                usersByUserName.UserPassword = StringHelper.MD5(this.TxtUserPassword.Text.ToLower());
            }
            if (!string.IsNullOrEmpty(this.TxtAnswer.Text))
            {
                usersByUserName.Answer = StringHelper.MD5(this.TxtAnswer.Text);
            }
            usersByUserName.Question       = this.TxtQuestion.Text;
            usersByUserName.Email          = this.TxtEmail.Text;
            usersByUserName.UserFace       = this.TxtUserFace.Text;
            usersByUserName.FaceWidth      = DataConverter.CLng(this.TxtFaceWidth.Text);
            usersByUserName.FaceHeight     = DataConverter.CLng(this.TxtFaceHeight.Text);
            usersByUserName.Sign           = this.TxtSign.Text;
            usersByUserName.PrivacySetting = DataConverter.CLng(this.RadlPrivacySetting.SelectedValue);
            usersByUserName.UserTrueName   = this.TxtTrueName.Text.Trim();
            ContacterInfo contacterInfo = new ContacterInfo();

            contacterInfo.ContacterId = DataConverter.CLng(this.HdnContacterID.Value);
            contacterInfo.UserName    = usersByUserName.UserName;
            contacterInfo.TrueName    = this.TxtTrueName.Text;
            contacterInfo.Title       = this.TxtTitle.Text;
            this.PersonalInformation1.GetContacter(contacterInfo);
            this.LiaisonInformation1.GetContacter(contacterInfo);
            usersByUserName.Sex          = this.PersonalInformation1.UserSex;
            contacterInfo.Company        = this.TxtCompany.Text;
            contacterInfo.Department     = this.TxtDepartment.Text;
            contacterInfo.Position       = this.TxtPosition.Text;
            contacterInfo.Operation      = this.TxtOperation.Text;
            contacterInfo.CompanyAddress = this.TxtCompanyAddress.Text;
            contacterInfo.ClientId       = 0;
            contacterInfo.ParentId       = 0;
            contacterInfo.CreateTime     = DateTime.Now;
            contacterInfo.Owner          = "";
            contacterInfo.UserType       = ContacterType.EnterpriceMainContacter;
            contacterInfo.UpdateTime     = DateTime.Now;
            if (ApiData.IsAPiEnable())
            {
                string str = ApiFunction.UpdateUser(usersByUserName.UserName, this.TxtUserPassword.Text, usersByUserName.Email, usersByUserName.Question, this.TxtAnswer.Text, usersByUserName.UserTrueName, usersByUserName.Sex.ToString(), contacterInfo.Birthday.ToString(), contacterInfo.QQ, contacterInfo.Msn, contacterInfo.Mobile, contacterInfo.OfficePhone, contacterInfo.Address, contacterInfo.ZipCode, contacterInfo.Homepage);
                if (str != "true")
                {
                    DynamicPage.WriteErrMsg("<li>" + str + "</li>");
                }
            }
            if (Users.Update(usersByUserName, contacterInfo))
            {
                if (usersByUserName.UserType == UserType.Creator)
                {
                    this.Company1.Action    = "modify";
                    this.Company1.CompanyId = usersByUserName.CompanyId;
                    Company.Update(this.Company1.CompanyInfo);
                }
                DynamicPage.WriteSuccessMsg("<li>修改" + PEContext.Current.User.UserName + "会员信息成功!</li>", "../Default.aspx");
            }
            else
            {
                DynamicPage.WriteErrMsg("<li>修改" + PEContext.Current.User.UserName + "会员信息失败!</li>");
            }
        }
Exemplo n.º 10
0
        protected void btnSendEmail_Click(object sender, EventArgs e)
        {
            UserInfo usersByUserName = Users.GetUsersByUserName(this.TxtUserName.Text);

            if (this.RadPwdType.SelectedValue == "0")
            {
                string newPassword = this.m_NewPassword;
                usersByUserName.UserPassword = StringHelper.MD5(newPassword);
                MailInfo mailInfo = new MailInfo();
                mailInfo.FromName = SiteConfig.SiteInfo.WebmasterEmail;
                List <MailAddress> list = new List <MailAddress>();
                list.Add(new MailAddress(usersByUserName.Email));
                mailInfo.MailToAddressList = list;
                mailInfo.MailBody          = "你在" + SiteConfig.SiteInfo.SiteName + "网站的用户新密码为" + newPassword + ",请及时到" + SiteConfig.SiteInfo.SiteUrl + "用户中心登录修改密码!";
                mailInfo.Subject           = "新密码已发送到你的邮箱";
                if (SendMail.Send(mailInfo) == MailState.Ok)
                {
                    if (ApiData.IsAPiEnable())
                    {
                        string str2 = ApiFunction.UpdateUser(usersByUserName.UserName, newPassword, null, null, null, null, null, null, null, null, null, null, null, null, null);
                        if (str2 != "true")
                        {
                            DynamicPage.WriteErrMsg("<li>" + str2 + "</li>");
                        }
                    }
                    if (Users.Update(usersByUserName))
                    {
                        DynamicPage.WriteSuccessMsg("新密码已发送到你的邮箱!请注意查收并及时修改密码! 如无法接收到,请与网站管理员联系!", "../default.aspx");
                    }
                    else
                    {
                        DynamicPage.WriteErrMsg("新密码已发送到你的邮箱!但网站系统无法修改旧密码,使用新密码可能无法登录! 请与网站管理员联系!", "../default.aspx");
                    }
                }
                else
                {
                    DynamicPage.WriteErrMsg("新密码发送到你的邮箱时不成功,请与网站管理员联系!", "../default.aspx");
                }
            }
            else
            {
                string input = this.m_NewPassword;
                usersByUserName.PayPassword = StringHelper.MD5(input);
                MailInfo info3 = new MailInfo();
                info3.FromName = SiteConfig.SiteInfo.WebmasterEmail;
                List <MailAddress> list2 = new List <MailAddress>();
                list2.Add(new MailAddress(usersByUserName.Email));
                info3.MailToAddressList = list2;
                info3.MailBody          = "你在" + SiteConfig.SiteInfo.SiteName + "网站的用户新预付款支付密码为" + input + ",请及时到" + SiteConfig.SiteInfo.SiteUrl + "用户中心登录修改预付款支付密码!";
                info3.Subject           = "新预付款支付密码已发送到你的邮箱";
                if (SendMail.Send(info3) == MailState.Ok)
                {
                    if (Users.Update(usersByUserName))
                    {
                        DynamicPage.WriteSuccessMsg("新预付款支付密码已发送到你的邮箱!请注意查收并及时修改密码! 如无法接收到,请与网站管理员联系!", "../default.aspx");
                    }
                    else
                    {
                        DynamicPage.WriteErrMsg("新预付款支付密码已发送到你的邮箱!但网站系统无法修改旧密码,使用新密码可能无法登录! 请与网站管理员联系!", "../default.aspx");
                    }
                }
                else
                {
                    DynamicPage.WriteErrMsg("新预付款支付密码发送到你的邮箱时不成功,请与网站管理员联系!", "../default.aspx");
                }
            }
        }
Exemplo n.º 11
0
 protected void BtnStep2_Click(object sender, EventArgs e)
 {
     this.PnlStep1.Visible = false;
     this.PnlStep2.Visible = false;
     if (this.TxtValidateCode.Text == this.VcodeLogOn.ValidateCodeValue)
     {
         UserInfo usersByUserName = Users.GetUsersByUserName(this.TxtUserName.Text);
         if (!usersByUserName.IsNull)
         {
             string str = StringHelper.MD5(this.TxtAnswer.Text);
             if (this.RadListPwdType.SelectedValue == "0")
             {
                 if (StringHelper.ValidateMD5(usersByUserName.Answer, str))
                 {
                     if (SiteConfig.UserConfig.UserGetPasswordType != 0)
                     {
                         string newPassword = this.m_NewPassword;
                         usersByUserName.UserPassword = StringHelper.MD5(newPassword);
                         MailInfo mailInfo = new MailInfo();
                         mailInfo.FromName = SiteConfig.SiteInfo.WebmasterEmail;
                         List <MailAddress> list = new List <MailAddress>();
                         list.Add(new MailAddress(usersByUserName.Email));
                         mailInfo.MailToAddressList = list;
                         mailInfo.MailBody          = "你在" + SiteConfig.SiteInfo.SiteName + "网站的用户新密码为" + newPassword + ",请及时到" + SiteConfig.SiteInfo.SiteUrl + "用户中心登录修改密码!";
                         mailInfo.Subject           = "新密码已发送到你的邮箱";
                         if (SendMail.Send(mailInfo) == MailState.Ok)
                         {
                             if (ApiData.IsAPiEnable())
                             {
                                 string str3 = ApiFunction.UpdateUser(usersByUserName.UserName, newPassword, null, null, null, null, null, null, null, null, null, null, null, null, null);
                                 if (str3 != "true")
                                 {
                                     DynamicPage.WriteErrMsg("<li>" + str3 + "</li>");
                                 }
                             }
                             if (Users.Update(usersByUserName))
                             {
                                 DynamicPage.WriteSuccessMsg("新密码已发送到你的邮箱!请注意查收并及时修改密码! 如无法接收到,请与网站管理员联系!", "../default.aspx");
                             }
                             else
                             {
                                 DynamicPage.WriteErrMsg("新密码已发送到你的邮箱!但网站系统无法修改旧密码,使用新密码可能无法登录! 请与网站管理员联系!", "../default.aspx");
                             }
                         }
                         else
                         {
                             DynamicPage.WriteErrMsg("新密码发送到你的邮箱时不成功,请与网站管理员联系!", "../default.aspx");
                         }
                     }
                     else
                     {
                         this.PnlStep3.Visible = true;
                     }
                 }
                 else
                 {
                     DynamicPage.WriteErrMsg("你回答的问题不对");
                 }
             }
             else if (SiteConfig.UserConfig.UserGetPasswordType != 0)
             {
                 string input = this.m_NewPassword;
                 usersByUserName.PayPassword = StringHelper.MD5(input);
                 MailInfo info3 = new MailInfo();
                 info3.FromName = SiteConfig.SiteInfo.WebmasterEmail;
                 List <MailAddress> list2 = new List <MailAddress>();
                 list2.Add(new MailAddress(usersByUserName.Email));
                 info3.MailToAddressList = list2;
                 info3.MailBody          = "你在" + SiteConfig.SiteInfo.SiteName + "网站的用户新预付款支付密码为" + input + ",请及时到" + SiteConfig.SiteInfo.SiteUrl + "用户中心登录修改预付款支付密码!";
                 info3.Subject           = "新预付款支付密码已发送到你的邮箱";
                 if (SendMail.Send(info3) == MailState.Ok)
                 {
                     if (Users.Update(usersByUserName))
                     {
                         DynamicPage.WriteSuccessMsg("新预付款支付密码已发送到你的邮箱!请注意查收并及时修改密码! 如无法接收到,请与网站管理员联系!", "../default.aspx");
                     }
                     else
                     {
                         DynamicPage.WriteErrMsg("新预付款支付密码已发送到你的邮箱!但网站系统无法修改旧密码,使用新密码可能无法登录! 请与网站管理员联系!", "../default.aspx");
                     }
                 }
                 else
                 {
                     DynamicPage.WriteErrMsg("新预付款支付密码发送到你的邮箱时不成功,请与网站管理员联系!", "../default.aspx");
                 }
             }
             else
             {
                 this.PalChangePayPassword.Visible = true;
             }
         }
     }
     else
     {
         DynamicPage.WriteErrMsg("你输入的验证码不对");
     }
 }
Exemplo n.º 12
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            UserInfo info;
            bool     flag = false;
            int      num  = DataConverter.CLng(this.DropGroupId.SelectedValue);

            if (this.ViewState["UserInfo"] != null)
            {
                info = this.ViewState["UserInfo"] as UserInfo;
            }
            else
            {
                info = new UserInfo();
            }
            if (!string.IsNullOrEmpty(this.TxtQuestion.Text))
            {
                info.Question = this.TxtQuestion.Text;
            }
            if (!string.IsNullOrEmpty(this.TxtAnswer.Text))
            {
                info.Answer = StringHelper.MD5(this.TxtAnswer.Text);
            }
            info.GroupId        = num;
            info.Email          = this.TxtEmail.Text;
            info.UserFace       = this.TxtUserFace.Text;
            info.FaceWidth      = DataConverter.CLng(this.TxtFaceWidth.Text);
            info.FaceHeight     = DataConverter.CLng(this.TxtFaceHeight.Text);
            info.Sign           = this.TxtSign.Text;
            info.PrivacySetting = DataConverter.CLng(this.RadlPrivacySetting.SelectedValue);
            info.UserTrueName   = this.TxtTrueName.Text.Trim();
            ContacterInfo contacterInfo = new ContacterInfo();

            contacterInfo.ContacterId = DataConverter.CLng(this.HdnContacterID.Value);
            contacterInfo.UserName    = info.UserName;
            contacterInfo.TrueName    = this.TxtTrueName.Text;
            contacterInfo.Title       = this.TxtTitle.Text;
            this.PersonalInformation1.GetContacter(contacterInfo);
            this.LiaisonInformation1.GetContacter(contacterInfo);
            info.Sex = this.PersonalInformation1.UserSex;
            contacterInfo.Company        = this.TxtCompany.Text;
            contacterInfo.Department     = this.TxtDepartment.Text;
            contacterInfo.Position       = this.TxtPosition.Text;
            contacterInfo.Operation      = this.TxtOperation.Text;
            contacterInfo.CompanyAddress = this.TxtCompanyAddress.Text;
            contacterInfo.ClientId       = 0;
            contacterInfo.ParentId       = 0;
            contacterInfo.CreateTime     = DateTime.Now;
            contacterInfo.Owner          = "";
            contacterInfo.UserType       = ContacterType.EnterpriceMainContacter;
            contacterInfo.UpdateTime     = DateTime.Now;
            if (string.Compare(this.ViewState["action"].ToString(), "Add", StringComparison.OrdinalIgnoreCase) == 0)
            {
                info.UserName           = Users.UserNamefilter(this.TxtUserName.Text);
                info.UserPassword       = StringHelper.MD5(this.TxtUserPassword.Text.ToLower());
                info.JoinTime           = DateTime.Now;
                info.RegTime            = DateTime.Now;
                info.Status             = UserStatus.None;
                info.IsInheritGroupRole = true;
                contacterInfo.UserName  = info.UserName;
                if (Users.Exists(info.UserName))
                {
                    AdminPage.WriteSuccessMsg("<li>该用户名已被他人占用,请输入不同的用户名!</li>");
                }
                else
                {
                    if (ApiData.IsAPiEnable())
                    {
                        string str = ApiFunction.RegUser(info.UserName, this.TxtUserPassword.Text.ToLower(), info.Question, info.Answer, info.Email, contacterInfo.TrueName, contacterInfo.Sex.ToString(), contacterInfo.Birthday.ToString(), contacterInfo.QQ, contacterInfo.Msn, contacterInfo.Mobile, contacterInfo.OfficePhone, contacterInfo.Province, contacterInfo.City, contacterInfo.Address, contacterInfo.ZipCode, contacterInfo.Homepage);
                        if (str != "true")
                        {
                            AdminPage.WriteErrMsg(str + "<br><li>增加失败!</li>");
                        }
                    }
                    flag = Users.Add(info, contacterInfo);
                }
            }
            else
            {
                if (this.TxtUserPassword.Text != info.UserPassword)
                {
                    info.UserPassword = StringHelper.MD5(this.TxtUserPassword.Text.ToLower());
                }
                if (ApiData.IsAPiEnable())
                {
                    string str2 = ApiFunction.UpdateUser(info.UserName, this.TxtUserPassword.Text.ToLower(), info.Email, info.Question, this.TxtAnswer.Text, info.UserTrueName, info.Sex.ToString(), contacterInfo.Birthday.ToString(), contacterInfo.QQ, contacterInfo.Msn, contacterInfo.Mobile, contacterInfo.OfficePhone, contacterInfo.Address, contacterInfo.ZipCode, contacterInfo.Homepage);
                    if (str2 != "true")
                    {
                        AdminPage.WriteErrMsg("<li>" + str2 + "</li>");
                    }
                }
                flag = Users.Update(info, contacterInfo);
                if (info.UserType == UserType.Creator)
                {
                    this.Company1.Action    = this.ViewState["action"].ToString();
                    this.Company1.CompanyId = info.CompanyId;
                    Company.Update(this.Company1.CompanyInfo);
                }
            }
            string returnurl = "UserShow.aspx?UserID=" + info.UserId.ToString();

            if (DataConverter.CBoolean(BasePage.RequestString("Administrator")))
            {
                returnurl = "Administrator.aspx?UserName="******"<li>保存会员信息成功!</li>", returnurl);
            }
            else
            {
                AdminPage.WriteErrMsg("<li>保存会员信息失败!</li>");
            }
        }
Exemplo n.º 13
0
        protected void BtnRegister_Click(object sender, EventArgs e)
        {
            IEncourageStrategy <int> strategy2;

            if (!this.userSiteConfig.EnableUserReg)
            {
                return;
            }
            if (!this.Page.IsValid)
            {
                return;
            }
            this.CheckUserName();
            this.CheckEmail();
            UserInfo usersInfo = new UserInfo();

            usersInfo.Email          = this.TxtEmail.Text;
            usersInfo.FaceWidth      = 0;
            usersInfo.FaceHeight     = 0;
            usersInfo.PrivacySetting = 0;
            ContacterInfo contacterInfo = new ContacterInfo();

            contacterInfo.Sex            = (UserSexType)Enum.Parse(typeof(UserSexType), "0");
            contacterInfo.Marriage       = (UserMarriageType)Enum.Parse(typeof(UserMarriageType), "0");
            contacterInfo.Income         = -1;
            contacterInfo.Education      = -1;
            contacterInfo.ClientId       = 0;
            contacterInfo.ParentId       = 0;
            contacterInfo.CreateTime     = DateTime.Now;
            contacterInfo.Owner          = "";
            contacterInfo.UserType       = ContacterType.EnterpriceMainContacter;
            contacterInfo.UpdateTime     = DateTime.Now;
            contacterInfo.UserName       = Users.UserNamefilter(this.TxtRegUserName.Text);
            contacterInfo.Birthday       = null;
            usersInfo.UserName           = Users.UserNamefilter(this.TxtRegUserName.Text);
            usersInfo.UserPassword       = StringHelper.MD5(this.TxtRegPassword.Text);
            usersInfo.GroupId            = this.userSiteConfig.GroupId;
            usersInfo.JoinTime           = DateTime.Now;
            usersInfo.RegTime            = DateTime.Now;
            usersInfo.UserExp            = (int)this.userSiteConfig.PresentExp;
            usersInfo.UserPoint          = 0;
            usersInfo.IsInheritGroupRole = true;
            usersInfo.Status             = UserStatus.None;
            string str = DataSecurity.MakeRandomString(10);

            usersInfo.LastPassword = str;
            if (this.userSiteConfig.EmailCheckReg)
            {
                usersInfo.Status   = UserStatus.WaitValidateByEmail;
                usersInfo.CheckNum = DataSecurity.MakeRandomString("abcdefghijklmnopqrstuvwxyz0123456789_", 10);
            }
            if (this.userSiteConfig.AdminCheckReg)
            {
                usersInfo.Status = UserStatus.WaitValidateByAdmin;
            }
            if (this.userSiteConfig.EmailCheckReg && this.userSiteConfig.AdminCheckReg)
            {
                usersInfo.Status = UserStatus.WaitValidateByAdmin | UserStatus.WaitValidateByEmail;
            }
            usersInfo.EndTime = new DateTime?(DateTime.Now);
            usersInfo.Balance = 0M;
            string str2 = "";

            if (ApiData.IsAPiEnable())
            {
                str2 = ApiFunction.RegUser(usersInfo.UserName, this.TxtRegPassword.Text, usersInfo.Question, usersInfo.Answer, usersInfo.Email, contacterInfo.TrueName, contacterInfo.Sex.ToString(), contacterInfo.Birthday.ToString(), contacterInfo.QQ, contacterInfo.Msn, contacterInfo.Mobile, contacterInfo.OfficePhone, contacterInfo.Province, contacterInfo.City, contacterInfo.Address, contacterInfo.ZipCode, contacterInfo.Homepage);
                if (str2 != "true")
                {
                    DynamicPage.WriteErrMsg(str2 + "<br><li>注册失败!</li>");
                }
                str2 = ApiFunction.RegLogOn(usersInfo.UserName, this.TxtRegPassword.Text, "1");
            }
            if (!Users.Add(usersInfo, contacterInfo))
            {
                DynamicPage.WriteErrMsg("<li>注册失败!</li>");
                return;
            }
            if (this.userSiteConfig.PresentMoney != 0.0)
            {
                IEncourageStrategy <decimal> strategy = new UserMoney();
                strategy.IncreaseForUsers(usersInfo.UserId.ToString(), (decimal)this.userSiteConfig.PresentMoney, "注册时赠送的金钱", true, "注册时赠送的金钱");
            }
            if (this.userSiteConfig.PresentValidNum == 0)
            {
                goto Label_03EF;
            }
            int howMany = 0;

            if (this.userSiteConfig.PresentValidNum == -1)
            {
                howMany = 0x270f;
            }
            else
            {
                switch (this.userSiteConfig.PresentValidUnit)
                {
                case 1:
                    howMany = this.userSiteConfig.PresentValidNum;
                    goto Label_03C4;

                case 2:
                    howMany = this.userSiteConfig.PresentValidNum * 30;
                    goto Label_03C4;

                case 3:
                    howMany = this.userSiteConfig.PresentValidNum * 0x16d;
                    goto Label_03C4;
                }
                howMany = this.userSiteConfig.PresentValidNum;
            }
            Label_03C4:
            strategy2 = new UserDate();
            strategy2.IncreaseForUsers(usersInfo.UserId.ToString(), howMany, "注册时赠送有效期", true, "注册时赠送有效期");
Label_03EF:
            if (this.userSiteConfig.PresentPoint != 0)
            {
                IEncourageStrategy <int> strategy3 = new UserPoint();
                strategy3.IncreaseForUsers(usersInfo.UserId.ToString(), this.userSiteConfig.PresentPoint, "注册时赠送点券", true, "注册时赠送点券");
            }
            if (this.userSiteConfig.EmailCheckReg)
            {
                MailInfo mailInfo = new MailInfo();
                mailInfo.IsBodyHtml = true;
                mailInfo.FromName   = SiteConfig.SiteInfo.SiteName;
                List <MailAddress> list = new List <MailAddress>();
                list.Add(new MailAddress(usersInfo.Email));
                mailInfo.MailToAddressList = list;
                mailInfo.MailBody          = this.userSiteConfig.EmailOfRegCheck.Replace("{$CheckNum}", usersInfo.CheckNum).Replace("{$CheckUrl}", base.Request.Url.GetLeftPart(UriPartial.Authority) + base.BasePath + "User/RegisterCheck.aspx?UserName="******"&CheckNum=" + usersInfo.CheckNum);
                mailInfo.Subject           = SiteConfig.SiteInfo.SiteName + "网站会员注册验证码";
                if (SendMail.Send(mailInfo) == MailState.Ok)
                {
                    DynamicPage.WriteSuccessMsg("<li>注册验证码已成功发送到你的注册邮箱,请到邮箱查收并验证!</li>" + str2, "../Default.aspx");
                }
                else
                {
                    DynamicPage.WriteSuccessMsg("<li>注册成功,但发送验证邮件失败,请检查邮件地址是否正确,或与网站管理员联系!</li>" + str2, "../Default.aspx");
                }
            }
            string str3 = "";

            if (this.userSiteConfig.EnableRegCompany)
            {
                str3 = "<li><a href='/Company/RegCompany.aspx'>继续注册企业?</a></li>";
            }
            if (usersInfo.Status == UserStatus.None)
            {
                bool     isPersistent = false;
                DateTime now          = DateTime.Now;
                DateTime expiration   = DateTime.Now;
                isPersistent = false;
                expiration   = now.AddDays(1.0);
                UserPrincipal principal = new UserPrincipal();
                principal.UserName     = usersInfo.UserName;
                principal.LastPassword = usersInfo.LastPassword;
                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, usersInfo.UserName, now, expiration, isPersistent, principal.SerializeToString());
                string     str4   = FormsAuthentication.Encrypt(ticket);
                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, str4);
                if (isPersistent)
                {
                    cookie.Expires = expiration;
                }
                cookie.HttpOnly = true;
                cookie.Path     = FormsAuthentication.FormsCookiePath;
                cookie.Secure   = FormsAuthentication.RequireSSL;
                base.Response.Cookies.Add(cookie);
                this.Session["UserName"] = usersInfo.UserName;
            }
            if (SiteConfig.ShopConfig.IsPayPassword)
            {
                BasePage.ResponseRedirect("../User/RegisterPayPassword.aspx?Url=FastRegister");
            }
            else
            {
                DynamicPage.WriteSuccessMsg("<li>注册成功!" + str3 + "</li>" + str2, "../Shop/Payment.aspx");
            }
        }
Exemplo n.º 14
0
        protected void BtnRegStep2_Click(object sender, EventArgs e)
        {
            IEncourageStrategy <int> strategy2;

            if (!this.userSiteConfig.EnableUserReg)
            {
                return;
            }
            if (!this.Page.IsValid)
            {
                return;
            }
            this.CheckUserName();
            this.CheckEmail();
            this.CheckCode();
            this.CheckQAofReg();
            UserInfo usersInfo = new UserInfo();

            usersInfo.Question       = this.TxtQuestion.Text;
            usersInfo.Answer         = StringHelper.MD5(this.TxtAnswer.Text);
            usersInfo.Email          = this.TxtEmail.Text;
            usersInfo.UserFace       = this.TxtUserFace.Text;
            usersInfo.FaceWidth      = DataConverter.CLng(this.TxtFaceWidth.Text);
            usersInfo.FaceHeight     = DataConverter.CLng(this.TxtFaceHeight.Text);
            usersInfo.Sign           = this.TxtSign.Text;
            usersInfo.PrivacySetting = DataConverter.CLng(this.DropPrivacy.SelectedValue);
            string str = DataSecurity.MakeRandomString(10);

            usersInfo.LastPassword = str;
            ContacterInfo contacterInfo = new ContacterInfo();

            contacterInfo.TrueName    = this.TxtTrueName.Text;
            contacterInfo.Country     = this.Region.Country;
            contacterInfo.Province    = this.Region.Province;
            contacterInfo.City        = this.Region.City;
            contacterInfo.Address     = this.TxtAddress.Text;
            contacterInfo.ZipCode     = this.TxtZipCode.Text;
            contacterInfo.OfficePhone = this.TxtOfficePhone.Text;
            contacterInfo.HomePhone   = this.TxtHomePhone.Text;
            contacterInfo.Mobile      = this.TxtMobile.Text;
            contacterInfo.Fax         = this.TxtFax.Text;
            contacterInfo.Homepage    = this.TxtHomepage.Text;
            contacterInfo.Email       = this.TxtEmail.Text;
            contacterInfo.QQ          = this.TxtQQ.Text;
            contacterInfo.Msn         = this.TxtMSN.Text;
            contacterInfo.Icq         = this.TxtICQ.Text;
            contacterInfo.Yahoo       = this.TxtYahoo.Text;
            contacterInfo.UC          = this.TxtUC.Text;
            contacterInfo.Aim         = this.TxtAim.Text;
            contacterInfo.IdCard      = this.TxtIDCard.Text;
            contacterInfo.Sex         = (UserSexType)Enum.Parse(typeof(UserSexType), this.DropSex.SelectedValue);
            contacterInfo.Marriage    = (UserMarriageType)Enum.Parse(typeof(UserMarriageType), DataConverter.CLng(this.DropMarriage.SelectedValue).ToString());
            if (this.GetDisplayStyle("Income") != "none")
            {
                contacterInfo.Income = DataConverter.CLng(this.DropIncome.SelectedValue);
            }
            else
            {
                contacterInfo.Income = -1;
            }
            contacterInfo.Education      = -1;
            contacterInfo.Company        = this.TxtCompany.Text;
            contacterInfo.Department     = this.TxtDepartment.Text;
            contacterInfo.ClientId       = 0;
            contacterInfo.ParentId       = 0;
            contacterInfo.CreateTime     = DateTime.Now;
            contacterInfo.Owner          = "";
            contacterInfo.UserType       = ContacterType.EnterpriceMainContacter;
            contacterInfo.UpdateTime     = DateTime.Now;
            contacterInfo.UserName       = Users.UserNamefilter(this.TxtUserName.Text);
            contacterInfo.Phs            = this.TxtPHS.Text;
            contacterInfo.Birthday       = string.IsNullOrEmpty(this.TxtBirthday.Text) ? null : new DateTime?(this.TxtBirthday.Date);
            contacterInfo.Position       = this.TxtPosTitle.Text;
            usersInfo.UserName           = Users.UserNamefilter(this.TxtUserName.Text);
            usersInfo.UserPassword       = StringHelper.MD5(this.TxtPassword.Text);
            usersInfo.GroupId            = this.userSiteConfig.GroupId;
            usersInfo.JoinTime           = DateTime.Now;
            usersInfo.RegTime            = DateTime.Now;
            usersInfo.UserExp            = (int)this.userSiteConfig.PresentExp;
            usersInfo.UserPoint          = 0;
            usersInfo.IsInheritGroupRole = true;
            usersInfo.Status             = UserStatus.None;
            if (this.userSiteConfig.EmailCheckReg)
            {
                usersInfo.Status   = UserStatus.WaitValidateByEmail;
                usersInfo.CheckNum = DataSecurity.MakeRandomString("abcdefghijklmnopqrstuvwxyz0123456789_", 10);
            }
            if (this.userSiteConfig.AdminCheckReg)
            {
                usersInfo.Status = UserStatus.WaitValidateByAdmin;
            }
            if (this.userSiteConfig.EmailCheckReg && this.userSiteConfig.AdminCheckReg)
            {
                usersInfo.Status = UserStatus.WaitValidateByAdmin | UserStatus.WaitValidateByEmail;
            }
            usersInfo.EndTime = new DateTime?(DateTime.Now);
            usersInfo.Balance = 0M;
            string str2 = "";

            if (ApiData.IsAPiEnable())
            {
                str2 = ApiFunction.RegUser(usersInfo.UserName, this.TxtPassword.Text, usersInfo.Question, usersInfo.Answer, usersInfo.Email, contacterInfo.TrueName, contacterInfo.Sex.ToString(), contacterInfo.Birthday.ToString(), contacterInfo.QQ, contacterInfo.Msn, contacterInfo.Mobile, contacterInfo.OfficePhone, contacterInfo.Province, contacterInfo.City, contacterInfo.Address, contacterInfo.ZipCode, contacterInfo.Homepage);
                if (str2 != "true")
                {
                    DynamicPage.WriteErrMsg(str2 + "<br><li>注册失败!</li>");
                }
                str2 = ApiFunction.RegLogOn(usersInfo.UserName, this.TxtPassword.Text, "1");
            }
            if (!Users.Add(usersInfo, contacterInfo))
            {
                DynamicPage.WriteErrMsg("<li>注册失败!</li>");
                return;
            }
            if (this.userSiteConfig.PresentMoney != 0.0)
            {
                IEncourageStrategy <decimal> strategy = new UserMoney();
                strategy.IncreaseForUsers(usersInfo.UserId.ToString(), (decimal)this.userSiteConfig.PresentMoney, "注册时赠送的金钱", true, "注册时赠送的金钱");
            }
            if (this.userSiteConfig.PresentValidNum == 0)
            {
                goto Label_0665;
            }
            int howMany = 0;

            if (this.userSiteConfig.PresentValidNum == -1)
            {
                howMany = 0x270f;
            }
            else
            {
                switch (this.userSiteConfig.PresentValidUnit)
                {
                case 1:
                    howMany = this.userSiteConfig.PresentValidNum;
                    goto Label_063A;

                case 2:
                    howMany = this.userSiteConfig.PresentValidNum * 30;
                    goto Label_063A;

                case 3:
                    howMany = this.userSiteConfig.PresentValidNum * 0x16d;
                    goto Label_063A;
                }
                howMany = this.userSiteConfig.PresentValidNum;
            }
            Label_063A:
            strategy2 = new UserDate();
            strategy2.IncreaseForUsers(usersInfo.UserId.ToString(), howMany, "注册时赠送有效期", true, "注册时赠送有效期");
            Label_0665:
            if (this.userSiteConfig.PresentPoint != 0)
            {
                IEncourageStrategy <int> strategy3 = new UserPoint();
                strategy3.IncreaseForUsers(usersInfo.UserId.ToString(), this.userSiteConfig.PresentPoint, "注册时赠送点券", true, "注册时赠送点券");
            }
            if (this.userSiteConfig.EmailCheckReg)
            {
                MailInfo mailInfo = new MailInfo();
                mailInfo.IsBodyHtml = true;
                mailInfo.FromName   = SiteConfig.SiteInfo.SiteName;
                List <MailAddress> list = new List <MailAddress>();
                list.Add(new MailAddress(usersInfo.Email));
                mailInfo.MailToAddressList = list;
                mailInfo.MailBody          = this.userSiteConfig.EmailOfRegCheck.Replace("{$CheckNum}", usersInfo.CheckNum).Replace("{$CheckUrl}", base.Request.Url.GetLeftPart(UriPartial.Authority) + base.BasePath + "User/RegisterCheck.aspx?UserName="******"&CheckNum=" + usersInfo.CheckNum);
                mailInfo.Subject           = SiteConfig.SiteInfo.SiteName + "网站会员注册验证码";
                if (SendMail.Send(mailInfo) == MailState.Ok)
                {
                    DynamicPage.WriteSuccessMsg("<li>注册验证码已成功发送到你的注册邮箱,请到邮箱查收并验证!</li>" + str2, "../Default.aspx");
                }
                else
                {
                    DynamicPage.WriteSuccessMsg("<li>注册成功,但发送验证邮件失败,请检查邮件地址是否正确,或与网站管理员联系!</li>" + str2, "../Default.aspx");
                }
            }
            string str3 = "";

            if (this.userSiteConfig.EnableRegCompany)
            {
                str3 = "<li><a href='Company/RegCompany.aspx'>继续注册企业?</a></li>";
            }
            if (usersInfo.Status == UserStatus.None)
            {
                UserPrincipal principal = new UserPrincipal();
                principal.UserName     = usersInfo.UserName;
                principal.LastPassword = usersInfo.LastPassword;
                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, usersInfo.UserName, DateTime.Now, DateTime.Now.AddMinutes(60.0), false, principal.SerializeToString());
                string     str4   = FormsAuthentication.Encrypt(ticket);
                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, str4);
                cookie.HttpOnly = true;
                cookie.Path     = FormsAuthentication.FormsCookiePath;
                cookie.Secure   = FormsAuthentication.RequireSSL;
                base.Response.Cookies.Add(cookie);
            }
            if (SiteConfig.ShopConfig.IsPayPassword)
            {
                BasePage.ResponseRedirect("RegisterPayPassword.aspx?Url=Register");
            }
            else
            {
                DynamicPage.WriteSuccessMsg("<li>注册成功!" + str3 + "</li>" + str2, "Default.aspx");
            }
        }