Пример #1
0
        public ActionResult ResetByExamResults(int PromotionRecordID)
        {
            Result result = new Result();
            PromotionsRecordsViewModel PromotionsRecordsVM = new PromotionsRecordsViewModel();

            result = new PromotionsRecordsEmployeesBLL()
            {
                LoginIdentity = this.UserIdentity
            }.ResetByExamResults(PromotionRecordID);

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsVM.PromotionRecordID = PromotionRecordID;
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecausePromotionRecordStatusMustBeOpen.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordStatusMustBeOpenText.ToString());
            }


            return(Json(new
            {
                PromotionRecordID = PromotionsRecordsVM.PromotionRecordID,
            },
                        JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        private string GetPromotionDecisionSupportValue(PromotionsRecordsEmployeesBLL p)
        {
            string value = "";

            if (p.PromotionDecision != null && p.PromotionDecision.PromotionDecisionID > 0)
            {
                switch ((PromotionsDecisionsEnum)p.PromotionDecision.PromotionDecisionID)
                {
                case PromotionsDecisionsEnum.ByTotalPoints:
                    break;

                case PromotionsDecisionsEnum.ByLastQualifications:
                    break;

                case PromotionsDecisionsEnum.ByCurrentJobSeniority:
                    value = Globals.Utilities.GetYearMonthDaysFromTotalDays(p.CurrentJobSeniorityDays, p.DaysCountInUmAlquraYear, p.DaysCountInUmAlquraMonth);
                    break;

                case PromotionsDecisionsEnum.ByLastJobSeniority:
                    value = Globals.Utilities.GetYearMonthDaysFromTotalDays(p.LastJobSeniorityDays, p.DaysCountInUmAlquraYear, p.DaysCountInUmAlquraMonth);
                    break;

                case PromotionsDecisionsEnum.ByTotalExperience:
                    value = Globals.Utilities.GetYearMonthDaysFromTotalDays(p.TotalExperience, p.DaysCountInUmAlquraYear, p.DaysCountInUmAlquraMonth);
                    break;

                case PromotionsDecisionsEnum.ByExam:
                    break;

                default:
                    break;
                }
            }
            return(value);
        }
Пример #3
0
        public JsonResult GetAllCandidatesByPromotionRecordID(int PromotionRecordID)
        {
            Session["PromotionRecordEmployees"] = null;
            List <PromotionsRecordsEmployeesBLL> PromotionsRecordsEmployees = new PromotionsRecordsEmployeesBLL().GetByPromotionRecordID(PromotionRecordID);

            return(this.GetSpecificDataFromCandidates(PromotionsRecordsEmployees));
        }
Пример #4
0
        public ActionResult UpdateExamResult(int PromotionRecordEmployeeID, decimal ExamResult)
        {
            Result result = new Result();
            PromotionsRecordsEmployeesViewModel PromotionsRecordsEmployeesVM = new PromotionsRecordsEmployeesViewModel();

            PromotionsRecordsEmployeesBLL pre = new PromotionsRecordsEmployeesBLL()
            {
                LoginIdentity = this.UserIdentity
            };

            result = pre.UpdateExamResult(PromotionRecordEmployeeID, ExamResult);

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsEmployeesBLL oo = (PromotionsRecordsEmployeesBLL)result.Entity;
                PromotionsRecordsEmployeesVM.PromotionRecordEmployeeID = oo.PromotionRecordEmployeeID;
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecausePromotionRecordStatusMustBePreferenced.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordStatusMustBePreferencedOrInstalledText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecausePromotionDecisionMustBeShouldBePromotedByExam.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionDecisionMustBeShouldBePromotedByExamText.ToString());
            }

            return(Json(new
            {
                PromotionRecordEmployeeID = PromotionsRecordsEmployeesVM.PromotionRecordEmployeeID,
            },
                        JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public JsonResult GetPromotionRecordEmployeeByPromotionRecordEmployeeID(int PromotionRecordEmployeeID)
        {
            PromotionsRecordsEmployeesBLL PromotionRecordEmployee = new PromotionsRecordsEmployeesBLL().GetByPromotionRecordEmployeeID(PromotionRecordEmployeeID);

            return(Json(new
            {
                data = PromotionRecordEmployee
            }, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public JsonResult CheckIsDeserveExtraBonusNotSpecifiedValueForCandidatesAlreadyPromoted(int PromotionRecordID)
        {
            List <PromotionsRecordsEmployeesBLL> PromotionsRecordsEmployeesBLLList = new PromotionsRecordsEmployeesBLL().CheckIsDeserveExtraBonusNotSpecifiedValueForCandidatesAlreadyPromoted(PromotionRecordID);

            if (PromotionsRecordsEmployeesBLLList.Count > 0)
            {
                foreach (var PromotionRecordEmployee in PromotionsRecordsEmployeesBLLList)
                {
                    throw new CustomException(Resources.Globalization.ValidationOfIsDeserveExtraBonusNotSpecifiedValueText + "NewLine" + PromotionRecordEmployee.CurrentEmployeeCareer.EmployeeCode.EmployeeCodeNo + ": " + PromotionRecordEmployee.CurrentEmployeeCareer.EmployeeCode.Employee.EmployeeNameAr);
                }
            }
            return(Json(HttpStatusCode.OK, JsonRequestBehavior.AllowGet));
        }
Пример #7
0
        public ActionResult RemoveByPromotionRecordEmployeeID(PromotionsRecordsEmployeesViewModel PromotionRecordEmployeeVM)
        {
            PromotionsRecordsViewModel PromotionsRecordsVM = new PromotionsRecordsViewModel();
            Result result = new Result();
            PromotionsRecordsEmployeesBLL emp = new PromotionsRecordsEmployeesBLL()
            {
                PromotionRecordEmployeeID = PromotionRecordEmployeeVM.PromotionRecordEmployeeID,
                RemovingReason            = PromotionRecordEmployeeVM.RemovingReason,
                RemovingBy    = this.UserIdentity,
                LoginIdentity = this.UserIdentity
            };

            result = emp.RemoveAndRedistributeJobs();

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsEmployeesBLL oo = (PromotionsRecordsEmployeesBLL)result.Entity;
                PromotionsRecordsVM.PromotionRecordID = oo.PromotionRecord.PromotionRecordID;
                //PromotionsRecordsVM.PromotionRecordNo = oo.PromotionRecordNo;
                //PromotionsRecordsVM.PromotionRecordDate = oo.PromotionRecordDate;
                PromotionsRecordsVM.PromotionRecordStatus = new PromotionsRecordsStatusViewModel()
                {
                    PromotionRecordStatusID   = oo.PromotionRecord.PromotionRecordStatus.PromotionRecordStatusID,
                    PromotionRecordStatusName = oo.PromotionRecord.PromotionRecordStatus.PromotionRecordStatusName
                };
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecausePromotionRecordStatusMustBeOpenOrPreferenced.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordStatusMustBeOpenOrPreferencedText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNoJobsVacanciesAvailable.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationNoJobsVacanciesAvailableText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNoCandidatesEligible.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationNoCandidatesEligibleInPromotionRecordText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfSomeQualifitionPointsAreNull.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationSomeQualifitionPointsAreNullInPromotionRecordText.ToString());
            }

            return(Json(new
            {
                PromotionRecordStatus = PromotionsRecordsVM.PromotionRecordStatus,
                PromotionRecordToolbarID = GetPromotionRecordToolbarID(PromotionsRecordsVM.PromotionRecordStatus.PromotionRecordStatusID)
            },
                        JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public JsonResult GetCandidatesByExamByPromotionRecordID(int PromotionRecordID)
        {
            List <PromotionsRecordsEmployeesBLL> PromotionsRecordsEmployeesList = new PromotionsRecordsEmployeesBLL().GetCandidatesByExamByPromotionRecordID(PromotionRecordID);

            var data = PromotionsRecordsEmployeesList.Select(x => new
            {
                PromotionRecordEmployeeID = x.PromotionRecordEmployeeID,
                EmployeeCodeNo            = x.CurrentEmployeeCareer.EmployeeCode.EmployeeCodeNo,
                EmployeeNameAr            = x.CurrentEmployeeCareer.EmployeeCode.Employee.EmployeeNameAr,
                ByExamResult = x.ByExamResult.HasValue ? x.ByExamResult.Value : 0
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Пример #9
0
        public ActionResult AddActualTaskPerformancePointsByPromotionRecordEmployeeID(int id)
        {
            PromotionsRecordsViewModel PromotionsRecordsVM = new PromotionsRecordsViewModel();
            Result result = new Result();
            PromotionsRecordsEmployeesBLL emp = new PromotionsRecordsEmployeesBLL()
            {
                PromotionRecordEmployeeID   = id,
                ActualTaskPerformancePoints = Convert.ToDecimal(ConfigurationManager.AppSettings["ActualTaskPerformancePoints"]),
                LoginIdentity = this.UserIdentity
            };

            result = emp.UpdateActualTaskPerformancePoints();

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsEmployeesBLL oo = (PromotionsRecordsEmployeesBLL)result.Entity;
                PromotionsRecordsVM.PromotionRecordID     = oo.PromotionRecord.PromotionRecordID;
                PromotionsRecordsVM.PromotionRecordStatus = new PromotionsRecordsStatusViewModel()
                {
                    PromotionRecordStatusID   = oo.PromotionRecord.PromotionRecordStatus.PromotionRecordStatusID,
                    PromotionRecordStatusName = oo.PromotionRecord.PromotionRecordStatus.PromotionRecordStatusName
                };
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecausePromotionRecordStatusMustBeOpenOrPreferenced.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordStatusMustBeOpenOrPreferencedText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNoJobsVacanciesAvailable.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationNoJobsVacanciesAvailableText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNoCandidatesEligible.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationNoCandidatesEligibleInPromotionRecordText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfSomeQualifitionPointsAreNull.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationSomeQualifitionPointsAreNullInPromotionRecordText.ToString());
            }

            return(Json(new
            {
                PromotionRecordStatus = PromotionsRecordsVM.PromotionRecordStatus,
                PromotionRecordToolbarID = GetPromotionRecordToolbarID(PromotionsRecordsVM.PromotionRecordStatus.PromotionRecordStatusID)
            },
                        JsonRequestBehavior.AllowGet));
        }
Пример #10
0
        public JsonResult GetCandidatesForRedistributeJobsByPromotionRecordID(int PromotionRecordID)
        {
            List <PromotionsRecordsEmployeesBLL> PromotionsRecordsEmployeesList = new PromotionsRecordsEmployeesBLL().GetCandidatesForRedistributeJobsByPromotionRecordID(PromotionRecordID);

            var data = PromotionsRecordsEmployeesList.Select(x => new
            {
                PromotionRecordEmployeeID   = x.PromotionRecordEmployeeID,
                EmployeeCodeNo              = x.CurrentEmployeeCareer.EmployeeCode.EmployeeCodeNo,
                EmployeeNameAr              = x.CurrentEmployeeCareer.EmployeeCode.Employee.EmployeeNameAr,
                PromotionRecordJobVacancyID = x.PromotionRecordJobVacancy.PromotionRecordJobVacancyID,
                JobCode          = x.PromotionRecordJobVacancy.JobVacancy.Job.JobCode,
                JobName          = x.PromotionRecordJobVacancy.JobVacancy.Job.JobName,
                JobNo            = x.PromotionRecordJobVacancy.JobVacancy.JobNo,
                RankName         = x.PromotionRecordJobVacancy.JobVacancy.Rank.RankName,
                OrganizationName = x.PromotionRecordJobVacancy.JobVacancy.OrganizationStructure.OrganizationName,
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Пример #11
0
        public JsonResult GetCandidatesAlreadyPromotedByPromotionRecordID(int PromotionRecordID)
        {
            List <PromotionsRecordsEmployeesBLL> PromotionsRecordsEmployeesList = new PromotionsRecordsEmployeesBLL().GetCandidatesAlreadyPromoted(PromotionRecordID);

            var data = PromotionsRecordsEmployeesList.Select(x => new
            {
                PromotionRecordEmployeeID = x.PromotionRecordEmployeeID,
                EmployeeCodeNo            = x.CurrentEmployeeCareer.EmployeeCode.EmployeeCodeNo,
                EmployeeNameAr            = x.CurrentEmployeeCareer.EmployeeCode.Employee.EmployeeNameAr,
                JobName             = x.NewEmployeeCareer.OrganizationJob.Job.JobName,
                JobCode             = x.NewEmployeeCareer.OrganizationJob.Job.JobCode,
                OrganizationName    = x.NewEmployeeCareer.OrganizationJob.OrganizationStructure.OrganizationName,
                RankName            = x.NewEmployeeCareer.OrganizationJob.Rank.RankName,
                IsApproved          = x.IsApproved,
                IsDeserveExtraBonus = x.IsDeserveExtraBonus,
                AbsentDays          = x.AbsentDays
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Пример #12
0
        public ActionResult PromotionRecordEmployeeApproval(string PromotionRecordEmployeeID, string ApprovalType)
        {
            PromotionsRecordsEmployeesBLL PromotionRecordEmployee = new PromotionsRecordsEmployeesBLL()
            {
                PromotionRecordEmployeeID = int.Parse(PromotionRecordEmployeeID),
                LoginIdentity             = this.UserIdentity
            };
            Result result = new Result();

            if (ApprovalType == "Approve")
            {
                result = PromotionRecordEmployee.Approve();
            }
            else
            {
                result = PromotionRecordEmployee.ApproveCancel();
            }

            return(View());
            //return Json(new { data = PromotionRecordEmployee.IsApproved }, JsonRequestBehavior.AllowGet);
        }
Пример #13
0
        public JsonResult UpdatePromotionRecordEmployeeIsDeserveExtraBonus(PromotionsRecordsEmployeesViewModel PromotionRecordEmployeeVM)
        {
            Result result = null;

            PromotionsRecordsEmployeesBLL PromotionRecordEmployeeBLL = new PromotionsRecordsEmployeesBLL().GetByPromotionRecordEmployeeID(PromotionRecordEmployeeVM.PromotionRecordEmployeeID);

            PromotionRecordEmployeeBLL.IsDeserveExtraBonus = PromotionRecordEmployeeVM.IsDeserveExtraBonus;
            PromotionRecordEmployeeBLL.LoginIdentity       = this.UserIdentity;

            result = PromotionRecordEmployeeBLL.UpdateDeserveExtraBonus();

            if (result.EnumMember == CareersHistoryValidationEnum.RejectedBecauseOfCareerDegreeOutOfRange.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationOfCareerDegreeOutOfRangeText);
            }

            if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.Done.ToString())
            {
                return(Json(HttpStatusCode.OK, JsonRequestBehavior.AllowGet));
            }
            if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfIsDeserveExtraBonusNotSpecifiedValue.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationOfIsDeserveExtraBonusNotSpecifiedValueText);
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfIsDeserveExtraBonusUpdateWithSameValue.ToString())
            {
                // throw new CustomException(Resources.Globalization.ValidationOfIsDeserveExtraBonusUpdateWithSameValueText);
                return(Json(HttpStatusCode.OK, JsonRequestBehavior.AllowGet));
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfApproved.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationOfApprovedText);
            }
            else
            {
                return(Json(HttpStatusCode.ExpectationFailed, JsonRequestBehavior.AllowGet));
                //return Json(new { result }, JsonRequestBehavior.AllowGet);
            }
        }
Пример #14
0
        public ActionResult ShuffleJob(int PromotionRecordEmployeeID, string NewEmployeeCodeNo)
        {
            Result result = new Result();
            PromotionsRecordsEmployeesViewModel PromotionsRecordsEmployeesVM = new PromotionsRecordsEmployeesViewModel();

            PromotionsRecordsEmployeesBLL pre = new PromotionsRecordsEmployeesBLL()
            {
                LoginIdentity = this.UserIdentity
            };

            result = pre.ShuffleJob(PromotionRecordEmployeeID, NewEmployeeCodeNo);

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsEmployeesBLL oo = (PromotionsRecordsEmployeesBLL)result.Entity;
                PromotionsRecordsEmployeesVM.PromotionRecordEmployeeID = oo.PromotionRecordEmployeeID;
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecausePromotionRecordStatusMustBePreferencedOrInstalled.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordStatusMustBePreferencedOrInstalledText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNewEmployeeCodeNoNotExitsInPromotionRecordEmployeesOrNotPromoted.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationNewEmployeeCodeNoNotExitsInPromotionRecordEmployeesOrNotPromotedText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfOneOfEmployeeInRedistributeJobIsApproved.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordOneOfEmployeeInRedistributeJobIsApprovedText.ToString());
            }


            return(Json(new
            {
                PromotionRecordEmployeeID = PromotionsRecordsEmployeesVM.PromotionRecordEmployeeID,
            },
                        JsonRequestBehavior.AllowGet));
        }
Пример #15
0
        public Result Update()
        {
            try
            {
                Result result = new Result();

                #region Validation to check if EmployeeCareerHistory Exist in PromotionsRecordsEmployees as NewEmployeeCareerHistory or CurrentEmployeeCareerHistory
                //check if OrganizationJob Exist in PromotionsRecordsJobsVacancies as PromotionRecordJobVacancyID
                // Then Can't update OrganizationID,RankID,JobID
                List <PromotionsRecordsEmployeesBLL> PromotionsRecordsEmployeesList = new PromotionsRecordsEmployeesBLL().GetByEmployeeCareerHistoryID(this.EmployeeCareerHistoryID);
                if (PromotionsRecordsEmployeesList.Count != 0)
                {
                    result.EnumType   = typeof(CareersHistoryValidationEnum);
                    result.EnumMember = CareersHistoryValidationEnum.RejectedBecauseOfExistsInPromotionsRecordsEmployees.ToString();
                    return(result);
                }
                #endregion

                #region Check about is hiring exists before or not
                if (this.CareerHistoryType.CareerHistoryTypeID.Equals((int)CareersHistoryTypesEnum.Hiring))
                {
                    EmployeesCareersHistoryBLL Hr = this.GetHiringRecordByEmployeeCodeID(this.EmployeeCode.EmployeeCodeID);
                    if (Hr != null)
                    {
                        if (Hr.EmployeeCareerHistoryID != this.EmployeeCareerHistoryID)
                        {
                            result.Entity     = Hr;
                            result.EnumType   = typeof(CareersHistoryValidationEnum);
                            result.EnumMember = CareersHistoryValidationEnum.RejectedBecauseOfAlreadyHiringBefore.ToString();
                            return(result);
                        }
                    }
                }
                #endregion

                #region TASK 260 : check new employee career history record date must be less than 'Join Date' of hiring record
                if (this.CareerHistoryType.CareerHistoryTypeID != (int)CareersHistoryTypesEnum.Hiring)
                {
                    EmployeesCareersHistoryBLL oo = this.GetHiringRecordByEmployeeCodeID(this.EmployeeCode.EmployeeCodeID);
                    if (oo != null && oo.JoinDate.Date >= this.JoinDate.Date)
                    {
                        result.Entity     = oo;
                        result.EnumType   = typeof(CareersHistoryValidationEnum);
                        result.EnumMember = CareersHistoryValidationEnum.RejectedBecauseOfJoinDateMustBeLessThanHiringRecordJoinDate.ToString();
                        return(result);
                    }
                }
                #endregion

                #region if the record is hiring ... Check about there is vacation transactions before new hiring date or not
                if (this.CareerHistoryType.CareerHistoryTypeID.Equals((int)CareersHistoryTypesEnum.Hiring))
                {
                    bool IsVacationExists = new BaseVacationsBLL().IsEmployeeVacationExistsBeforeDate(this.EmployeeCode.EmployeeCodeID, this.JoinDate.Date);
                    if (IsVacationExists)
                    {
                        //result.Entity = Hr;
                        result.EnumType   = typeof(CareersHistoryValidationEnum);
                        result.EnumMember = CareersHistoryValidationEnum.RejectedHiringDateUpdatingBecauseOfAlreadyActionsBefore.ToString();
                        return(result);
                    }
                }
                #endregion

                #region Update record
                EmployeesCareersHistory EmployeeCareerHistory = new EmployeesCareersHistory()
                {
                    EmployeeCareerHistoryID = this.EmployeeCareerHistoryID,
                    CareerHistoryTypeID     = this.CareerHistoryType.CareerHistoryTypeID,
                    CareerDegreeID          = this.CareerDegree.CareerDegreeID,
                    OrganizationJobID       = this.OrganizationJob.OrganizationJobID,
                    JoinDate             = this.JoinDate.Date,
                    TransactionStartDate = this.JoinDate.Date,
                    LastUpdatedBy        = this.LoginIdentity != null ? this.LoginIdentity.EmployeeCodeID : (int?)null,
                    LastUpdatedDate      = DateTime.Now,
                    IsActive             = this.IsActive,
                };
                new EmployeesCareersHistoryDAL().Update(EmployeeCareerHistory);
                #endregion

                #region Change current job
                ChangeCurrentJobByEmployeeCodeID(this.EmployeeCode.EmployeeCodeID);
                #endregion

                result.Entity     = this;
                result.EnumType   = typeof(CareersHistoryValidationEnum);
                result.EnumMember = CareersHistoryValidationEnum.Done.ToString();
                return(result);
            }
            catch
            {
                throw;
            }
        }
Пример #16
0
        public JsonResult GetPromotionsRecordsEmployeesByPromotionRecordID(int id)
        {
            //int i = 1;
            bool IsIncluded = true;
            var  list       = new PromotionsRecordsEmployeesBLL()
            {
                Search   = Search,
                Order    = Order,
                OrderDir = OrderDir,
                StartRec = StartRec,
                PageSize = PageSize
            }.GetByPromotionRecordID(id, IsIncluded, out TotalRecordsOut, out RecFilterOut).Select(p => new
            {
                //CandidateSerialNo = i++,
                p.PromotionRecordEmployeeID,
                EmployeeCareerHistoryID = p.CurrentEmployeeCareer.EmployeeCareerHistoryID,
                EmployeeCodeID          = p.CurrentEmployeeCareer.EmployeeCode.EmployeeCodeID,
                EmployeeCodeNo          = p.CurrentEmployeeCareer.EmployeeCode.EmployeeCodeNo,
                //EmployeeIDNo = p.CurrentEmployeeCareer.EmployeeCode.Employee.EmployeeIDNo,
                EmployeeNameAr  = p.CurrentEmployeeCareer.EmployeeCode.Employee.EmployeeNameAr,
                RankName        = p.CurrentEmployeeCareer.OrganizationJob.Rank.RankName,
                JobCategoryName = p.CurrentEmployeeCareer.OrganizationJob.Job.JobCategory.JobCategoryName,
                JobNo           = p.CurrentEmployeeCareer.OrganizationJob.JobNo,
                JobCode         = p.CurrentEmployeeCareer.OrganizationJob.Job.JobCode,
                JobName         = p.CurrentEmployeeCareer.OrganizationJob.Job.JobName,
                //JobStatus = p.CurrentEmployeeCareer.OrganizationJob.IsActive,     // ??????????
                OrganizationName  = p.CurrentEmployeeCareer.OrganizationJob.OrganizationStructure.OrganizationNameWithBranch,
                JoinDate          = p.CurrentEmployeeCareer.JoinDate,//.ToString(System.Configuration.ConfigurationManager.AppSettings["DateFormat"].ToString()),
                AddedWayID        = p.PromotionCandidateAddedWay.PromotionCandidateAddedWayID,
                AddedWayName      = p.PromotionCandidateAddedWay.PromotionCandidateAddedWayName,
                ManualAddedReason = p.ManualAddedReason,
                CreatedBy         = p.CreatedBy.Employee != null ? p.CreatedBy.Employee.EmployeeNameAr : "",
                CreatedDate       = p.CreatedDate,

                LastQualificationDegreeName   = p.LastQualificationDegree != null ? p.LastQualificationDegree.QualificationDegreeName : "",
                LastQualificationName         = p.LastQualification != null ? p.LastQualification.QualificationName : "",
                LastGeneralSpecializationName = p.LastGeneralSpecialization != null ? p.LastGeneralSpecialization.GeneralSpecializationName : "",

                NewRankName         = p.PromotionRecordJobVacancy != null ? p.PromotionRecordJobVacancy.JobVacancy.Rank.RankName : "",
                NewJobCategoryName  = p.PromotionRecordJobVacancy != null ? p.PromotionRecordJobVacancy.JobVacancy.Job.JobCategory.JobCategoryName : "",
                NewJobNo            = p.PromotionRecordJobVacancy != null ? p.PromotionRecordJobVacancy.JobVacancy.JobNo : "",
                NewJobCode          = p.PromotionRecordJobVacancy != null ? p.PromotionRecordJobVacancy.JobVacancy.Job.JobCode : "",
                NewJobName          = p.PromotionRecordJobVacancy != null ? p.PromotionRecordJobVacancy.JobVacancy.Job.JobName : "",
                NewOrganizationName = p.PromotionRecordJobVacancy != null ? p.PromotionRecordJobVacancy.JobVacancy.OrganizationStructure.OrganizationNameWithBranch : "",

                IsRemovedAfterIncluding = p.IsRemovedAfterIncluding,

                TotalEducationPoints        = p.EducationPoints,
                TotalSeniorityPoints        = p.SeniorityPoints,
                TotalEvaluationPoints       = p.EvaluationPoints,
                ActualTaskPerformancePoints = p.ActualTaskPerformancePoints,
                TotalPoints             = p.TotalPoints,
                PromotionDecisionName   = p.PromotionDecision != null ? p.PromotionDecision.PromotionDecisionName : "",
                LastQualificationWeight = p.LastQualificationDegree != null ? p.LastQualificationDegree.Weight : 0,

                PromotionDecisionSupportTitle = GetPromotionDecisionSupportTitle(p.PromotionDecision),
                PromotionDecisionSupportValue = GetPromotionDecisionSupportValue(p),

                PromotionRecordStatusEnum = p.PromotionRecord.PromotionRecordStatusEnum,

                RemovingReason = p.RemovingReason,
                RemovedByName  = p.RemovingBy != null ? p.RemovingBy.Employee.EmployeeNameAr : "",

                PromotionRecordJobVacancyID = p.PromotionRecordJobVacancy != null ? p.PromotionRecordJobVacancy.PromotionRecordJobVacancyID : 0,
                PromotionPeriodID           = p.PromotionRecord.PromotionPeriod.PromotionPeriodID,

                IsByExamResult = p.ByExamResult.HasValue ? 1 : 0,
                ByExamResult   = p.ByExamResult.HasValue ? p.ByExamResult.Value : 0
            });

            return(Json(new { draw = Convert.ToInt32(Draw), recordsTotal = TotalRecordsOut, recordsFiltered = RecFilterOut, data = list }, JsonRequestBehavior.AllowGet));
        }
Пример #17
0
        public JsonResult AddCandidateManually(int EmployeeCodeID, int PromotionRecordID, string ManualAddedReason)
        {
            Result result = new Result();

            result = new PromotionsRecordsEmployeesBLL()
            {
                CurrentEmployeeCareer = new EmployeesCareersHistoryBLL()
                {
                    EmployeeCode = new EmployeesCodesBLL()
                    {
                        EmployeeCodeID = EmployeeCodeID
                    }
                },
                ManualAddedReason = ManualAddedReason,
                LoginIdentity     = this.UserIdentity,
                PromotionRecord   = new PromotionsRecordsBLL()
                {
                    PromotionRecordID = PromotionRecordID,
                }
            }.AddCandidateManually();
            if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNoPromotionRecordSelectedToDelete.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationNoPromotionRecordSelectedToDeleteText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfCandidateAndReasonAreRequiredToAdding.ToString())
            {
                throw new CustomException(Resources.Globalization.RequiredEmployeeAndReasonToAddingText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfCandidateRankNotDeserveToPromote.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationCandidateRankNotDeserveToPromoteText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfLastCandidateEvaluationWeak.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationLastCandidateEvaluationWeakText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfPromotionIsNotOpen.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationCandidateCanNotBeAddedPromotionIsNotOpenText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfCandidateHiringRecordNotExists.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEmployeeHiringRecordNotExistsText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfCandidateJobPeriodNotCompleted.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationCandidateJobPeriodNotCompletedText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfCandidateAlreadyInPromotionRecordNotInstalled.ToString())
            {
                throw new CustomException(string.Format(Resources.Globalization.ValidationCandidateAlreadyInPromotionRecordNotInstalledText.ToString(), ((PromotionsRecordsEmployeesBLL)result.Entity).PromotionRecord.PromotionRecordNo));
            }
            else if (result.EnumMember == PromotionsRecordsEmployeesValidationEnum.RejectedBecauseOfCandidateAlreadyReservedJobVacancy.ToString())
            {
                PromotionsRecordsEmployeesBLL pp = ((PromotionsRecordsEmployeesBLL)result.Entity);
                throw new CustomException(string.Format(Resources.Globalization.ValidationCandidateAlreadyAlreadyReservedJobVacancyText.ToString(), pp.PromotionRecord.PromotionRecordNo, pp.PromotionRecordJobVacancy.JobVacancy.JobNo, pp.PromotionRecordJobVacancy.JobVacancy.Job.JobName));
            }
            else
            {
                Session["PromotionRecordEmployees"] = null;
                return(this.GetAllCandidatesByPromotionRecordID(PromotionRecordID));
            }
            //return Json(new { data = PromotionRecordID }, JsonRequestBehavior.AllowGet);
        }