private string SendActiveMail() { Model = UserDAL.GetModel(UserID); if (Model == null) return ToJson(new JsonResult(false, "参数不完整")); bool result = SmtpHelper.SendActiveMail(Model.UserID, Model.Email); return ToJson(new JsonResult(result, result ? "激活邮件发送成功" : "激活邮件发送失败")); }
protected void Page_Load(object sender, EventArgs e) { if (!Int64.TryParse(Request["u"], out UserID)) Response.Redirect("list.aspx", true); if (!string.IsNullOrEmpty(Request["action"])) { switch (Request["action"].ToLower().Trim()) { case "getp1": OutPut(RenderView(Bind1())); break; case "active": OutPut(SendActiveMail()); break; case "restpwd": OutPut(restpwd()); break; } } else { Model = UserDAL.GetModel(UserID); if (Model == null) Response.Redirect("list.aspx", true); Repeater1.DataSource = Bind1(); Repeater1.DataBind(); } }
private string restpwd() { Model = UserDAL.GetModel(UserID); if (Model == null) return ToJson(new JsonResult(false, "参数不完整")); bool result = UserDAL.EditPwd(Model.UserID, "123456"); SmtpHelper.SendSys_CPwdMail(Model); return ToJson(new JsonResult(result, result ? "密码已经重置为123456" : "密码重置失败")); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["o"])) { OrderNo = Request["o"].ToLower().ToLower(); OrderModel = OrderDAL.GetOrder(OrderNo); if (OrderModel == null) Response.Redirect("printPhoto.aspx", true); Model = UserDAL.GetModel(OrderModel.UserID); if (Model == null) Response.Redirect("printPhoto.aspx", true); } else { Response.Redirect("printPhoto.aspx", true); } if (!string.IsNullOrEmpty(Request["action"])) { bool result = OrderDAL.DoneOrder(OrderNo); OutPut(ToJson(new JsonResult(result, result ? "该订单已经完成" : "操作失败"))); } }
private string EditUser(HttpContext context) { PageBase pageBase = new PageBase(context); if (pageBase.IsLogin()) { string Address = context.Request["Address"]; string Mobile = context.Request["Mobile"]; string QQ = context.Request["QQ"]; UserModel model = new UserModel(); model.Address = RemoveJ(Address); model.Mobile = RemoveJ(Mobile); model.QQ = RemoveJ(QQ); model.UserID = pageBase.CurrentUser.UserID; if (!string.IsNullOrEmpty(Address)) { bool r = UserDAL.AddDonate(model.UserID, "Address", ConstData.Donate_SetInfo); if (r) { UserDAL.UpdateDonate(model.UserID, "FreePhoto", ConstData.Donate_SetInfo); } } if (!string.IsNullOrEmpty(Mobile)) { bool r = UserDAL.AddDonate(model.UserID, "Mobile", ConstData.Donate_SetInfo); if (r) { UserDAL.UpdateDonate(model.UserID, "FreePhoto", ConstData.Donate_SetInfo); } } if (!string.IsNullOrEmpty(QQ)) { bool r = UserDAL.AddDonate(model.UserID, "QQ", ConstData.Donate_SetInfo); if (r) { UserDAL.UpdateDonate(model.UserID, "FreePhoto", ConstData.Donate_SetInfo); } } if (UserDAL.EditUser(model)) { return "{\"result\":true,\"message\":\"信息设定成功\"}"; } else { return "{\"result\":false,\"message\":\"信息设定失败\"}"; } } return "{\"result\":false,\"message\":\"信息设定失败\"}"; }
/// <summary> /// 登录 /// </summary> /// <param name="email"></param> /// <param name="pwd"></param> /// <param name="user"></param> /// <returns></returns> public static bool LoginModel(string email, string pwd, out UserModel user) { user = GetModel(email); if (user == null) return false; bool isTrue = Md5.CheckPassword(pwd, user.Pwd, 32); return isTrue; }
/// <summary> /// 修改用户信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool EditUser(UserModel model) { string sqlStr = "UPDATE USERS SET ADDRESS=@ADDRESS,SCHOOL=@SCHOOL,QQ=@QQ,MOBILE=@MOBILE WHERE USERID=@USERID;"; SQLiteParameter[] parameters = new SQLiteParameter[5]; parameters[0] = new SQLiteParameter("@ADDRESS", System.Data.DbType.String); parameters[0].Value = model.Address; parameters[1] = new SQLiteParameter("@SCHOOL", System.Data.DbType.String); parameters[1].Value = model.School; parameters[2] = new SQLiteParameter("@QQ", System.Data.DbType.String); parameters[2].Value = model.QQ; parameters[3] = new SQLiteParameter("@MOBILE", System.Data.DbType.String); parameters[3].Value = model.Mobile; parameters[4] = new SQLiteParameter("@USERID", System.Data.DbType.Int64); parameters[4].Value = model.UserID; return ExecuteNonQuery(sqlStr, parameters) > 0; }