This commit is contained in:
parent
9bcd11cf28
commit
ce367dba3d
|
@ -17,7 +17,37 @@ namespace BLL
|
||||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||||
{
|
{
|
||||||
var getUser = db.View_Sys_User.FirstOrDefault(x => (x.Account == userInfo.Account || x.Telephone == userInfo.Telephone) && x.IsPost == true && x.Password == Funs.EncryptionPassword(userInfo.Password));
|
var getUser = db.View_Sys_User.FirstOrDefault(x => (x.Account == userInfo.Account || x.Telephone == userInfo.Telephone) && x.IsPost == true && x.Password == Funs.EncryptionPassword(userInfo.Password));
|
||||||
return ObjectMapperManager.DefaultInstance.GetMapper<Model.View_Sys_User, Model.UserItem>().Map(getUser);
|
if (getUser != null)
|
||||||
|
{
|
||||||
|
return ObjectMapperManager.DefaultInstance.GetMapper<Model.View_Sys_User, Model.UserItem>().Map(getUser);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var getPerson = from x in db.SitePerson_Person
|
||||||
|
where (x.Telephone == userInfo.Account || x.PersonName == userInfo.Account)
|
||||||
|
&& (x.Password == Funs.EncryptionPassword(userInfo.Password)
|
||||||
|
|| (x.IdentityCard != null && x.IdentityCard.Substring(x.IdentityCard.Length - 4) == userInfo.Password))
|
||||||
|
&& x.IsUsed == true
|
||||||
|
orderby x.InTime descending
|
||||||
|
select new Model.UserItem
|
||||||
|
{
|
||||||
|
UserId = x.PersonId,
|
||||||
|
UserCode = x.CardNo,
|
||||||
|
Password = x.Password,
|
||||||
|
UserName = x.PersonName,
|
||||||
|
UnitId = x.UnitId,
|
||||||
|
LoginProjectId = x.ProjectId,
|
||||||
|
IdentityCard = x.IdentityCard,
|
||||||
|
Account = x.PersonName,
|
||||||
|
UnitName = db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
|
||||||
|
LoginProjectName = db.Base_Project.First(u => u.ProjectId == x.ProjectId).ProjectName,
|
||||||
|
Telephone = x.Telephone,
|
||||||
|
WorkPostId = x.WorkPostId,
|
||||||
|
WorkPostName = db.Base_WorkPost.First(w => w.WorkPostId == x.WorkPostId).WorkPostName,
|
||||||
|
};
|
||||||
|
return getPerson.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue