📅  最后修改于: 2022-03-11 14:48:40.383000             🧑  作者: Mango
// model properties
public class TargetUsers
{
public string LoginName { get; set; }
public string Email { get; set; }
public string CountryCode { get; set; }
public string BranchCode { get; set; }
public string LoginType { get; set; }
}
// DAL
public List GetTargetUsers()
{
try
{
using (var entities = new YourEntities())
{
var query = (from login in entities.Login_User
join company in entities.Mst_CompanyCode
on login.LU_CountryCode equals company.MC_CompanyCode
join branch in entities.Mst_BranchCode
on company.MC_CompanyCode equals branch.MC_CompanyCode
where company.MC_isEnabled == true
orderby login.LU_LOGIN_NAME
select new TargetUsers()
{
LoginName = login.LU_LOGIN_NAME,
//Email = login.LU_EMAIL,
//CountryCode = login.LU_CountryCode,
//BranchCode = branch.MC_BranchCode,
//LoginType = login.LU_Login_Type
}).Distinct();
return query.ToList();
}
}
catch (Exception)
{
throw;
}
}