public int LoginOn(string userAccount, string userPassword) { string password = FormsAuthentication.HashPasswordForStoringInConfigFile(userPassword, "md5"); bool exist = webUserservice.ExistUser(userAccount, password); if (exist) { WebUser User = webUserservice.GetWebUserByAccount(userAccount, password); WebUserService webuserservice = new WebUserService(); WebPeopleService webpeopleservice = new WebPeopleService(); //userAccount=UserName if (User.IsLock) { //被锁定 return(100); } else { SessionHelper.SetSession("UserName", userAccount); WebUser webuser = webuserservice.GetWebUserByAccount(userAccount); SessionHelper.SetSession("UserID", webuser.UserID); SessionHelper.SetSession("PositionCode", webuser.PositionCode); WebPeople webpeople = new WebPeople(); WebWorker webWorker = new WebWorker(); if (webpeopleservice.IsHaveuser(webuser.UserID) && webuser.PositionCode == "WebPeople") { webpeople = webpeopleservice.GetWebPeopleByUserID(webuser.UserID); SessionHelper.SetSession("PositionID", webpeople.PeopleID); } else if (webWorkerService.IsHaveWorker(webuser.UserID) && (webuser.PositionCode == "WebWorkerLeader" || webuser.PositionCode == "WebWorker")) { webWorker = webWorkerService.GetWebWorkerByUserID(webuser.UserID); SessionHelper.SetSession("PositionID", webWorker.WorkerID); } SessionHelper.SetSession("NickName", webuser.NickName); return(200); } } else { return(500); } }