Esempio n. 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));
        }
Esempio n. 2
0
        private PromotionsRecordsViewModel GetByPromotionRecordID(int id)
        {
            PromotionsRecordsBLL       PromotionRecordBLL = new PromotionsRecordsBLL().GetByPromotionRecordID(id);
            PromotionsRecordsViewModel PromotionRecordVM  = new PromotionsRecordsViewModel();

            if (PromotionRecordBLL != null)
            {
                PromotionRecordVM.PromotionRecordID   = PromotionRecordBLL.PromotionRecordID;
                PromotionRecordVM.PromotionRecordDate = PromotionRecordBLL.PromotionRecordDate.Date;
                PromotionRecordVM.PromotionRecordNo   = PromotionRecordBLL.PromotionRecordNo;
                PromotionRecordVM.JobCategoryID       = PromotionRecordBLL.JobCategory.JobCategoryID;
                PromotionRecordVM.RankID                = PromotionRecordBLL.Rank.RankID;
                PromotionRecordVM.RankName              = PromotionRecordBLL.Rank.RankName;
                PromotionRecordVM.YearID                = PromotionRecordBLL.PromotionPeriod.Year.MaturityYearID;
                PromotionRecordVM.PromotionPeriodID     = PromotionRecordBLL.PromotionPeriod.PromotionPeriodID;
                PromotionRecordVM.PromotionPeriod       = PromotionRecordBLL.PromotionPeriod;
                PromotionRecordVM.PromotionRecordStatus = new PromotionsRecordsStatusViewModel()
                {
                    PromotionRecordStatusID   = PromotionRecordBLL.PromotionRecordStatus.PromotionRecordStatusID,
                    PromotionRecordStatusName = PromotionRecordBLL.PromotionRecordStatus.PromotionRecordStatusName
                };

                PromotionRecordVM.PromotionRecordToolbarID = GetPromotionRecordToolbarID(PromotionRecordBLL.PromotionRecordStatus.PromotionRecordStatusID);
                //PromotionRecordVM.CreatedDate = PromotionRecordBLL.CreatedDate;
                //PromotionRecordVM.CreatedBy = PromotionRecordVM.GetCreatedByDisplayed(PromotionRecordBLL.CreatedBy);
            }
            return(PromotionRecordVM);
        }
Esempio n. 3
0
        public ActionResult Create(PromotionsRecordsViewModel PromotionsRecordsVM)
        {
            Result result = new Result();
            PromotionsRecordsBLL PromotionRecord = new PromotionsRecordsBLL()
            {
                PromotionRecordDate = PromotionsRecordsVM.PromotionRecordDate,
                PromotionPeriod     = new PromotionsPeriodsBLL()
                {
                    PromotionPeriodID = PromotionsRecordsVM.PromotionPeriodID
                },
                JobCategory = new JobsCategoriesBLL()
                {
                    JobCategoryID = PromotionsRecordsVM.JobCategoryID
                },
                Rank = new RanksBLL()
                {
                    RankID = PromotionsRecordsVM.RankID
                },
                PromotionsRecordsEmployees = Session["PromotionRecordEmployees"] != null ? (List <PromotionsRecordsEmployeesBLL>)Session["PromotionRecordEmployees"] : null,
                LoginIdentity = this.UserIdentity
            };

            result = PromotionRecord.Add();
            PromotionsRecordsBLL PromotionRecordObj = (PromotionsRecordsBLL)result.Entity;

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsVM.PromotionRecordID     = PromotionRecordObj.PromotionRecordID;
                PromotionsRecordsVM.PromotionRecordNo     = PromotionRecordObj.PromotionRecordNo;
                PromotionsRecordsVM.PromotionRecordDate   = PromotionRecordObj.PromotionRecordDate;
                PromotionsRecordsVM.PromotionRecordStatus = new PromotionsRecordsStatusViewModel()
                {
                    PromotionRecordStatusName = PromotionRecordObj.PromotionRecordStatus.PromotionRecordStatusName
                };
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseThereArePormotionRecordsNotClosedInOtherRanks.ToString())
            {
                Session["PromotionRecordEmployees"] = null;
                throw new CustomException(string.Format(@Resources.Globalization.ValidationPormotionRecordsNotClosedInOtherRanksText.ToString(), PromotionRecordObj.PromotionRecordNo, PromotionRecordObj.JobCategory.JobCategoryName, PromotionRecordObj.Rank.RankName));
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseThereArePormotionRecordsNotInstalled.ToString())
            {
                Session["PromotionRecordEmployees"] = null;
                throw new CustomException(string.Format(@Resources.Globalization.ValidationPormotionRecordsNotInstalledText.ToString(), PromotionRecordObj.PromotionRecordNo, PromotionRecordObj.JobCategory.JobCategoryName));
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNoJobsVacanciesAvailable.ToString())
            {
                Session["PromotionRecordEmployees"] = null;
                throw new CustomException(@Resources.Globalization.ValidationNoJobsVacanciesAvailableText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfNoCandidatesEligible.ToString())
            {
                Session["PromotionRecordEmployees"] = null;
                throw new CustomException(@Resources.Globalization.ValidationNoCandidatesEligibleInPromotionRecordText.ToString());
            }

            return(Json(PromotionsRecordsVM));
        }
Esempio n. 4
0
        public ActionResult Preference(PromotionsRecordsViewModel PromotionsRecordsVM)
        {
            Result result           = new Result();
            PromotionsRecordsBLL pp = new PromotionsRecordsBLL()
            {
                PromotionRecordID = PromotionsRecordsVM.PromotionRecordID.Value,
                JobCategory       = new JobsCategoriesBLL()
                {
                    JobCategoryID = PromotionsRecordsVM.JobCategoryID
                },
                Rank = new RanksBLL()
                {
                    RankID = PromotionsRecordsVM.RankID
                },
                LoginIdentity = this.UserIdentity
            };

            result = pp.Preference();

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsBLL oo = (PromotionsRecordsBLL)result.Entity;
                PromotionsRecordsVM.PromotionRecordID = oo.PromotionRecordID;
                //PromotionsRecordsVM.PromotionRecordNo = oo.PromotionRecordNo;
                //PromotionsRecordsVM.PromotionRecordDate = oo.PromotionRecordDate;
                PromotionsRecordsVM.PromotionRecordStatus = new PromotionsRecordsStatusViewModel()
                {
                    PromotionRecordStatusID   = oo.PromotionRecordStatus.PromotionRecordStatusID,
                    PromotionRecordStatusName = oo.PromotionRecordStatus.PromotionRecordStatusName
                };
            }
            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());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecausePromotionRecordStatusMustBeOpen.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordStatusMustBeOpenText.ToString());
            }
            //PromotionRecordVM.PromotionRecordToolbarID = GetPromotionRecordToolbarID(PromotionRecordBLL.PromotionRecordStatus.PromotionRecordStatusID);
            return(Json(new
            {
                PromotionRecordStatus = PromotionsRecordsVM.PromotionRecordStatus,
                PromotionRecordToolbarID = GetPromotionRecordToolbarID(PromotionsRecordsVM.PromotionRecordStatus.PromotionRecordStatusID)
            },
                        JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
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));
        }
Esempio n. 6
0
        public ActionResult Create()
        {
            Session["PromotionRecordEmployees"] = null;
            RanksBLL rankBLL = new RanksBLL().GetActiveRankForPromotion();
            PromotionsRecordsViewModel PromotionRecordVM = new PromotionsRecordsViewModel()
            {
                PromotionRecordID        = 0,
                RankID                   = rankBLL != null ? rankBLL.RankID : 0,
                RankName                 = rankBLL != null ? rankBLL.RankName : string.Empty,
                PromotionRecordDate      = DateTime.Now.Date,
                PromotionRecordToolbarID = (int)HCM.Classes.Enums.PromotionsRecordsToolbarEnum.Open,
                PromotionRecordStatus    = new PromotionsRecordsStatusViewModel()
            };

            return(View(PromotionRecordVM));
        }
Esempio n. 7
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));
        }
Esempio n. 8
0
        public ActionResult Manage(int id)
        {
            PromotionsRecordsViewModel PromotionRecordVM = this.GetByPromotionRecordID(id);

            #region Adding Log
            new PromotionsRecordsLogsBLL()
            {
                PromotionRecord = new PromotionsRecordsBLL()
                {
                    PromotionRecordID = PromotionRecordVM.PromotionRecordID.HasValue ? PromotionRecordVM.PromotionRecordID.Value : 0
                },
                PromotionRecordNo         = PromotionRecordVM.PromotionRecordNo.HasValue ? PromotionRecordVM.PromotionRecordNo.Value : 0,
                PromotionRecordActionType = new PromotionsRecordsActionsTypesBLL()
                {
                    PromotionActionTypeID = (int)PromotionsRecordsActionsTypesEnum.View
                },
                ActionDescription = string.Empty,
                LoginIdentity     = this.UserIdentity,
            }.Add();
            #endregion

            ViewBag.PromotionRecordQualificationKindList = new PromotionsRecordsQualificationsKindsBLL().GetPromotionsRecordsQualificationsKinds();
            return(View(PromotionRecordVM));
        }
Esempio n. 9
0
        public ActionResult UndoInstall(PromotionsRecordsViewModel PromotionsRecordsVM)
        {
            Result result           = new Result();
            PromotionsRecordsBLL pp = new PromotionsRecordsBLL()
            {
                PromotionRecordID = PromotionsRecordsVM.PromotionRecordID.Value,
                JobCategory       = new JobsCategoriesBLL()
                {
                    JobCategoryID = PromotionsRecordsVM.JobCategoryID
                },
                Rank = new RanksBLL()
                {
                    RankID = PromotionsRecordsVM.RankID
                },
                LoginIdentity = this.UserIdentity
            };

            result = pp.UndoInstall();

            if (result.EnumMember == PromotionsRecordsValidationEnum.Done.ToString())
            {
                PromotionsRecordsBLL oo = (PromotionsRecordsBLL)result.Entity;
                PromotionsRecordsVM.PromotionRecordID = oo.PromotionRecordID;
                //PromotionsRecordsVM.PromotionRecordNo = oo.PromotionRecordNo;
                //PromotionsRecordsVM.PromotionRecordDate = oo.PromotionRecordDate;
                PromotionsRecordsVM.PromotionRecordStatus = new PromotionsRecordsStatusViewModel()
                {
                    PromotionRecordStatusID   = oo.PromotionRecordStatus.PromotionRecordStatusID,
                    PromotionRecordStatusName = oo.PromotionRecordStatus.PromotionRecordStatusName
                };
            }
            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.RejectedBecausePromotionRecordStatusMustBeInstalled.ToString())
            {
                throw new CustomException(@Resources.Globalization.ValidationPromotionRecordStatusMustBeInstalledText.ToString());
            }
            else if (result.EnumMember == PromotionsRecordsValidationEnum.RejectedBecauseOfAssignedJobCategoryIsInInstalledStatus.ToString())
            {
                PromotionsRecordsBLL ooo = (PromotionsRecordsBLL)result.Entity;
                //PromotionsRecordsVM.PromotionRecordID = ooo.PromotionRecordID;
                //PromotionsRecordsVM.PromotionRecordStatus = new PromotionsRecordsStatusViewModel()
                //{
                //    PromotionRecordStatusID = ooo.PromotionRecordStatus.PromotionRecordStatusID,
                //    PromotionRecordStatusName = ooo.PromotionRecordStatus.PromotionRecordStatusName
                //};
                throw new CustomException(string.Format(@Resources.Globalization.ValidationPromotionRecordCannotUndoInsalledBecauseAssignedJobCategoryHasInstalledStatusText.ToString(), ooo.PromotionRecordNo, ooo.JobCategory.JobCategoryName));
                //throw new CustomException(@Resources.Globalization.ValidationPromotionRecordCannotUndoInsalledBecauseAssignedJobCategoryHasInstalledStatusText.ToString());
            }

            return(Json(new
            {
                PromotionRecordStatus = PromotionsRecordsVM.PromotionRecordStatus,
                PromotionRecordToolbarID = GetPromotionRecordToolbarID(PromotionsRecordsVM.PromotionRecordStatus.PromotionRecordStatusID)
            },
                        JsonRequestBehavior.AllowGet));
        }