Beispiel #1
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            UserInfo userInfo = this.showUserInfo.UserInfo;
            string   reason   = this.TxtReason.Text.Trim();
            string   text     = this.TxtMemo.Text;

            if (this.Page.IsValid)
            {
                int howMany = DataConverter.CLng(this.TxtPoint.Text);
                if (userInfo == null)
                {
                    AdminPage.WriteErrMsg("<li>找不到指定的会员!</li>");
                }
                else
                {
                    IEncourageStrategy <int> strategy = new UserPoint();
                    if (strategy.IncreaseForUsers(userInfo.UserId.ToString(), howMany, reason, true, text))
                    {
                        StringBuilder builder = new StringBuilder();
                        builder.Append("<li>会员奖励" + this.m_PointName + "成功!</li>");
                        if (this.ChkIsSendMessage.Checked)
                        {
                            string sendContent = SiteConfig.SmsConfig.EncouragePointMessage.Replace("{$Point}", howMany.ToString()).Replace("{$Reason}", this.TxtReason.Text);
                            builder.Append(Users.SendMessageToUser(userInfo, sendContent));
                        }
                        AdminPage.WriteSuccessMsg(builder.ToString(), "UserShow.aspx?UserID=" + userInfo.UserId);
                    }
                    else
                    {
                        AdminPage.WriteErrMsg("<li>会员奖励" + this.m_PointName + "失败!</li>");
                    }
                }
            }
        }
Beispiel #2
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            string toUser = this.HdnUsersId.Value;
            int    num    = DataConverter.CLng(this.TxtPoint.Text);

            if ((num <= 0) || (num > 0x5f5e100))
            {
                AdminPage.WriteErrMsg("<li>请输入" + this.m_PointName + "," + this.m_PointName + "不能为负数,数字不能大过1亿!</li>");
            }
            IEncourageStrategy <int> strategy = new UserPoint();

            if (strategy.IncreaseForUsers(toUser, -num, this.TxtReason.Text.Trim(), true, this.TxtMemo.Text.Trim()))
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("<li>会员扣除" + this.m_PointName + "成功!</li>");
                if (this.ChkIsSendMessage.Checked)
                {
                    UserInfo userById    = Users.GetUserById(DataConverter.CLng(toUser));
                    string   sendContent = SiteConfig.SmsConfig.PayoutPointMessage.Replace("{$Point}", num.ToString()).Replace("{$Reason}", this.TxtReason.Text);
                    builder.Append(Users.SendMessageToUser(userById, sendContent));
                }
                AdminPage.WriteSuccessMsg(builder.ToString(), "UserShow.aspx?UserID=" + toUser);
            }
            else
            {
                AdminPage.WriteErrMsg("<li>会员扣除" + this.m_PointName + "失败!</li>");
            }
        }
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            int    howMany  = DataConverter.CLng(this.TxtPoint.Text);
            string str      = this.TxtReason.Text.Trim();
            bool   isRecord = this.ChkSaveItem.Checked;
            bool   flag2    = false;
            string str2     = "批量发" + this.m_PointName + "成功!";
            string str3     = "批量发" + this.m_PointName + "失败!";
            string text     = this.TxtMemo.Text;

            if (string.IsNullOrEmpty(str))
            {
                AdminPage.WriteErrMsg("<li>请输入原因!</li>");
            }
            IEncourageStrategy <int> strategy = new UserPoint();
            string strA = this.ViewState["Action"] as string;

            if (string.Compare(strA, "SubtractPoint", StringComparison.OrdinalIgnoreCase) == 0)
            {
                howMany = -howMany;
                str2    = "批量扣" + this.m_PointName + "成功!";
                str3    = "批量扣" + this.m_PointName + "失败!";
            }
            switch (this.SelectUser.UserType)
            {
            case 0:
                flag2 = strategy.IncreaseForAll(howMany, str, isRecord, text);
                break;

            case 1:
                if (string.IsNullOrEmpty(this.SelectUser.GroupId))
                {
                    AdminPage.WriteErrMsg("<li>请选择会员组!</li>");
                }
                flag2 = strategy.IncreaseForGroup(this.SelectUser.GroupId, howMany, str, isRecord, text);
                break;

            case 2:
                if (string.IsNullOrEmpty(this.SelectUser.UserId))
                {
                    AdminPage.WriteErrMsg("<li>请指定会员ID!</li>");
                }
                flag2 = strategy.IncreaseForUsers(this.SelectUser.UserId, howMany, str, isRecord, text);
                break;
            }
            if (flag2)
            {
                AdminPage.WriteSuccessMsg("<li>" + str2 + "</li>", "UserManage.aspx");
            }
            else
            {
                AdminPage.WriteErrMsg("<li>" + str3 + "</li>");
            }
        }
Beispiel #4
0
 protected void BtnSubmit_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         int howMany = DataConverter.CLng(this.TxtPoint.Text);
         if (PEContext.Current.User.UserName == this.TxtDonateUserName.Text)
         {
             DynamicPage.WriteErrMsg("不能自己赠送绐自己!");
         }
         UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);
         UserInfo info2           = Users.GetUsersByUserName(this.TxtDonateUserName.Text);
         if (usersByUserName.IsNull)
         {
             DynamicPage.WriteErrMsg("非法用户登录!");
         }
         if (info2.IsNull)
         {
             DynamicPage.WriteErrMsg("赠送的用户不存在!");
         }
         if (usersByUserName.UserPoint <= howMany)
         {
             DynamicPage.WriteErrMsg("剩余的" + SiteConfig.UserConfig.PointUnit + "数不够此次赠送!");
         }
         UserPoint point = new UserPoint();
         if (point.IncreaseForUsers(usersByUserName.UserId.ToString(), -howMany, string.Concat(new object[] { "赠送给:", this.TxtDonateUserName.Text, "用户", howMany, SiteConfig.UserConfig.PointName, "成功!" }), true, ""))
         {
             if (point.IncreaseForUsers(info2.UserId.ToString(), howMany, "获得用户:" + usersByUserName.UserName + "赠送", true, ""))
             {
                 DynamicPage.WriteSuccessMsg("赠送给" + info2.UserName + "用户 " + howMany.ToString() + SiteConfig.UserConfig.PointName + "成功!", "DonatePoint.aspx");
             }
             else
             {
                 DynamicPage.WriteErrMsg("赠送失败");
             }
         }
         else
         {
             DynamicPage.WriteErrMsg("赠送失败");
         }
     }
 }
Beispiel #5
0
 protected void BtnSubmitMoney_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);
         int      howMany         = 0;
         decimal  d    = Convert.ToDecimal(this.TxtMoney.Text);
         decimal  num3 = DataConverter.CDecimal(usersByUserName.UserPurview.Overdraft);
         if (d > (usersByUserName.Balance + num3))
         {
             DynamicPage.WriteErrMsg("<li>您的余额不足以进行此次兑换!</li>");
         }
         if (SiteConfig.UserConfig.MoneyExchangePoint <= 0.0)
         {
             DynamicPage.WriteErrMsg("<li>兑换功能关闭,请与管理员联系!</li>", "../Default.aspx");
         }
         if (d <= 0M)
         {
             DynamicPage.WriteErrMsg("<li>填写资金必须大于0!</li>");
         }
         howMany = (int)(((double)d) / SiteConfig.UserConfig.MoneyExchangePoint);
         if (((howMany == 0) || (howMany < 0)) || (howMany > 0x5f5e100))
         {
             DynamicPage.WriteErrMsg("<li>输入资金有误或兑换比率有误!</li>");
         }
         usersByUserName.Balance -= d;
         if (Users.Update(usersByUserName))
         {
             UserPoint point  = new UserPoint();
             string    reason = string.Concat(new object[] { PEContext.Current.User.UserName, "用", d, "元资金兑换", howMany, SiteConfig.UserConfig.PointName });
             if (point.IncreaseForUsers(usersByUserName.UserId.ToString(), howMany, reason, true, ""))
             {
                 BankrollItemInfo bankrollItemInfo = new BankrollItemInfo();
                 bankrollItemInfo.UserName     = usersByUserName.UserName;
                 bankrollItemInfo.MoneyType    = 4;
                 bankrollItemInfo.CurrencyType = 3;
                 bankrollItemInfo.DateAndTime  = new DateTime?(DateTime.Now);
                 bankrollItemInfo.Inputer      = PEContext.Current.User.UserName;
                 bankrollItemInfo.IP           = PEContext.Current.UserHostAddress;
                 bankrollItemInfo.LogTime      = new DateTime?(DateTime.Now);
                 bankrollItemInfo.Money        = -(d);
                 bankrollItemInfo.Remark       = string.Concat(new object[] { "用于", SiteConfig.UserConfig.PointName, "兑换,消费", d, "元资金,增加", SiteConfig.UserConfig.PointName, howMany, SiteConfig.UserConfig.PointUnit });
                 bankrollItemInfo.Status       = BankrollItemStatus.Confirm;
                 BankrollItem.Add(bankrollItemInfo);
                 DynamicPage.WriteSuccessMsg("<li>会员" + SiteConfig.UserConfig.PointName + "兑换成功!</li>", "ExchangePoint.aspx");
             }
             else
             {
                 DynamicPage.WriteErrMsg("<li>会员" + SiteConfig.UserConfig.PointName + "兑换失败!</li>");
             }
         }
     }
 }
Beispiel #6
0
 protected void BtnSubmitExp_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);
         int      howMany         = 0;
         int      num2            = Convert.ToInt32(this.TxtUserExp.Text);
         if (num2 > usersByUserName.UserExp)
         {
             DynamicPage.WriteErrMsg("<li>您的积分不足以进行此次兑换!</li>");
         }
         if (SiteConfig.UserConfig.UserExpExchangePoint <= 0.0)
         {
             DynamicPage.WriteErrMsg("<li>兑换功能关闭,请与管理员联系!</li>", "../Default.aspx");
         }
         if (num2 <= 0)
         {
             DynamicPage.WriteErrMsg("<li>填写积分必须大于0!</li>");
         }
         howMany = (int)(((double)num2) / SiteConfig.UserConfig.UserExpExchangePoint);
         if (((howMany == 0) || (howMany < 0)) || (howMany > 0x5f5e100))
         {
             DynamicPage.WriteErrMsg("<li>请输入资金有误或兑换比率有误!</li>");
         }
         if ((usersByUserName.UserExp - num2) < 0)
         {
             usersByUserName.UserExp = 0;
         }
         else
         {
             usersByUserName.UserExp -= num2;
         }
         if (Users.Update(usersByUserName))
         {
             UserPoint point  = new UserPoint();
             string    reason = string.Concat(new object[] { PEContext.Current.User.UserName, "用", num2, "积分兑换", howMany, SiteConfig.UserConfig.PointName });
             if (point.IncreaseForUsers(usersByUserName.UserId.ToString(), howMany, reason, true, ""))
             {
                 DynamicPage.WriteSuccessMsg("<li>会员" + SiteConfig.UserConfig.PointName + "兑换成功!</li>", "ExchangePoint.aspx");
             }
             else
             {
                 DynamicPage.WriteErrMsg("<li>会员" + SiteConfig.UserConfig.PointName + "兑换失败!</li>");
             }
         }
     }
 }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            double totalDays;
            int    validNum;
            IEncourageStrategy <int> strategy2;

            if (!base.IsValid)
            {
                return;
            }
            string   password             = StringHelper.Base64StringEncode(this.TxtPassword.Text);
            CardInfo cardByNumAndPassword = Cards.GetCardByNumAndPassword(this.TxtCardNum.Text.Trim(), password);

            if (cardByNumAndPassword.IsNull)
            {
                DynamicPage.WriteErrMsg("卡号或密码错误!");
            }
            else
            {
                if (cardByNumAndPassword.CardType != 0)
                {
                    DynamicPage.WriteErrMsg("你输入的充值卡是其他公司的卡,不能在本站进行充值。请尽快去有关公司或网站的充值入口进行充值。");
                }
                if (!string.IsNullOrEmpty(cardByNumAndPassword.UserName))
                {
                    DynamicPage.WriteErrMsg("你输入的充值卡已经使用过了!");
                }
                if (cardByNumAndPassword.EndDate < DateTime.Today)
                {
                    DynamicPage.WriteErrMsg("你输入的充值卡已经失效!此卡的充值截止日期为:" + cardByNumAndPassword.EndDate.ToString("yyyy-MM-dd"));
                }
            }
            UserInfo      userInfo  = this.showUserInfo.UserInfo;
            bool          flag      = false;
            string        groupName = string.Empty;
            StringBuilder builder   = new StringBuilder();

            builder.Append("<li>充值成功!</li>");
            if (cardByNumAndPassword.ValidUnit == 5)
            {
                groupName = UserGroups.GetUserGroupById(cardByNumAndPassword.ValidNum).GroupName;
                builder.Append("<li><span style='Color:#F00'>恭喜您已升级成\"" + groupName + "\"</span></li>");
            }
            builder.Append("<li>充值卡卡号:" + cardByNumAndPassword.CardNum + "</li>");
            builder.Append("<li>充值卡面值:" + cardByNumAndPassword.Money.ToString("N2") + "元</li>");
            builder.Append("<li>充值截止日期:" + cardByNumAndPassword.EndDate.ToString("yyyy-MM-dd") + "</li>");
            switch (cardByNumAndPassword.ValidUnit)
            {
            case 0:
            {
                builder.Append("<li>充值卡点数:" + cardByNumAndPassword.ValidNum.ToString() + Cards.GetValidUnitType(cardByNumAndPassword.ValidUnit) + "</li>");
                builder.Append("<li>您充值前的" + SiteConfig.UserConfig.PointName + "数:" + userInfo.UserPoint.ToString() + "</li>");
                IEncourageStrategy <int> strategy = new UserPoint();
                flag = strategy.IncreaseForUsers(userInfo.UserId.ToString(), cardByNumAndPassword.ValidNum, "充值卡充值。卡号:" + cardByNumAndPassword.CardNum, true, "");
                string[] strArray2 = new string[] { "<li>您充值后的", SiteConfig.UserConfig.PointName, "数:", (userInfo.UserPoint + cardByNumAndPassword.ValidNum).ToString(), "</li>" };
                builder.Append(string.Concat(strArray2));
                goto Label_059A;
            }

            case 1:
            case 2:
            case 3:
            {
                builder.Append("<li>充值卡内含有效期:" + cardByNumAndPassword.ValidNum.ToString() + Cards.GetValidUnitType(cardByNumAndPassword.ValidUnit) + "</li>");
                TimeSpan span = (TimeSpan)(DataConverter.CDate(userInfo.EndTime).Date - DateTime.Today.Date);
                totalDays = span.TotalDays;
                validNum  = cardByNumAndPassword.ValidNum;
                strategy2 = new UserDate();
                switch (cardByNumAndPassword.ValidUnit)
                {
                case 2:
                    validNum *= 30;
                    break;

                case 3:
                    validNum *= 0x16d;
                    break;
                }
                break;
            }

            case 4:
            {
                builder.Append("<li>充值卡内含资金:" + cardByNumAndPassword.ValidNum.ToString() + Cards.GetValidUnitType(cardByNumAndPassword.ValidUnit) + "</li>");
                builder.Append("<li>您充值前的资金余额为:" + userInfo.Balance.ToString("N2") + "元</li>");
                IEncourageStrategy <decimal> strategy3 = new UserMoney();
                flag = strategy3.IncreaseForUsers(userInfo.UserId.ToString(), cardByNumAndPassword.ValidNum, "充值卡充值。卡号:" + cardByNumAndPassword.CardNum, true, "");
                builder.Append("<li>您充值后的资金余额为:" + ((userInfo.Balance + cardByNumAndPassword.ValidNum)).ToString("N2") + "元</li>");
                goto Label_059A;
            }

            case 5:
                builder.Append("<li>会员级别:" + groupName + "</li>");
                flag = Users.MoveByUserName(userInfo.UserName, cardByNumAndPassword.ValidNum);
                goto Label_059A;

            default:
                goto Label_059A;
            }
            if (totalDays > 0.0)
            {
                builder.Append("<li>您充值前的有效期:" + totalDays.ToString() + "天</li>");
                flag = strategy2.IncreaseForUsers(userInfo.UserId.ToString(), validNum, "充值卡充值。卡号:" + cardByNumAndPassword.CardNum, true, "");
                builder.Append("<li>您充值后的有效期:" + ((totalDays + validNum)).ToString() + "天</li>");
            }
            else
            {
                builder.Append("<li>您充值前有效期已经过期" + Math.Abs(totalDays).ToString() + "天</li>");
                flag = strategy2.IncreaseForUsers(userInfo.UserId.ToString(), validNum, "充值卡充值。卡号:" + cardByNumAndPassword.CardNum, true, "");
                builder.Append("<li>您充值后的有效期:" + validNum.ToString() + "天,开始计算日期:" + DateTime.Today.ToString("yyyy-MM-dd") + "</li>");
            }
Label_059A:
            if (flag)
            {
                cardByNumAndPassword.UserName = userInfo.UserName;
                cardByNumAndPassword.UseTime  = new DateTime?(DateTime.Now);
                Cards.Update(cardByNumAndPassword);
                DynamicPage.WriteSuccessMsg(builder.ToString(), "Recharge.aspx");
            }
            else
            {
                DynamicPage.WriteErrMsg("充值失败!");
            }
        }
        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");
            }
        }
 private void AddBankroll(int paymentLogId)
 {
     if (!BankrollItem.ExistsPaymentLog(paymentLogId))
     {
         PaymentLogInfo paymentLogById = PaymentLog.GetPaymentLogById(paymentLogId);
         if (!paymentLogById.IsNull)
         {
             IEncourageStrategy <decimal> strategy = new UserMoney();
             int      userId          = 0;
             UserInfo usersByUserName = new UserInfo(true);
             if (!string.IsNullOrEmpty(paymentLogById.UserName))
             {
                 usersByUserName = Users.GetUsersByUserName(paymentLogById.UserName);
                 userId          = usersByUserName.UserId;
                 if (userId > 0)
                 {
                     strategy.IncreaseForUsers(userId.ToString(), paymentLogById.MoneyPay, "", false, "");
                     BankrollItemInfo bankrollItemInfo = new BankrollItemInfo();
                     bankrollItemInfo.UserName     = paymentLogById.UserName;
                     bankrollItemInfo.Money        = paymentLogById.MoneyPay;
                     bankrollItemInfo.MoneyType    = 3;
                     bankrollItemInfo.EBankId      = paymentLogById.PlatformId;
                     bankrollItemInfo.OrderId      = paymentLogById.OrderId;
                     bankrollItemInfo.PaymentId    = paymentLogId;
                     bankrollItemInfo.Remark       = "在线支付单号:" + paymentLogById.PaymentNum;
                     bankrollItemInfo.DateAndTime  = DateTime.Now;
                     bankrollItemInfo.CurrencyType = 1;
                     bankrollItemInfo.ClientId     = usersByUserName.ClientId;
                     BankrollItem.Add(bankrollItemInfo);
                 }
             }
             if (paymentLogById.OrderId > 0)
             {
                 OrderInfo orderById = Order.GetOrderById(paymentLogById.OrderId);
                 if (!orderById.IsNull)
                 {
                     decimal d = 0M;
                     if (orderById.MoneyTotal > orderById.MoneyReceipt)
                     {
                         if ((orderById.MoneyTotal - orderById.MoneyReceipt) > paymentLogById.MoneyPay)
                         {
                             if (SiteConfig.ShopConfig.EnablePartPay)
                             {
                                 d = paymentLogById.MoneyPay;
                                 orderById.MoneyReceipt += paymentLogById.MoneyPay;
                             }
                         }
                         else
                         {
                             d = orderById.MoneyTotal - orderById.MoneyReceipt;
                             orderById.MoneyReceipt = orderById.MoneyTotal;
                         }
                         orderById.Status = OrderStatus.Confirmed;
                         Order.Update(orderById);
                     }
                     if (d > 0M)
                     {
                         strategy.IncreaseForUsers(userId.ToString(), -d, "", false, "");
                         BankrollItemInfo info5 = new BankrollItemInfo();
                         info5.UserName     = usersByUserName.UserName;
                         info5.ClientId     = usersByUserName.ClientId;
                         info5.Money        = -d;
                         info5.MoneyType    = 4;
                         info5.EBankId      = 0;
                         info5.OrderId      = orderById.OrderId;
                         info5.PaymentId    = 0;
                         info5.Remark       = "支付订单费用,订单号:" + orderById.OrderNum;
                         info5.DateAndTime  = DateTime.Now;
                         info5.CurrencyType = 1;
                         BankrollItem.Add(info5);
                     }
                 }
             }
             else if (paymentLogById.Point > 0)
             {
                 IEncourageStrategy <int> strategy2 = new UserPoint();
                 strategy2.IncreaseForUsers(userId.ToString(), paymentLogById.Point, "购买" + SiteConfig.UserConfig.PointName, true, "");
                 BankrollItemInfo info6 = new BankrollItemInfo();
                 info6.UserName     = usersByUserName.UserName;
                 info6.ClientId     = usersByUserName.ClientId;
                 info6.Money        = (paymentLogById.MoneyPay > 0M) ? (-1M * paymentLogById.MoneyPay) : paymentLogById.MoneyPay;
                 info6.MoneyType    = 4;
                 info6.EBankId      = 0;
                 info6.OrderId      = 0;
                 info6.PaymentId    = 0;
                 info6.Remark       = "购买" + SiteConfig.UserConfig.PointName + ",购买数:" + paymentLogById.Point.ToString() + SiteConfig.UserConfig.PointUnit;
                 info6.DateAndTime  = new DateTime?(DateTime.Now);
                 info6.CurrencyType = 1;
                 BankrollItem.Add(info6);
                 if (usersByUserName.UserId > 0)
                 {
                     strategy.IncreaseForUsers(usersByUserName.UserId.ToString(), -(paymentLogById.MoneyPay), "", false, "");
                 }
             }
         }
     }
 }
Beispiel #10
0
 public PayOnlineState UpdateOrder(string paymentNum, decimal amount, string eBankInfo, int status, string remark, bool updateDeliverStatus, bool updateOrderStatus)
 {
     if (Convert.ToString(PEContext.Current.Context.Session["PaymentNum"]) != paymentNum)
     {
         PEContext.Current.Context.Session["PaymentNum"] = paymentNum;
         StringBuilder payOnlineMessage = new StringBuilder(0x40);
         paymentNum = DataSecurity.FilterBadChar(paymentNum);
         eBankInfo  = DataSecurity.FilterBadChar(eBankInfo);
         remark     = DataSecurity.FilterBadChar(remark);
         PayOnlineState state = this.UpdatePaymentLog(paymentNum, amount, eBankInfo, status, remark);
         if (state != PayOnlineState.Ok)
         {
             PEContext.Current.Context.Session["PaymentNum"] = "";
             return(state);
         }
         if (!updateDeliverStatus)
         {
             PEContext.Current.Context.Session["PaymentNum"] = "";
             return(PayOnlineState.Ok);
         }
         bool doUpdate = !BankrollItem.ExistsPaymentLog(this.m_PaymentLogId);
         if (!doUpdate)
         {
             PEContext.Current.Context.Session["PaymentNum"] = "";
             return(PayOnlineState.AccountPaid);
         }
         bool isok = false;
         IEncourageStrategy <decimal> strategy = new UserMoney();
         if (updateOrderStatus)
         {
             if (this.m_UserId > 0)
             {
                 strategy.IncreaseForUsers(this.m_UserId.ToString(), this.m_MoneyReceipt, "", false, "");
             }
             BankrollItemInfo bankrollItemInfo = new BankrollItemInfo();
             bankrollItemInfo.UserName     = this.m_UserName;
             bankrollItemInfo.ClientId     = this.m_ClientID;
             bankrollItemInfo.Money        = this.m_MoneyReceipt;
             bankrollItemInfo.MoneyType    = 3;
             bankrollItemInfo.EBankId      = this.m_PlatformId;
             bankrollItemInfo.OrderId      = this.m_OrderInfo.OrderId;
             bankrollItemInfo.PaymentId    = this.m_PaymentLogId;
             bankrollItemInfo.Remark       = "在线支付单号:" + paymentNum;
             bankrollItemInfo.DateAndTime  = new DateTime?(DateTime.Now);
             bankrollItemInfo.CurrencyType = 1;
             isok = BankrollItem.Add(bankrollItemInfo);
         }
         if (this.m_OrderInfo.IsNull)
         {
             if (this.m_Point > 0)
             {
                 IEncourageStrategy <int> strategy2 = new UserPoint();
                 strategy2.IncreaseForUsers(this.m_UserId.ToString(), this.m_Point, "购买" + SiteConfig.UserConfig.PointName, true, "");
                 BankrollItemInfo info2 = new BankrollItemInfo();
                 info2.UserName     = this.m_UserName;
                 info2.ClientId     = this.m_ClientID;
                 info2.Money        = (this.m_MoneyReceipt > 0M) ? (-1M * this.m_MoneyReceipt) : this.m_MoneyReceipt;
                 info2.MoneyType    = 4;
                 info2.EBankId      = 0;
                 info2.OrderId      = this.m_OrderInfo.OrderId;
                 info2.PaymentId    = 0;
                 info2.Remark       = "购买" + SiteConfig.UserConfig.PointName + ",购买数:" + this.m_Point.ToString() + SiteConfig.UserConfig.PointUnit;
                 info2.DateAndTime  = new DateTime?(DateTime.Now);
                 info2.CurrencyType = 1;
                 isok = BankrollItem.Add(info2);
                 if (this.m_UserId > 0)
                 {
                     isok = strategy.IncreaseForUsers(this.m_UserId.ToString(), -(this.m_MoneyReceipt), "", false, "");//将decimal.op_UnaryNegation
                 }
             }
             PEContext.Current.Context.Session["PaymentNum"] = "";
             if (!isok)
             {
                 return(PayOnlineState.Fail);
             }
             return(PayOnlineState.Ok);
         }
         if (updateDeliverStatus && ((this.m_OrderInfo.MoneyTotal - this.m_OrderInfo.MoneyReceipt) <= this.m_MoneyReceipt))
         {
             this.m_OrderInfo.EnableDownload = true;
             isok = Order.Update(this.m_OrderInfo);
         }
         if ((this.m_OrderInfo.MoneyReceipt < this.m_OrderInfo.MoneyTotal) && updateOrderStatus)
         {
             bool flag3 = false;
             if ((this.m_OrderInfo.MoneyTotal - this.m_OrderInfo.MoneyReceipt) <= this.m_MoneyReceipt)
             {
                 this.m_MoneyPayout            = this.m_OrderInfo.MoneyTotal - this.m_OrderInfo.MoneyReceipt;
                 this.m_OrderInfo.MoneyReceipt = this.m_OrderInfo.MoneyTotal;
                 flag3 = true;
             }
             else if (SiteConfig.ShopConfig.EnablePartPay)
             {
                 this.m_MoneyPayout             = this.m_MoneyReceipt;
                 this.m_OrderInfo.MoneyReceipt += this.m_MoneyReceipt;
                 flag3 = true;
             }
             if (flag3)
             {
                 if (this.m_OrderInfo.Status <= OrderStatus.WaitForConfirm)
                 {
                     this.m_OrderInfo.Status = OrderStatus.Confirmed;
                 }
                 isok = Order.Update(this.m_OrderInfo);
                 BankrollItemInfo info3 = new BankrollItemInfo();
                 info3.UserName     = this.m_UserName;
                 info3.ClientId     = this.m_ClientID;
                 info3.Money        = (this.m_MoneyPayout > 0M) ? (-1M * this.m_MoneyPayout) : this.m_MoneyPayout;
                 info3.MoneyType    = 4;
                 info3.EBankId      = 0;
                 info3.OrderId      = this.m_OrderInfo.OrderId;
                 info3.PaymentId    = 0;
                 info3.Remark       = "支付订单费用,订单号:" + this.m_OrderInfo.OrderNum;
                 info3.DateAndTime  = new DateTime?(DateTime.Now);
                 info3.CurrencyType = 1;
                 isok = BankrollItem.Add(info3);
                 if (this.m_UserId > 0)
                 {
                     isok = strategy.IncreaseForUsers(this.m_UserId.ToString(), -(this.m_MoneyPayout), "", false, "");//将decimal.op_UnaryNegation改为了-
                 }
                 payOnlineMessage.Append("同时已经为您的订单编号为 " + this.m_OrderInfo.OrderNum + " 的订单支付了 " + this.m_MoneyPayout.ToString("N2") + "元。<br />");
             }
             else
             {
                 payOnlineMessage.Append("您的支付金额小于订单金额,不能对订单进行支付,资金已经打入您的帐户中做为预付款。<br />");
                 updateDeliverStatus = false;
             }
         }
         if (updateDeliverStatus)
         {
             this.ShowCardInfo(payOnlineMessage, doUpdate, isok);
         }
         payOnlineMessage.Append("<a href='../User/Shop/ShowOrder.aspx?OrderId=" + this.m_OrderInfo.OrderId.ToString() + "'>点此查看订单信息</a>");
         this.m_Message = payOnlineMessage.ToString();
         PEContext.Current.Context.Session["PaymentNum"] = "";
         if (!isok)
         {
             return(PayOnlineState.Fail);
         }
     }
     return(PayOnlineState.Ok);
 }
        public void createUser()
        {
            IEncourageStrategy <int> strategy2;

            this.API.SpeItems[7, 1] = this.API.GetNodeText(this.API.SpeItems[7, 0]);
            if (!this.CheckUserName() || !this.CheckUserEmail())
            {
                return;
            }
            this.API.PrepareData(true);
            UserInfo usersInfo = new UserInfo();

            usersInfo.Question = this.API.SpeItems[8, 1];
            usersInfo.Answer   = StringHelper.MD5(this.API.SpeItems[9, 1]);
            usersInfo.Email    = this.API.SpeItems[7, 1];
            string str = DataSecurity.MakeRandomString(10);

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

            contacterInfo.TrueName    = this.API.SpeItems[11, 1];
            contacterInfo.Country     = "";
            contacterInfo.Province    = "";
            contacterInfo.City        = "";
            contacterInfo.Address     = this.API.SpeItems[0x12, 1];
            contacterInfo.ZipCode     = this.API.SpeItems[0x13, 1];
            contacterInfo.OfficePhone = this.API.SpeItems[0x11, 1];
            contacterInfo.HomePhone   = "";
            contacterInfo.Mobile      = this.API.SpeItems[0x10, 1];
            contacterInfo.Fax         = "";
            contacterInfo.Homepage    = this.API.SpeItems[20, 1];
            contacterInfo.Email       = this.API.SpeItems[7, 1];
            contacterInfo.QQ          = this.API.SpeItems[14, 1];
            contacterInfo.Msn         = this.API.SpeItems[15, 1];
            contacterInfo.Icq         = "";
            contacterInfo.Yahoo       = "";
            contacterInfo.UC          = "";
            contacterInfo.Aim         = "";
            contacterInfo.IdCard      = "";
            if (this.API.SpeItems[12, 1] == "1")
            {
                this.API.SpeItems[12, 1] = "Female";
            }
            else if (this.API.SpeItems[12, 1] == "0")
            {
                this.API.SpeItems[12, 1] = "Male";
            }
            else
            {
                this.API.SpeItems[12, 1] = "Secrecy";
            }
            contacterInfo.Sex            = (UserSexType)Enum.Parse(typeof(UserSexType), this.API.SpeItems[12, 1]);
            contacterInfo.Marriage       = UserMarriageType.Secrecy;
            contacterInfo.Income         = -1;
            contacterInfo.Education      = -1;
            contacterInfo.Company        = "";
            contacterInfo.Department     = "";
            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.API.SpeItems[5, 1]);
            contacterInfo.Phs            = "";
            contacterInfo.Birthday       = string.IsNullOrEmpty(this.API.SpeItems[13, 1]) ? null : new DateTime?(Convert.ToDateTime(this.API.SpeItems[13, 1]));
            contacterInfo.Position       = "";
            usersInfo.UserName           = Users.UserNamefilter(this.API.SpeItems[5, 1]);
            usersInfo.UserPassword       = StringHelper.MD5(this.API.SpeItems[6, 1]);
            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;
            if (!Users.Add(usersInfo, contacterInfo))
            {
                this.API.FoundErr = true;
                this.API.ErrMsg   = "注册失败!";
                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_05C6;
            }
            int howMany = 0;

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

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

                case 3:
                    howMany = this.userSiteConfig.PresentValidNum * 0x16d;
                    goto Label_059B;
                }
                howMany = this.userSiteConfig.PresentValidNum;
            }
            Label_059B:
            strategy2 = new UserDate();
            strategy2.IncreaseForUsers(usersInfo.UserId.ToString(), howMany, "注册时赠送有效期", true, "注册时赠送有效期");
            Label_05C6:
            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) + "User/RegisterCheck.aspx?UserName="******"&CheckNum=" + usersInfo.CheckNum);
                mailInfo.Subject           = SiteConfig.SiteInfo.SiteName + "网站会员注册验证码";
                SendMail.Send(mailInfo);
            }
            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     str2   = FormsAuthentication.Encrypt(ticket);
                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, str2);
                cookie.HttpOnly = true;
                cookie.Path     = FormsAuthentication.FormsCookiePath;
                cookie.Secure   = FormsAuthentication.RequireSSL;
                base.Response.Cookies.Add(cookie);
            }
        }
Beispiel #12
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");
            }
        }