Beispiel #1
0
        public IActionResult Performance()
        {
            var orgId           = getOrg();
            var userId          = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var employeeDetails = _context.EmployeeDetails.Where(x => x.UserId == Guid.Parse(userId)).FirstOrDefault();

            EmployeePerformanceViewModel epVM = new EmployeePerformanceViewModel();

            var empTemplate = _context.AppraisalAssignedTemplates.Where(x => x.OrganisationId == orgId).Where(x => x.EmployeeDetailId == employeeDetails.Id).Where(x => x.Status != "Completed").Include(x => x.AppraisalTemplate).Include(x => x.Appraisal).ToList();

            epVM.AppraisalAssignedTemplates = empTemplate;



            return(View(epVM));
        }
        public bool SaveEmployeePerformace(EmployeePerformanceViewModel model)
        {
            var checkperfomance         = _db.EmployeePerformances.Where(x => x.ReviewId == model.ReviewId && x.Archived == false && x.EmployeeId == model.EmployeeId).ToList();
            var checkPerformanceSetting = _db.PerformanceSettings.Where(x => x.Id == model.ReviewId && x.Archived == false).FirstOrDefault();

            if (checkPerformanceSetting.CompletionDate == null)
            {
                model.CompletionDateTime = model.CompletionDateTime.Replace("-", "/");
                model.CompletionDate     = DateTime.ParseExact(model.CompletionDateTime, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat);
                checkPerformanceSetting.CompletionDate   = model.CompletionDate;
                _db.Entry(checkPerformanceSetting).State = System.Data.Entity.EntityState.Modified;
                _db.SaveChanges();
            }
            if (checkperfomance.Count > 0)
            {
                return(false);
            }
            else
            {
                EmployeePerformance EmpPer = new EmployeePerformance();
                EmpPer.ProjectId            = model.ProjectId;
                EmpPer.EmployeeId           = model.EmployeeId;
                EmpPer.ReviewId             = model.ReviewId;
                EmpPer.ReviewDate           = DateTime.Now;
                EmpPer.RevviewByEmpID       = SessionProxy.UserId;
                EmpPer.ReviewStatus         = "Open";
                EmpPer.Archived             = false;
                EmpPer.UserIDCreatedBy      = SessionProxy.UserId;
                EmpPer.UserIDLastModifiedBy = SessionProxy.UserId;
                EmpPer.CreatedDate          = DateTime.Now;
                EmpPer.LastModifiedDate     = DateTime.Now;
                _db.EmployeePerformances.Add(EmpPer);
                _db.SaveChanges();
                return(true);
            }
        }