private void SavePage() //第一次设置密码保护问题保存到数据库的 { int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } string Mypmobile = new BCW.BLL.User().GetMobile(meid); string mobile = Utils.GetRequest("Mymobile", "post", 2, @"^[\d]+$", "请输入正确的手机号码"); string Myanswer = Utils.GetRequest("Myanswer", "post", 2, @"^[\s\S]+$", "请输入问题答案"); if (Mypmobile.Equals(mobile)) { Master.Title = "密保管理问题成功"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("密码保护设置" + "<br />"); builder.Append(Out.Tab("</div>", "")); string Myquestion = Utils.GetRequest("Myquestion", "post", 2, @"^[\s\S]{1,50}$", "请输入问题"); builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append(" 恭喜!你的密码保护设置成功" + "<br/>"); builder.Append("你的问题是:" + Myquestion + "<br />"); //} // string Myanswer = Utils.GetRequest("Myanswer", "post", 2, @"^[\s\S]{1,20}$", "问题答案限1-20字"); builder.Append("你的答案是:" + Myanswer + "<br />"); builder.Append(Out.Tab("</div>", "")); BCW.Model.tb_Question model = new BCW.Model.tb_Question(); model.Mobile = Mypmobile; model.Question = Myquestion; model.Answer = Myanswer; model.state = 1; model.ID = meid; model.lastchange = 0; model.changecount = 0; model.code = string.Empty; new BCW.BLL.tb_Question().Add(model); //添加一条数据进入数据库 builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append("5秒后自动跳转到主页<br />"); builder.Append(Out.Tab("</div>", "")); builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("请您牢记答案.当您忘记密码或ID被盗,可使用本答案取回密码!" + "<br />"); builder.Append(Out.Tab("</div>", "")); Master.Refresh = 5; //5秒后跳转到以下地址(可缺省) Master.Gourl = Utils.getUrl("SetQuestion.aspx"); //跳到的地址(可缺省) builder.Append("<a href=\"" + Utils.getUrl("SetQuestion.aspx") + "\">如果还没有跳转,请点击该链接返回主页</a>"); builder.Append(Out.Tab("</div>", "")); } else { Utils.Success("温馨提示", "抱歉,验证手机号码失败,请重新输入..", Utils.getUrl("SetQuestion.aspx"), "3"); } }
private void SavePageAgain() //修改密码保护问题,再次保存到数据库 { int meid = new BCW.User.Users().GetUsId(); if (meid == 0) { Utils.Login(); } string Mypmobile = new BCW.BLL.User().GetMobile(meid); Master.Title = "密保管理问题成功"; builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("密码保护设置" + "<br />"); builder.Append(Out.Tab("</div>", "")); string Myquestion = Utils.GetRequest("Myquestion", "post", 2, @"^[\s\S]{1,20}$", "请输入问题!"); string Myanswer = Utils.GetRequest("Myanswer", "post", 2, @"^[\s\S]{1,20}$", "请输入问题答案"); builder.Append(Out.Tab("<div class=\"text\">", "")); builder.Append(" 恭喜!你的密码保护设置成功" + "<br/>"); builder.Append("你的问题是:" + Myquestion + "<br />"); builder.Append("你的答案是:" + Myanswer + "<br />"); builder.Append(Out.Tab("</div>", "")); BCW.Model.tb_Question model = new BCW.Model.tb_Question(); model.Mobile = Mypmobile; model.Question = Myquestion; model.Answer = Myanswer; model.state = 1; model.ID = meid; model.lastchange = new BCW.BLL.tb_Question().GetLastChange(meid); model.changecount = new BCW.BLL.tb_Question().GetChangeCount(meid); model.code = string.Empty; new BCW.BLL.tb_Question().Update(model); //更新一条数据进入数据库 builder.Append(Out.Tab("<div class=\"title\">", "")); builder.Append("请您牢记答案.当您忘记密码或ID被盗,可使用本答案取回密码!" + "<br />"); builder.Append(Out.Tab("</div>", "")); builder.Append("5秒后自动跳转到主页<br />"); Master.Refresh = 5; //5秒后跳转到以下地址(可缺省) Master.Gourl = Utils.getUrl("GetPwd.aspx"); //跳到的地址(可缺省) builder.Append("<a href=\"" + Utils.getUrl("SetQuestion.aspx") + "\">如果还没有跳转,请点击该链接返回主页</a>"); }
/// <summary> /// 根据ID更新一条数据 /// </summary> public void Update(BCW.Model.tb_Question model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(BCW.Model.tb_Question model) { dal.Add(model); }