public ActionResult DeleteConfirmed(int id) { RankHierarchy rankHierarchy = Service.Get(id); Service.RemoveByEntity(rankHierarchy); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "RankHierarchyId,DepartmentId,SalaryRankId,NextSalaryRankId")] RankHierarchy rankHierarchy) { if (ModelState.IsValid) { Service.Update(rankHierarchy, rankHierarchy.RankHierarchyId); return(RedirectToAction("Index")); } return(View(rankHierarchy)); }
// GET: RankHierarchies/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RankHierarchy rankHierarchy = Service.Get(id); if (rankHierarchy == null) { return(HttpNotFound()); } return(View(rankHierarchy)); }
public virtual IEnumerable <EmployeePromotion> GetEmployeePromotionView() { IRepository <SalaryRank> salRankRepo = new RepositoryFactory().Create <SalaryRank>(); IEnumerable <SalaryRank> salaryRanks = new RepositoryFactory().Create <SalaryRank>().GetAll(); IEnumerable <RankHierarchy> rankHierarchies = new RepositoryFactory().Create <RankHierarchy>().GetAll(); IEnumerable <EmployeePromotion> resultBasic = from emp in new RepositoryFactory().Create <Employee>().GetAll() join empSal in new RepositoryFactory().Create <EmployeeSalary>().GetAll() on emp.EmployeeId equals empSal.EmployeeId join salRank in salaryRanks on empSal.SalaryRankId equals salRank.SalaryRankId select new EmployeePromotion { EmployeeId = emp.EmployeeId, EmployeeName = emp.EmployeeName, SalaryRankId = empSal.SalaryRankId, BasicSalary = salRank.RankValue, RankName = salRank.RankName }; IEnumerable <EmployeePerformance> performance = GetAllEmployeePerformance(); List <EmployeePromotion> finalResult = new List <EmployeePromotion>(); var joinedList = from res in resultBasic join perf in performance on res.EmployeeId equals perf.EmployeeId select new { EmployeeId = res.EmployeeId, EmployeeName = res.EmployeeName, SalaryRankId = res.SalaryRankId, BasicSalary = res.BasicSalary, RankName = res.RankName, AggregateScore = perf.AggregateScore }; foreach (var item in joinedList) { //Output.Write("Employee name: " + item.EmployeeName); RankHierarchy rankHierarchy = new RankHierarchy(); SalaryRank salaryRank; try { rankHierarchy = rankHierarchies.First(e => e.SalaryRankId == item.SalaryRankId); //Output.Write("Rank hierarchy found"); }catch (Exception e) { //Output.Write(e); } if (rankHierarchy.SalaryRankId == 0) { salaryRank = null; } else { salaryRank = salRankRepo.Get(rankHierarchy.NextSalaryRankId); } EmployeePromotion empPromo = new EmployeePromotion() { EmployeeId = item.EmployeeId, EmployeeName = item.EmployeeName, SalaryRankId = item.SalaryRankId, BasicSalary = item.BasicSalary, RankName = item.RankName }; if (salaryRank == null) { empPromo.promotionAvailable = false; empPromo.RecommendationStatus = 0; //Output.Write("Promotion availability: " + empPromo.promotionAvailable); } else { empPromo.promotionAvailable = true; if (item.AggregateScore > 70) { empPromo.RecommendationStatus = 1; } else if (item.AggregateScore < 30) { empPromo.RecommendationStatus = 0; } else { empPromo.RecommendationStatus = -1; } empPromo.NextSalaryRankId = salaryRank.SalaryRankId; empPromo.NextRankName = salaryRank.RankName; empPromo.NextBasicSalary = salaryRank.RankValue; //Output.Write("Promotion availability: " + empPromo.promotionAvailable); } finalResult.Add(empPromo); } return(finalResult); }