Exemple #1
0
        public void SendEmail()
        {
            List <string> list = new List <string>(Utils.SplitString(DNTRequest.GetString("email"), ","));

            if (String.IsNullOrEmpty(invitecode))
            {
                base.AddErrLine("丢失参数导致邮件发送失败,请检查本地杀毒软件设置");
                return;
            }
            //this.invitecodeinfo = Invitation.GetInviteCodeByCode(this.Code);
            invitecodeinfo = Invitation.FindByCode(invitecode);
            int num = 0;

            foreach (string current in list)
            {
                if (!string.IsNullOrEmpty(current) && Utils.IsValidEmail(current))
                {
                    if (Emails.SendEmailNotify(current, "来自您的好友:" + this.invitecodeinfo.Creator + "的邀请!", string.Format(this.invitationconfiginfo.InvitationEmailTemplate, new object[]
                    {
                        current,
                        this.userid,
                        this.invitecodeinfo.Creator,
                        this.GetUserInviteUrl(this.invitecodeinfo.Code, true),
                        this.config.Forumtitle,
                        !String.IsNullOrEmpty(this.usersaid) ? this.usersaid : "",
                        this.rooturl,
                        this.avatarSmall,
                        this.avatarMedium,
                        this.avatarLarge
                    })))
                    {
                        num++;
                    }
                    if (num > 19)
                    {
                        break;
                    }
                }
            }
            if (num > 0)
            {
                base.AddMsgLine("成功发送" + num.ToString() + "封Email");
                return;
            }
            base.AddErrLine("发送失败,请检查Email地址是否正确");
        }
Exemple #2
0
        private Invitation ValidateInviteInfo()
        {
            this.errorControlId = "invitecode";
            if (this.config.Regstatus == 3 && string.IsNullOrEmpty(this.invitecode))
            {
                base.AddErrLine("邀请码不能为空!");
                return(null);
            }
            if (string.IsNullOrEmpty(this.invitecode))
            {
                return(null);
            }

            var inviteCodeInfo = Invitation.FindByCode(this.invitecode.ToUpper());

            if (inviteCodeInfo == null || !inviteCodeInfo.Check())
            {
                base.AddErrLine("邀请码不合法或已过期!");
                return(null);
            }
            return(inviteCodeInfo);
        }
Exemple #3
0
 protected override void ShowPage()
 {
     this.pagetitle = "邀请注册";
     if (!Utils.InArray(this.config.Regstatus.ToString(), "2,3"))
     {
         base.AddErrLine("当前站点没有开启邀请功能!");
         return;
     }
     if (this.userid > 0)
     {
         if (this.action == "floatwinemail")
         {
             return;
         }
         this.avatarSmall  = Avatars.GetAvatarUrl(this.userid, AvatarSize.Small);
         this.avatarMedium = Avatars.GetAvatarUrl(this.userid, AvatarSize.Medium);
         this.avatarLarge  = Avatars.GetAvatarUrl(this.userid, AvatarSize.Large);
         this.userinfo     = Users.GetUserInfo(this.userid);
         if (this.config.Regstatus == 2)
         {
             this.invitecodeinfo = Invitation.GetInviteCodeByUid(this.userid);
             if (this.invitecodeinfo != null)
             {
                 this.inviteurl = this.GetUserInviteUrl(this.invitecodeinfo.Code, false);
                 this.userscore = this.GetUserInviteScore(this.invitecodeinfo.SuccessCount);
                 this.usersaid  = string.Format("邀请附言:<div id=\"usersaidinemail\">{0}</div>", this.usersaid);
                 if (!this.ispost)
                 {
                     this.CreateEmailPreview();
                 }
             }
         }
         else
         {
             this.invitecodecount = Invitation.GetUserInviteCodeCount(this.userid);
             this.invitecodelist  = Invitation.GetUserInviteCodeList(this.userid, this.pageindex);
             this.invitecodeprice = this.GetInviteCodePrice();
             this.pagecount       = (this.invitecodecount - 1) / 10 + 1;
             this.pagenumber      = Utils.GetPageNumbers(this.pageindex, this.pagecount, "invite.aspx", 8);
         }
         if (this.ispost)
         {
             string a;
             if ((a = this.action) == null)
             {
                 return;
             }
             if (!(a == "createcode"))
             {
                 if (!(a == "convertcode"))
                 {
                     if (!(a == "buycode"))
                     {
                         if (!(a == "floatwinemailsend"))
                         {
                             return;
                         }
                         this.SendEmail();
                     }
                     else
                     {
                         this.BuyInviteCode();
                     }
                 }
                 else
                 {
                     this.ConvertInviteCode();
                 }
             }
             else
             {
                 this.CreateInviteCode();
             }
         }
     }
     if (userid == -1 && !String.IsNullOrEmpty(invitecode))
     {
         //this.invitecodeinfo = Invitation.GetInviteCodeByCode(this.Code);
         invitecodeinfo = Invitation.FindByCode(invitecode);
     }
 }