本文整理汇总了C#中Eme.Model.Eme.EmeEntities.GetUserTypeInfoByMobile方法的典型用法代码示例。如果您正苦于以下问题:C# EmeEntities.GetUserTypeInfoByMobile方法的具体用法?C# EmeEntities.GetUserTypeInfoByMobile怎么用?C# EmeEntities.GetUserTypeInfoByMobile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eme.Model.Eme.EmeEntities
的用法示例。
在下文中一共展示了EmeEntities.GetUserTypeInfoByMobile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUserInfoByPhone
///// <summary>
///// 作者:Kylin
///// 时间:2015.07.29
///// 描述:根据Phone 获取学员信息
///// </summary>
///// <param name="mobile"></param>
///// <param name="userId"></param>
///// <returns></returns>
//public static UserInfoByMobileModel GetUserInfoByMobile(string mobile)
//{
// var userModel = new UserInfoByMobileModel() { MobilePhone = mobile };
// if (string.IsNullOrEmpty(mobile))
// return null;
// var sa = string.Empty;
// var cc = string.Empty;
// using (var edb = new EmeEntities())
// {
// var user = (from u in edb.UserInfo
// join us in edb.User on u.UserId equals us.Id
// join ub in edb.UserBranch on u.UserId equals ub.UserId
// where u.Mobile == mobile && ub.IsMain
// && u.Status == ConvertEnum.StatusTypeForActive
// && ub.Status == ConvertEnum.StatusTypeForActive
// && us.Status == ConvertEnum.StatusTypeForActive
// select new
// {
// Mobile = u.Mobile,
// BranchId = ub.BranchId,
// UserType = us.UserType,
// UserId = u.UserId,
// CName = u.CName,
// EName = u.EName,
// }).FirstOrDefault();
// // 信息
// if (user != null)
// {
// var branch = edb.Branch.FirstOrDefault(
// b => b.Id == user.BranchId && b.Status == ConvertEnum.StatusTypeForActive);
// if (branch != null)
// {
// userModel.UserId = user.UserId;
// userModel.CName = user.CName;
// userModel.EName = user.EName;
// if (user.UserType == ConvertEnum.UserTypeForStudent && edb.Student.Any(p => p.UserId == user.UserId && p.Status == ConvertEnum.StatusTypeForActive))//学员
// {
// userModel.UserType = BaseEnum.EmeEnum<UserType>.GetEnameByValue(user.UserType);
// }
// else if (edb.Teacher.Any(p => p.UserId == user.UserId && p.Status == ConvertEnum.StatusTypeForActive)) //老师
// {
// var teacherUser = edb.Teacher.FirstOrDefault(p => p.UserId == user.UserId && p.Status == ConvertEnum.StatusTypeForActive);
// if (null != teacherUser)
// {
// var teachType = BaseEnum.EmeEnum<TeacherType>.GetScodeByValue(teacherUser.TeacherType);
// userModel.UserType = teachType;
// }
// }
// else //员工
// {
// userModel.UserType = BaseEnum.EmeEnum<UserType>.GetScodeByValue(user.UserType);
// }
// //用户岗位user job
// var userORGType = edb.UserJob.Where(p => p.UserId == user.UserId && p.Status == ConvertEnum.StatusTypeForActive).Select(p => p.Job.SCode);
// foreach (var jobScode in userORGType)
// {
// userModel.ORGType += jobScode;
// userModel.ORGType += ",";
// }
// userModel.ORGType = userModel.ORGType.TrimEnd(',');
// }
// }
// return userModel;
// }
//}
/// <summary>
/// 作者:Kylin
/// 时间:2015.08.05
/// 描述:获取用户身份, 根据userId 二次认证
/// </summary>
/// <param name="phone"></param>
/// <param name="userId"></param>
/// <returns></returns>
public static UserInfoByPhoneModel GetUserInfoByPhone(string phone, int? userId)
{
var userModel = new UserInfoByPhoneModel()
{
UserId = userId ?? 0,
MobilePhone = phone
};
if (string.IsNullOrEmpty(phone) && !userId.HasValue)
return userModel;
using (var edb = new EmeEntities())
{
userModel = edb.GetUserTypeInfoByMobile(phone, userId).Select(u => new UserInfoByPhoneModel()
{
MobilePhone = u.Mobile,
BranchId = u.BranchId.Value,
UserType = u.UserType,
UserTypeId = u.UserTypeId.Value,
//.........这里部分代码省略.........