public void AddSave(T_Base_Teacher teacher) { DALT_Base_Teacher dal = new DALT_Base_Teacher(); string pwd = MD5Class.UserMd5(teacher.TeaId); teacher.PassWord = pwd; bool res = dal.Add(teacher); if (res) { string tmp = "{\"statusCode\":\"200\",\"message\":\"插入成功\",\"navTabId\":\"TeacherList\",\"rel\":\"TeacherList\",\"callbackType\":\"closeCurrent\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } else { string tmp = "{\"statusCode\":\"300\",\"message\":\"插入失败\",\"navTabId\":\"TeacherList\",\"rel\":\"TeacherList\",\"callbackType\":\"closeCurrent\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } }
public void AddSave(T_Base_Student student) { DALT_Base_Student dal = new DALT_Base_Student(); string pwd = MD5Class.UserMd5(student.StuId); student.ClassId = Convert.ToInt32(Request.Form["Class.Id"]); student.PassWord = pwd; int res = dal.Add(student); if (res != 0) { string tmp = "{\"statusCode\":\"200\",\"message\":\"插入成功\",\"navTabId\":\"StudentList\",\"rel\":\"StudentList\",\"callbackType\":\"closeCurrent\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } else { string tmp = "{\"statusCode\":\"300\",\"message\":\"插入失败\",\"navTabId\":\"StudentList\",\"rel\":\"StudentList\",\"callbackType\":\"closeCurrent\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } }
public void Reset(int id) { DALT_Base_Student db = new DALT_Base_Student(); T_Base_Student student = db.GetStudent(id); string pwd = MD5Class.UserMd5(student.StuId); student.PassWord = pwd; bool res = db.Update(student); if (res) { string tmp = "{\"statusCode\":\"200\",\"message\":\"重置密码成功\",\"navTabId\":\"StudentList\",\"rel\":\"StudentList\",\"callbackType\":\"\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } else { string tmp = "{\"statusCode\":\"300\",\"message\":\"重置密码失败\",\"navTabId\":\"StudentList\",\"rel\":\"StudentList\",\"callbackType\":\"\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } }
public void Reset(int id) { DALT_Base_Teacher db = new DALT_Base_Teacher(); T_Base_Teacher teacher = db.GetTeacher(id); string pwd = MD5Class.UserMd5(teacher.TeaId); teacher.PassWord = pwd; bool res = db.Update(teacher); if (res) { string tmp = "{\"statusCode\":\"200\",\"message\":\"重置密码成功\",\"navTabId\":\"teacherList\",\"rel\":\"teacherList\",\"callbackType\":\"\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } else { string tmp = "{\"statusCode\":\"300\",\"message\":\"重置密码失败\",\"navTabId\":\"teacherList\",\"rel\":\"teacherList\",\"callbackType\":\"\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } }
public void UpPwd(string oldpwd, string newpwd1, string newpwd2) { string newId = Session["UserId"].ToString(); int id = Convert.ToInt32(newId); DALT_Base_Admin dal = new DALT_Base_Admin(); T_Base_Admin admin = dal.GetModel(id); string a = MD5Class.UserMd5(oldpwd); string b = MD5Class.UserMd5(newpwd1); if (a != admin.PassWord) { string tmp = "{\"statusCode\":\"300\",\"message\":\"旧密码错误\",\"navTabId\":\"UserList\",\"rel\":\"UserList\",\"callbackType\":\"\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } else { if (newpwd1 != newpwd2) { string tmp = "{\"statusCode\":\"300\",\"message\":\"新密码不一致\",\"navTabId\":\"UserList\",\"rel\":\"UserList\",\"callbackType\":\"\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } else { admin.PassWord = b; bool res = dal.Update(admin); if (res) { string tmp = "{\"statusCode\":\"200\",\"message\":\"修改成功\",\"navTabId\":\"UserList\",\"rel\":\"UserList\",\"callbackType\":\"closeCurrent\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } else { string tmp = "{\"statusCode\":\"300\",\"message\":\"修改失败,请重试\",\"navTabId\":\"UserList\",\"rel\":\"UserList\",\"callbackType\":\"\",\"forwardUrl\":\"\"}"; Response.Write(tmp); } } } }
public JsonResult LoginCheck(string Name, string password, string checkres) { string pwd = MD5Class.UserMd5(password); if (checkres == "学生") { DAL.DALT_Base_Student dal = new DAL.DALT_Base_Student(); Model.T_Base_Student student = dal.GetStu(Name); if (ifExist(Name, pwd, checkres)) { Session["UserName"] = student.Name; Session["UserId"] = student.Id; Session["ClassId"] = student.ClassId; Session["UserLevel"] = 0; if (student.IsBGB == 1 && student.IsKDB == 1) { Session["UserLevel"] = 3; } else if (student.IsBGB == 1) { Session["UserLevel"] = 2; } else if (student.IsKDB == 1) { Session["UserLevel"] = 1; } return(Json(new { code = 11, message = "登录成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { code = 3, message = "用户名或密码错误" }, JsonRequestBehavior.AllowGet)); } } else if (checkres == "老师") { DAL.DALT_Base_Teacher dal = new DAL.DALT_Base_Teacher(); Model.T_Base_Teacher teacher = dal.GetTea(Name); DAL.DALT_Base_Class dal2 = new DAL.DALT_Base_Class(); Model.T_Base_Class cla = new T_Base_Class(); if (teacher.IsBZR == 1) { cla = dal2.FindCla(teacher.Id); Session["ClassId"] = cla.Id; } else { Session["ClassId"] = 0; } if (ifExist(Name, pwd, checkres)) { Session["UserName"] = teacher.Name; Session["UserId"] = teacher.Id; Session["UserLevel"] = 10; if (teacher.IsBZR == 1) { Session["UserLevel"] = 11; } return(Json(new { code = 12, message = "登录成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { code = 3, message = "用户名或密码错误" }, JsonRequestBehavior.AllowGet)); } } else { DAL.DALT_Base_Admin dal = new DAL.DALT_Base_Admin(); Model.T_Base_Admin admin = dal.GetAdmin(Name); if (ifExist(Name, pwd, checkres)) { Session["UserId"] = admin.Id; Session["Name"] = admin.LoginName; return(Json(new { code = 13, message = "登录成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { code = 3, message = "用户名或密码错误" }, JsonRequestBehavior.AllowGet)); } } }