Пример #1
0
        public async Task <Users> EmployeeLoginAsync(string employeeCode, EntityContextDocpd context)
        {
            if (employeeCode == null)
            {
                return(null);
            }

            var payload = await context.Idoc_user
                          .Include(c => c.Idoc_Department)
                          .Where(c => c.User_employeecode == employeeCode)
                          .Select(c => new Users
            {
                EmployeeCode = employeeCode,
                RoleName     = c.Idoc_Department.Dept_department
            })
                          .FirstOrDefaultAsync();


            string[] availableRoleNames = { "Agency Support", "Actuarial", "Information Technology" };

            if (payload != null && Array.FindIndex(availableRoleNames, m => m == payload.RoleName) == -1)
            {
                payload.RoleName = "InternalEmployee";
            }

            return(payload);
        }
Пример #2
0
 public UserService(IOptions <AppSettings> _appSettings, EntityContextWEB _contextWeb, EntityContextDocpd _contextDocpd)
 {
     appSettings  = _appSettings.Value;
     contextWeb   = _contextWeb;
     contextDocpd = _contextDocpd;
 }