public UserEntity CheckLogin(string username, string password) { List <UserEntity> list = service.FindList("select * from Sys_user"); UserEntity userEntity = service.FindEntity(t => t.F_Account == username); if (userEntity != null) { if (userEntity.F_EnabledMark == true) { UserLogOnEntity userLogOnEntity = userLogOnApp.GetForm(userEntity.F_Id); string dbPassword = Md5.md5(DESEncrypt.Encrypt(password.ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower(); if (dbPassword == userLogOnEntity.F_UserPassword) { DateTime lastVisitTime = DateTime.Now; int LogOnCount = (userLogOnEntity.F_LogOnCount).ToInt() + 1; if (userLogOnEntity.F_LastVisitTime != null) { userLogOnEntity.F_PreviousVisitTime = userLogOnEntity.F_LastVisitTime.ToDate(); } userLogOnEntity.F_LastVisitTime = lastVisitTime; userLogOnEntity.F_LogOnCount = LogOnCount; userLogOnApp.UpdateForm(userLogOnEntity); return(userEntity); } else { throw new Exception("密码不正确,请重新输入"); } } else { throw new Exception("账户被系统锁定,请联系管理员"); } } else { throw new Exception("账户不存在,请重新输入"); } }
public UserEntity CheckLogin(string username, string password) { UserEntity userEntity = service.FindEntity(t => t.F_Account == username); if (userEntity != null) { if (userEntity.F_EnabledMark == true) { UserLogOnEntity userLogOnEntity = userLogOnApp.GetForm(userEntity.F_Id); string dbPassword = Md5.md5(DESEncrypt.Encrypt(password.ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower(); if (dbPassword == userLogOnEntity.F_UserPassword) { DateTime lastVisitTime = DateTime.Now; int LogOnCount = (userLogOnEntity.F_LogOnCount).ToInt() + 1; if (userLogOnEntity.F_LastVisitTime != null) { userLogOnEntity.F_PreviousVisitTime = userLogOnEntity.F_LastVisitTime.ToDate(); } userLogOnEntity.F_LastVisitTime = lastVisitTime; userLogOnEntity.F_LogOnCount = LogOnCount; userLogOnApp.UpdateForm(userLogOnEntity); return(userEntity); } else { throw new Exception("please agin"); } } else { throw new Exception("error"); } } else { throw new Exception("error"); } }
public AgentEntity CheckLogin(string username, string password) { AgentEntity userEntity = service.FindEntity(t => t.c_name == username); if (userEntity != null) { if (userEntity.c_state == 1) { UserLogOnEntity userLogOnEntity = userLogOnApp.GetForm(userEntity.F_Id); string dbPassword = Md5.md5(DESEncrypt.Encrypt(password.ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower(); if (dbPassword == userLogOnEntity.F_UserPassword) { DateTime lastVisitTime = DateTime.Now; int LogOnCount = (userLogOnEntity.F_LogOnCount).ToInt() + 1; if (userLogOnEntity.F_LastVisitTime != null) { userLogOnEntity.F_PreviousVisitTime = userLogOnEntity.F_LastVisitTime.ToDate(); } userLogOnEntity.F_LastVisitTime = lastVisitTime; userLogOnEntity.F_LogOnCount = LogOnCount; userLogOnApp.UpdateForm(userLogOnEntity); return(userEntity); } else { throw new Exception("密码不正确,请重新输入"); } } else { throw new Exception("账户还未审核通过,请联系管理员"); } } else { throw new Exception("账户不存在,请重新输入"); } }
//登录 public UserEntity CheckLogin(string username, string password) { bool DL = true; string ip = Net.Ip; //获取访问通过的ip List <FilterIPEntity> list = new FilterIPApp().GetList(); if (list != null && list.Count != 0) { foreach (FilterIPEntity fi in list) { bool b = Net.isinip(ip, fi.F_StartIP, fi.F_EndIP); if (b) { DL = false; break; } } if (DL) { UserEntity userEntity = service.FindEntity(t => t.F_Account == username); if (userEntity != null) { if (userEntity.F_EnabledMark == true) { UserLogOnEntity userLogOnEntity = userLogOnApp.GetForm(userEntity.F_Id); string dbPassword = Md5.md5(DESEncrypt.Encrypt(password.ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower(); if (dbPassword == userLogOnEntity.F_UserPassword) { DateTime lastVisitTime = DateTime.Now; int LogOnCount = (userLogOnEntity.F_LogOnCount).ToInt() + 1; if (userLogOnEntity.F_LastVisitTime != null) { userLogOnEntity.F_PreviousVisitTime = userLogOnEntity.F_LastVisitTime.ToDate(); } userLogOnEntity.F_LastVisitTime = lastVisitTime; userLogOnEntity.F_LogOnCount = LogOnCount; userLogOnApp.UpdateForm(userLogOnEntity); return(userEntity); } else { throw new Exception("密码不正确,请重新输入"); } } else { throw new Exception("账户被系统锁定,请联系管理员"); } } else { throw new Exception("账户不存在,请重新输入"); } } else { throw new Exception("您的ip被禁用了!"); } } else { UserEntity userEntity = service.FindEntity(t => t.F_Account == username); if (userEntity != null) { if (userEntity.F_EnabledMark == true) { UserLogOnEntity userLogOnEntity = userLogOnApp.GetForm(userEntity.F_Id); string dbPassword = Md5.md5(DESEncrypt.Encrypt(password.ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower(); if (dbPassword == userLogOnEntity.F_UserPassword) { DateTime lastVisitTime = DateTime.Now; int LogOnCount = (userLogOnEntity.F_LogOnCount).ToInt() + 1; if (userLogOnEntity.F_LastVisitTime != null) { userLogOnEntity.F_PreviousVisitTime = userLogOnEntity.F_LastVisitTime.ToDate(); } userLogOnEntity.F_LastVisitTime = lastVisitTime; userLogOnEntity.F_LogOnCount = LogOnCount; userLogOnApp.UpdateForm(userLogOnEntity); return(userEntity); } else { throw new Exception("密码不正确,请重新输入"); } } else { throw new Exception("账户被系统锁定,请联系管理员"); } } else { throw new Exception("账户不存在,请重新输入"); } } }