protected void Page_Load(object sender, EventArgs e)
        {
            if (function.isAjax())
            {
                string action = Request.Form["action"];
                string result = "";
                switch (action)
                {
                case "addsub":    //订阅邮箱处理
                {
                    M_UserInfo      mu      = buser.GetLogin();
                    int             userid  = mu == null ? 0 : mu.UserID;
                    string          uname   = userid > 0 ? mu.UserName : "******";
                    M_Mail_BookRead readMod = readBll.SelByEMail(Request.Form["EMail"]);
                    if (readMod != null && readMod.IsAudit == 1)
                    {
                        result = "-1"; break;
                    }                                                                             //邮箱已订阅
                    if (readMod != null)
                    {
                        result = SendSubEmail(uname, readMod.AuthCode, readMod.EMail); break;
                    }
                    readMod          = new M_Mail_BookRead();
                    readMod.UserID   = userid;
                    readMod.Source   = Request.UrlReferrer.ToString();
                    readMod.IP       = Request.UserHostAddress;
                    readMod.EMail    = Request.Form["EMail"];
                    readMod.Browser  = Request.Browser.Type;
                    readMod.CDate    = DateTime.Now;
                    readMod.IsAudit  = 0;       //并未验证
                    readMod.AuthCode = function.GetRandomString(10);
                    readBll.GetInsert(readMod);
                    result = SendSubEmail(uname, readMod.AuthCode, readMod.EMail);
                }
                break;

                default:
                    break;
                }
                Response.Write(result); Response.Flush(); Response.End();
            }
            if (!IsPostBack)
            {
                //验证订阅用户邮件是否有效
                if (string.IsNullOrEmpty(AuthCode))
                {
                    function.WriteErrMsg("参数错误!");
                }
                M_Mail_BookRead readMod = readBll.SelByCode(AuthCode);
                if (readMod == null)
                {
                    function.WriteErrMsg("验证错误!");
                }
                readMod.IsAudit  = 1;//已验证
                readMod.AuthCode = function.GetRandomString(8);
                readBll.GetUpdata(readMod);
                function.WriteSuccessMsg("验证成功!", "/");
            }
        }
Example #2
0
 public int GetInsert(M_Mail_BookRead model)
 {
     return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
 }
Example #3
0
 public bool GetUpdata(M_Mail_BookRead model)
 {
     return(Sql.UpdateByIDs(strTableName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), initmod.GetParameters()));
 }
Example #4
0
 public int GetInsert(M_Mail_BookRead model)
 {
     return(DBCenter.Insert(model));
 }
Example #5
0
 public bool GetUpdata(M_Mail_BookRead model)
 {
     return(DBCenter.UpdateByID(model, model.ID));
 }