public MethodResult <UserTdm> Login(string username, string password) { return(DbSessionManager.Execute <MethodResult <UserTdm> >((IDbSession sess) => { UserTdm u = userWorker.FindByUserName(sess, username); if (null == u || String.IsNullOrEmpty(password)) { return MethodResult <UserTdm> .Failed("用户名或密码错误!"); } if (u.Kind == UserKind.Virtual) { return MethodResult <UserTdm> .Failed("账户不存在!"); } if (u.RowState != RowState.Normal || (u.Locked && u.TimeLocked > DateTime.Now)) { return MethodResult <UserTdm> .Failed("账户已经被锁定,请稍后再试!"); } password = password.MD5(); if (password == u.Password) { userWorker.SetLoginSuccess(sess, u.Id); return MethodResult <UserTdm> .Successful(u); } userWorker.SetLoginFailed(sess, u.Id, u.FailCount > WebApp.PasswordFailCount); return MethodResult <UserTdm> .Failed("用户名或密码错误!"); })); }
public ActionResult GetTextBooks() { return(Json(MethodResult <List <TextbookTdm> > .Successful(textBookService.GetAll()))); }
public ActionResult GetEditions() { return(Json(MethodResult <List <EditionTdm> > .Successful(editionService.GetAll()))); }
public ActionResult GetPublishs() { return(Json(MethodResult <List <PublishTdm> > .Successful(publishService.GetAll()))); }
public ActionResult GetSubjects() { return(Json(MethodResult <List <SubjectTdm> > .Successful(subjectService.GetAll()))); }
public ActionResult GetGrades() { return(Json(MethodResult <List <GradeTdm> > .Successful(gradeService.GetAll()))); }