Ejemplo n.º 1
0
 public ActionResult UpdateSalaryClassNameForProfile(string SalaryClassName, string ProfileIDs, DateTime DateEndProbation, DateTime DateHire, Guid OrgStructureID, Guid SalaryRankID, Guid WorkPlaceID, Guid ContractTypeID, string BasicSalary)
 {
     var service = new Hre_ProfileServices();
     service.UpdateSalaryClassNameForProfile(SalaryClassName, ProfileIDs, DateEndProbation, DateHire, OrgStructureID, SalaryRankID, WorkPlaceID, ContractTypeID, BasicSalary, UserLogin);
     return Json(null);
 }
Ejemplo n.º 2
0
        public ActionResult ActionApplyCandidateGeneral(string selectedIds)
        {
            string message = NotificationType.Success.ToString();
            var actionService = new ActionService(UserLogin);
            string status = string.Empty;
            var lstCandidateGeneral = actionService.GetData<Hre_CandidateGeneralEntity>(Common.DotNetToOracle(selectedIds), ConstantSql.hrm_hr_sp_get_GeneralCandidateByIds, ref status);
            var salaryRankServices = new Cat_SalaryRankServices();
            var salaryClassServices = new Cat_SalaryClassServices();
            var profileServices = new Hre_ProfileServices();
            var contracttypeServices = new Cat_ContractTypeServices();
            var workHistoryServices = new Hre_WorkHistoryServices();
            var rankEntity = new Cat_SalaryRankEntity();
            var salaryClass = new Cat_SalaryClassEntity();
            var contractypeentity = new Cat_ContractTypeEntity();
            ActionService service = new ActionService(UserLogin);
            var salgradeServices = new Sal_GradeServices();
            var attgradeservive = new Att_GradeServices();

            foreach (var CandidateGeneral in lstCandidateGeneral)
            {
                #region Code Cũ
                //var datecontract = DateTime.Now;
                //if (CandidateGeneral.EnteringDate != null)
                //{
                //    datecontract = CandidateGeneral.EnteringDate.Value;
                //}
                //if (CandidateGeneral.RankRateID != Guid.Empty)
                //{
                //    rankEntity = service.GetByIdUseStore<Cat_SalaryRankEntity>(CandidateGeneral.RankRateID.Value,
                //                        ConstantSql.hrm_cat_sp_get_SalaryRankById, ref status);
                //}
                //if(CandidateGeneral.ContractTypeID != Guid.Empty)
                //{
                //    contractypeentity = service.GetByIdUseStore<Cat_ContractTypeEntity>(CandidateGeneral.ContractTypeID.Value, ConstantSql.hrm_cat_sp_get_ContractTypeById, ref status);
                //}

                //var profileEntity = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(CandidateGeneral.ProfileID.ToString()),
                //        ConstantSql.hrm_hr_sp_get_ProfileById, ref status).FirstOrDefault();

                //if (contractypeentity != null && contractypeentity.ValueTime != null)
                //{
                //    if (contractypeentity.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_MONTH.ToString())
                //    {
                //        datecontract = datecontract.AddMonths(int.Parse(contractypeentity.ValueTime.Value.ToString()));
                //    }
                //    else if (contractypeentity.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
                //    {
                //        datecontract = datecontract.AddYears(int.Parse(contractypeentity.ValueTime.Value.ToString()));
                //    }
                //}

                //if(profileEntity != null)
                //{
                //    profileEntity.OrgStructureID = CandidateGeneral.OrgStructureID;
                //    profileEntity.SalaryClassID = CandidateGeneral.SalaryClassID;
                //    profileEntity.DateHire = CandidateGeneral.EnteringDate;
                //    profileEntity.DateEndProbation = datecontract;
                //    profileEntity.WorkPlaceID = CandidateGeneral.WorkPlaceID;
                //}

                // var workplaceServices = new Cat_WorkPlaceServices();
                // Cat_WorkPlaceEntity workplace = null;
                //if(CandidateGeneral.WorkPlaceID != Guid.Empty)
                //{
                //workplace = workplaceServices.GetData<Cat_WorkPlaceEntity>(Common.DotNetToOracle(CandidateGeneral.WorkPlaceID.ToString()), ConstantSql.hrm_cat_sp_get_WorkPlaceById, ref status).FirstOrDefault();
                //}

                //var WorkHistoryEntity = new Hre_WorkHistoryEntity();
                //    WorkHistoryEntity.ProfileID = CandidateGeneral.ProfileID.Value;
                //    WorkHistoryEntity.DateEffective = CandidateGeneral.EnteringDate != null ? CandidateGeneral.EnteringDate.Value ? DateTime.Now;
                //    WorkHistoryEntity.SalaryClassID = CandidateGeneral.SalaryClassID;
                //    WorkHistoryEntity.OrganizationStructureID = CandidateGeneral.OrgStructureID;
                //    WorkHistoryEntity.WorkLocation = workplace != null ? workplace.WorkPlaceName : null;
                //    workHistoryServices.Add(WorkHistoryEntity);
                //} 
                #endregion

                var datecontract = DateTime.Now;
                if (CandidateGeneral.ContractTypeID != Guid.Empty)
                {
                    contractypeentity = actionService.GetData<Cat_ContractTypeEntity>(Common.DotNetToOracle(CandidateGeneral.ContractTypeID.ToString()),
                        ConstantSql.hrm_cat_sp_get_ContractTypeById, ref status).FirstOrDefault();
                }

                if (contractypeentity != null && contractypeentity.ValueTime != null)
                {
                    if (contractypeentity.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_MONTH.ToString())
                    {
                        datecontract = datecontract.AddMonths(int.Parse(contractypeentity.ValueTime.Value.ToString()));
                    }
                    else if (contractypeentity.UnitTime == HRM.Infrastructure.Utilities.EnumDropDown.UnitType.E_YEAR.ToString())
                    {
                        datecontract = datecontract.AddYears(int.Parse(contractypeentity.ValueTime.Value.ToString()));
                    }
                }
                profileServices.UpdateSalaryClassNameForProfile(null, CandidateGeneral.ProfileID.ToString(), datecontract, CandidateGeneral.EnteringDate.Value,
                    CandidateGeneral.OrgStructureID.Value, CandidateGeneral.RankRateID.Value, CandidateGeneral.WorkPlaceID.Value, CandidateGeneral.ContractTypeID.Value,
                    CandidateGeneral.BasicSalary.ToString(), UserLogin);
                //  profileServices.AddDataForContract(CandidateGeneral.BasicSalary.ToString(), CandidateGeneral.ProfileID.ToString(), CandidateGeneral.ContractTypeID.Value, CandidateGeneral.EnteringDate.Value, CandidateGeneral.RankRateID.Value);
                salgradeServices.AddDataForGrade(CandidateGeneral.ProfileID.ToString(), CandidateGeneral.GradePayrollID.Value, CandidateGeneral.EnteringDate.Value);
                attgradeservive.AddDataForGrade(CandidateGeneral.ProfileID.ToString(), CandidateGeneral.GradeAttendanceID.Value, CandidateGeneral.EnteringDate.Value);
            }
            return Json(message, JsonRequestBehavior.AllowGet);
        }