// GET: student/PersonalCenter public ActionResult Index() { var result = new ChangePWD(); result.Success = false; try { string oldPWD = Request.QueryString["oldPWD"]; string newPWD = Request.QueryString["newPWD"]; int userID = Common.User.GetUserID(Session["Username"].ToString()); //判断旧密码 if (Common.Auth.CheckPwd(oldPWD, Common.User.GetUserName(userID))) { //更新密码 var bll = new BLL.user(); var model = bll.GetModel(p => p.id == userID); string pwd = Common.Auth.Encrypt(newPWD); model.pwd = pwd; bll.Update(model, new[] { "id", "pwd" }); result.Success = true; } } catch (Exception) { return(View()); } return(View(result)); }
private bool DoEdit(int _id) { try { BLL.user bll = new BLL.user(); Model.user model = bll.GetModel(_id); model.nickname = txtName.Text; model.status = Convert.ToInt32(rblStatus.SelectedValue); model.sex = Convert.ToInt32(rblSex.SelectedValue); model.point = Convert.ToInt32(txtPoint.Text); model.parent_id = Convert.ToInt32(txtParent.Text); model.phone = txtPhone.Text; model.email = txtEmail.Text; model.login_time = Convert.ToDateTime(txtLoginTime.Text); model.reg_time = Convert.ToDateTime(txtRegTime.Text); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改产品经理信息"); //记录日志 return(true); } } catch { return(false); } return(false); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //图片 if (context.Request["page"] == "img") { int id = Convert.ToInt32(context.Request["id"]); string text = context.Request["text"]; string img = context.Request["img"]; int img_is = Convert.ToInt32(context.Request["is"]); Model.img model_img = new Model.img() { Img_address = img, Img_id = id, Img_is = img_is, Img_text = text }; BLL.img bll_img = new BLL.img(); if (bll_img.Update(model_img) == true) { context.Response.Write("修改成功"); } else { context.Response.Write("修改失败"); } } //用户 if (context.Request["page"] == "user") { int id = Convert.ToInt32(context.Request["id"]); string name = context.Request["name"]; string img = context.Request["img"]; int qq = Convert.ToInt32(context.Request["qq"]); int phone = Convert.ToInt32(context.Request["phone"]); Model.user model_user = new Model.user() { User_id = id, User_name = name, User_img = img, User_qq = qq, User_phone = phone, User_pwd = id.ToString() }; BLL.user bll_user = new BLL.user(); if (bll_user.Update(model_user) == true) { context.Response.Write("修改成功"); } else { context.Response.Write("修改失败"); } } //评论 if (context.Request["page"] == "tell") { int id = Convert.ToInt32(context.Request["id"]); BLL.tell bll_tell = new BLL.tell(); List <Model.tell> list_tell = bll_tell.GetModelList("Tell_blogid=" + id + ""); BLL.user bll_user = new BLL.user(); for (int i = 0; i < list_tell.Count; i++) { Model.user model_user = bll_user.GetModel((double)list_tell[i].Tell_userid); list_tell[i].Tell_username = model_user.User_name; } System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer(); string a = js.Serialize(list_tell); context.Response.Write(a); } //博客 if (context.Request["page"] == "blog") { int id = Convert.ToInt32(context.Request["id"]); string title = context.Request["title"]; string img = context.Request["img"]; int showis = Convert.ToInt32(context.Request["showis"]); string time = context.Request["time"]; string typename = context.Request["typename"]; string text = context.Request["text"]; string abs = context.Request["abs"]; BLL.blog_type bll_type = new BLL.blog_type(); List <Model.blog_type> list_type = bll_type.GetModelList("Type_name='" + typename + "'"); Model.blogs model_blog = new Model.blogs() { Blog_id = id, Blog_title = title, Blog_img = img, Blog_is = showis, Blog_time = time, Blog_typeid = list_type[0].Type_id, Blog_text = text, Blog_delete = 0, Blog_abstract = abs }; BLL.blogs blogs = new BLL.blogs(); bool blog_add = blogs.Update(model_blog); if (blog_add == true) { context.Response.Write("修改成功"); } else { context.Response.Write("修改失败"); } } //博客类型 if (context.Request["page"] == "type") { int id = Convert.ToInt32(context.Request["id"]); string type = context.Request["type"]; int bai = Convert.ToInt32(context.Request["bai"]); Model.blog_type model_type = new Model.blog_type() { Type_id = id, Type_name = type, Type_percentage = bai }; BLL.blog_type bll_type = new BLL.blog_type(); bool a = bll_type.Update(model_type); if (a == true) { context.Response.Write("修改成功"); } else { context.Response.Write("修改失败"); } } }