Ejemplo n.º 1
0
        public ActionResult ApprovedEvaContract(string selectedIds)
        {
            var ContractServices = new Hre_ContractServices();
            var profileServices = new Hre_ProfileServices();
            var ContractExtendServices = new Hre_ContractExtendServices();
            string message = string.Empty;
            string status = string.Empty;
            var lstContract = ContractServices.GetData<Hre_ContractEntity>(Common.DotNetToOracle(selectedIds), ConstantSql.hrm_hr_sp_get_ContractByIds, UserLogin, ref status).ToList();
            foreach (var contract in lstContract)
            {
                if (contract.ContractResult == HRM.Infrastructure.Utilities.EnumDropDown.ResultContract.PASS.ToString())
                {
                    if (contract.TypeOfPass == HRM.Infrastructure.Utilities.EnumDropDown.TypeOfPass.E_SIGNED_NEXTCONTRACT.ToString())
                    {
                        if (contract.RankDetailForNextContract == null || contract.DateEndNextContract == null)
                        {
                            message = ConstantDisplay.HRM_HR_Profile_LackOfRequiredInformation.ToString();
                            return Json(message);
                        }
                        contract.StatusEvaluation = "E_APPROVED";
                        message = profileServices.SaveContractAndNextSalaryApprovedEvaluation(contract,UserLogin);

                    }
                    else if (contract.TypeOfPass == HRM.Infrastructure.Utilities.EnumDropDown.TypeOfPass.E_SIGNED_APPENDIXCONTRACT.ToString())
                    {
                        Hre_ContractExtendEntity entity = new Hre_ContractExtendEntity();
                        entity.ContractID = contract.ID;
                        if (contract.DateExtend != null)
                        {
                            entity.DateStart = contract.DateExtend;
                        }
                        else
                        {
                            entity.DateStart = contract.DateEnd;
                        }
                        entity.DateEnd = contract.DateEndNextContract;
                        message = ContractExtendServices.Add(entity);
                        contract.StatusEvaluation = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_APPROVED.ToString();
                        contract.DateExtend = contract.DateEndNextContract;
                        contract.DateStart = contract.DateExtend != null ? contract.DateExtend.Value.AddDays(1) : contract.DateEnd.Value;
                        contract.DateExtend = contract.DateEndNextContract;
                        message = ContractServices.Edit(contract);
                    }
                }
                else
                {
                    contract.StatusEvaluation = HRM.Infrastructure.Utilities.EnumDropDown.Status.E_APPROVED.ToString();
                    message = ContractServices.Edit(contract);
                }

            }
            return Json(message);
        }