public ActionResult Manage(int id) { EmployeesEvaluationsViewModel VM = this.GetByEmployeeCodeID(id); SetAuthentications(VM); return(View(VM)); }
private void SetAuthentications(EmployeesEvaluationsViewModel VM) { AuthenticationResult Authentication = (AuthenticationResult)Session["Authentication"]; if (Authentication != null && Authentication.User != null && Authentication.User.IsAdmin) { VM.HasCreatingAccess = VM.HasDeletingAccess = VM.HasUpdatingAccess = true; } else { GroupsObjects Privilage = Authentication.Privilages.FirstOrDefault(e => e.Object.ObjectID == (int)ObjectsEnum.EmployeesEvaluationsManage); if (Privilage != null) { VM.HasCreatingAccess = Privilage.Creating; VM.HasDeletingAccess = Privilage.Deleting; VM.HasUpdatingAccess = Privilage.Updating; } else { VM.HasCreatingAccess = VM.HasDeletingAccess = VM.HasUpdatingAccess = false; } } }
public JsonResult CreateEmpEvaluationDetails(EmployeesEvaluationsViewModel EmployeeEvaluationVM) { EmployeesEvaluationsDetailsBLL EmployeesEvaluationsDetails = new EmployeesEvaluationsDetailsBLL(); EmployeesEvaluationsDetails.DirectManagerEvaluation = EmployeeEvaluationVM.DirectManagerEvaluation; EmployeesEvaluationsDetails.TimeAttendanceEvaluation = EmployeeEvaluationVM.TimeAttendanceEvaluation; EmployeesEvaluationsDetails.ViolationsEvaluation = EmployeeEvaluationVM.ViolationsEvaluation; EmployeesEvaluationsDetails.EvaluationQuarter = new EvaluationsQuartersBLL() { EvaluationQuarterID = EmployeeEvaluationVM.EvaluationQuarterID }; EmployeesEvaluationsDetails.EmployeeEvaluation = new EmployeesEvaluationsBLL() { EmployeeEvaluationID = EmployeeEvaluationVM.EmployeeEvaluationID, MaturityYearsBalances = new MaturityYearsBalancesBLL() { MaturityYearID = EmployeeEvaluationVM.MaturityYearID } }; EmployeesEvaluationsDetails.LoginIdentity = UserIdentity; Result result = EmployeesEvaluationsDetails.Add(); if (result.EnumMember == EmployeesEvaluationsValidationEnum.Done.ToString()) { } else if (result.EnumMember == EmployeesEvaluationsValidationEnum.RejectedBecauseOfDirectManagerEvaluationIsNotBetweenZeroAndFifty.ToString()) { throw new CustomException(Resources.Globalization.ValidationDirectManagerEvaluationShouldBeBetweenZeroAndFiftyText); } else if (result.EnumMember == EmployeesEvaluationsValidationEnum.RejectedBecauseOfTimeAttendanceEvaluationIsNotBetweenZeroAndThirtyFive.ToString()) { throw new CustomException(Resources.Globalization.ValidationTimeAttendanceEvaluationShouldBeBetweenZeroAndThirtyFiveText); } else if (result.EnumMember == EmployeesEvaluationsValidationEnum.RejectedBecauseOfViolationsEvaluationIsNotBetweenZeroAndFifteen.ToString()) { throw new CustomException(Resources.Globalization.ValidationViolationsEvaluationShouldBeBetweenZeroAndFifteenText); } else if (result.EnumMember == EmployeesEvaluationsValidationEnum.RejectedBecauseOfEvaluationQuarterAlreadyExistsInCurrentYear.ToString()) { throw new CustomException(Resources.Globalization.ValidationEvaluationQuarterAlreadyExistsInCurrentYearText); } return(Json(new { data = EmployeesEvaluationsDetails.EmployeeEvaluationDetailID }, JsonRequestBehavior.AllowGet)); }
private EmployeesEvaluationsViewModel GetByEmployeeCodeID(int id) { EmployeesCodesBLL EmployeesCodesBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(id); EmployeesEvaluationsViewModel EmployeeEvaluationVM = new EmployeesEvaluationsViewModel(); EmployeeEvaluationVM.EmployeeVM = new EmployeesViewModel() { EmployeeCodeID = EmployeesCodesBLL.EmployeeCodeID, EmployeeCodeNo = EmployeesCodesBLL.EmployeeCodeNo, EmployeeNameAr = EmployeesCodesBLL.Employee.EmployeeNameAr, EmployeeJobName = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.Job.JobName : null, EmployeeRankName = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.Rank.RankName : null, EmployeeOrganizationName = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationName : null, HiringDate = EmployeesCodesBLL.HiringRecord != null ? EmployeesCodesBLL.HiringRecord.JoinDate : (DateTime?)null, EmployeeIDNo = EmployeesCodesBLL.Employee.EmployeeIDNo, EmployeeJobNo = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.JobNo : null }; return(EmployeeEvaluationVM); }
public JsonResult Create(EmployeesEvaluationsViewModel EmployeeEvaluationVM) { EmployeesEvaluationsBLL EmployeeEvaluation = new EmployeesEvaluationsBLL(); EmployeeEvaluation.MaturityYearsBalances = new MaturityYearsBalancesBLL() { MaturityYearID = EmployeeEvaluationVM.MaturityYearID }; EmployeeEvaluation.EvaluationPoints = new EvaluationPointsBLL() { EvaluationPointID = EmployeeEvaluationVM.EvaluationPointID }; EmployeeEvaluation.EvaluationDegree = EmployeeEvaluationVM.EvaluationDegree; EmployeeEvaluation.EmployeeCode = new EmployeesCodesBLL() { EmployeeCodeID = EmployeeEvaluationVM.EmployeeVM.EmployeeCodeID.Value }; EmployeeEvaluation.LoginIdentity = UserIdentity; Result result = EmployeeEvaluation.Add(); return(Json(new { data = EmployeeEvaluation.EmployeeEvaluationID }, JsonRequestBehavior.AllowGet)); }