示例#1
0
        public ActionResult EditEmployeeTransfer(TransfersViewModel EmployeesTransferVM)
        {
            BaseTransfersBLL TransferEmployee = new BaseTransfersBLL();

            if (EmployeesTransferVM.TransfersTypes.TransferTypeID == Convert.ToInt16(TransfersTypesEnum.TransferEmployeeWithJob))
            {
                TransferEmployee = GenericFactoryPattern <BaseTransfersBLL, TransferEmployeesWithJobBLL> .CreateInstance();
            }
            else if (EmployeesTransferVM.TransfersTypes.TransferTypeID == Convert.ToInt16(TransfersTypesEnum.TransferEmployeeWithoutJob))
            {
                TransferEmployee = GenericFactoryPattern <BaseTransfersBLL, TransferEmployeesWithoutJobBLL> .CreateInstance();

                ((TransferEmployeesWithoutJobBLL)TransferEmployee).JobName          = EmployeesTransferVM.JobName;
                ((TransferEmployeesWithoutJobBLL)TransferEmployee).RankName         = EmployeesTransferVM.RankName;
                ((TransferEmployeesWithoutJobBLL)TransferEmployee).JobCode          = EmployeesTransferVM.JobCode;
                ((TransferEmployeesWithoutJobBLL)TransferEmployee).CareerDegreeName = EmployeesTransferVM.CareerDegreeName;
                ((TransferEmployeesWithoutJobBLL)TransferEmployee).OrganizationName = EmployeesTransferVM.OrganizationName;
            }

            TransferEmployee.TransferID    = EmployeesTransferVM.TransferID;
            TransferEmployee.LoginIdentity = this.UserIdentity;
            TransferEmployee.TransferType  = new TransfersTypesBLL()
            {
                TransferTypeID = EmployeesTransferVM.TransfersTypes.TransferTypeID
            };
            TransferEmployee.Destination = EmployeesTransferVM.Destination;
            TransferEmployee.KSACity     = new KSACitiesBLL()
            {
                KSACityID = EmployeesTransferVM.KSACity.KSACityID
            };
            TransferEmployee.TransferDate          = EmployeesTransferVM.TransferDate;
            TransferEmployee.EmployeeCareerHistory = new EmployeesCareersHistoryBLL()
            {
                EmployeeCareerHistoryID = EmployeesTransferVM.EmployeeCareerHistoryID
            };

            Result result = TransferEmployee.Update();

            if (result.EnumMember == TransfersValidationEnum.Done.ToString())
            {
                Session["TransferID"] = TransferEmployee.TransferID;
            }

            else if (result.EnumMember == TransfersValidationEnum.RejectedBecauseOfTransferDateIsLessThanHiringDateDate.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfTransferDateIsLessThanHiringDateText);
            }

            else if (result.EnumMember == TransfersValidationEnum.RejectedBecauseOfAlreadyProcessed.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfBecauseOfAlreadyProcessedText);
            }

            return(View(this.GetByTransferID(EmployeesTransferVM.TransferID)));
        }
示例#2
0
        private TransfersViewModel GetByTransferID(int id)
        {
            BaseTransfersBLL   EmployeeTransferBLL = new BaseTransfersBLL().GetByTransferID(id);
            TransfersViewModel EmployeeTransferVM  = new TransfersViewModel();

            if (EmployeeTransferBLL != null)
            {
                switch (EmployeeTransferBLL.TransferType.TransferTypeID)
                {
                case (int)TransfersTypesEnum.TransferEmployeeWithJob:
                {
                    break;
                }

                case (int)TransfersTypesEnum.TransferEmployeeWithoutJob:
                {
                    EmployeeTransferVM.JobCode          = ((TransferEmployeesWithoutJobBLL)EmployeeTransferBLL).JobCode;
                    EmployeeTransferVM.CareerDegreeName = ((TransferEmployeesWithoutJobBLL)EmployeeTransferBLL).CareerDegreeName;
                    EmployeeTransferVM.JobName          = ((TransferEmployeesWithoutJobBLL)EmployeeTransferBLL).JobName;
                    EmployeeTransferVM.OrganizationName = ((TransferEmployeesWithoutJobBLL)EmployeeTransferBLL).OrganizationName;
                    EmployeeTransferVM.RankName         = ((TransferEmployeesWithoutJobBLL)EmployeeTransferBLL).RankName;
                    break;
                }

                default:
                    break;
                }

                EmployeeTransferVM.TransfersTypes          = EmployeeTransferBLL.TransferType;
                EmployeeTransferVM.TransferID              = EmployeeTransferBLL.TransferID;
                EmployeeTransferVM.TransferDate            = EmployeeTransferBLL.TransferDate.Date;
                EmployeeTransferVM.EmployeeCodeID          = EmployeeTransferBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID;
                EmployeeTransferVM.EmployeeCareerHistoryID = EmployeeTransferBLL.EmployeeCareerHistory.EmployeeCareerHistoryID;
                EmployeeTransferVM.KSACity = new KSACitiesBLL()
                {
                    KSACityID   = EmployeeTransferBLL.KSACity.KSACityID,
                    KSACityName = EmployeeTransferBLL.KSACity.KSACityName
                };
                EmployeeTransferVM.Destination = EmployeeTransferBLL.Destination;
                //EmployeeTransferVM.EmployeesCareersHistory = EmployeeTransferBLL.EmployeeCareerHistory;
                EmployeeTransferVM.Employee = new EmployeesViewModel()
                {
                    EmployeeCodeID = EmployeeTransferBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID,
                    //EmployeeCodeNo = EmployeeTransferBLL.EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
                    //EmployeeNameAr = EmployeeTransferBLL.EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr
                };
            }
            return(EmployeeTransferVM);
        }
示例#3
0
        public ActionResult Delete(TransfersViewModel EmployeeTransferVM)
        {
            BaseTransfersBLL BaseTransfers = new BaseTransfersBLL();

            BaseTransfers.LoginIdentity = UserIdentity;

            Result result = BaseTransfers.Remove(EmployeeTransferVM.TransferID);

            if (result.EnumMember == TransfersValidationEnum.RejectedBecauseOfAlreadyProcessed.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationBecauseOfBecauseOfAlreadyProcessedText);
            }

            return(RedirectToAction("Index"));
        }
示例#4
0
        public JsonResult GetTransfers()
        {
            BaseTransfersBLL BaseTransfersBLL = new BaseTransfersBLL();

            return(Json(new { data = BaseTransfersBLL.GetTransfers() }, JsonRequestBehavior.AllowGet));
        }