protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, NameAuthorizationRequirement requirement)
 {
     if (context.User != null && context.User.HasClaim(c => c.Type == ClaimTypes.Sid))
     {
         string sid = context.User.FindFirst(c => c.Type == ClaimTypes.Sid).Value;
         var    em  = _employee.GetEmployeeById(sid);
         if (em != null)
         {
             context.Succeed(requirement);
         }
     }
     return(Task.CompletedTask);
 }
        public IActionResult Index(string?id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(Redirect("/home/index"));
            }
            var employee = _employee.GetEmployeeById(id);

            if (employee != null && HttpContext.User.Identity.Name == employee.UserName)
            {
                return(View(employee));
            }

            return(Redirect("/home/login"));
        }
        public string Find()
        {
            string   id = Request.Form["text"];
            Employee em = _employeeSql.GetEmployeeById(id);
            var      md = _moveDelSql.GetMoveDepsByEmpId(id);

            if (em == null)
            {
                return(null);
            }
            string s = em.EmpId + " " + em.Name + " " + em.State + " " + em.WorkStart + " " + em.Job + " " + em.Position + " " + em.DepId;

            foreach (var i in md)
            {
                s += " " + i.Id;
                s += " " + i.EmpId;
                s += " " + i.Day;
                s += " " + i.DepForm;
                s += " " + i.DepTo;
                s += " " + i.Reason;
            }
            return(s);
        }