Esempio n. 1
0
        //var result = GetListDataAndReturn<Rec_CandidateModel, Rec_CandidateEntity, Rec_CandidateSearchModel>(request, model, ConstantSql.hrm_rec_sp_get_WaitingInterviewList);
        //return result;
        //}

        public ActionResult ExportWatingInterviewByTemplate([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_RecruitmentHistoryModel> resultRecruitmentHistory = new List<Rec_RecruitmentHistoryModel>();
            Rec_RecruitmentHistoryModel ObjRecruitmentHistory = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var lstWaitingInterview = baseService.GetData<Rec_RecruitmentHistoryModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterList, UserLogin, ref status);

            if (lstWaitingInterview == null || lstWaitingInterview.Count == 0)
            {
                return null;
            }
            lstWaitingInterview = lstWaitingInterview.Where(s => s.JobVacancyID != null).ToList();


            var lstrechisids = lstWaitingInterview.Select(s => s.ID).Distinct().ToList();

            var objCampaignDetail = new List<object>();
            objCampaignDetail.AddRange(new object[16]);
            objCampaignDetail[14] = 1;
            objCampaignDetail[15] = int.MaxValue - 1;
            var resultCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(objCampaignDetail, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);

            resultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID != null && lstrechisids.Contains(s.RecruitmentHistoryID.Value)).ToList();

            var lstjobvacancyids = lstWaitingInterview.Where(s => s.JobVacancyID != null).Select(s => s.JobVacancyID).Distinct().ToList();
            string strJobVacancyIds = string.Empty;
            foreach (Guid item in lstjobvacancyids)
            {
                strJobVacancyIds += item;
                strJobVacancyIds += ",";
            }
            if (strJobVacancyIds.Length > 0)
            {
                strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
            }
            var lstJobVacancy = baseService.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, UserLogin, ref status);
            #region Kết quả là rớt hoặc vỏng phỏng vấn = cuối thì KHÔNG load vào danh sách chờ phỏng vấn
            foreach (var his in lstWaitingInterview)
            {
                ObjRecruitmentHistory = new Rec_RecruitmentHistoryModel();
                var lstresultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID == his.ID && s.LevelInterview == null).ToList();
                if (his.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = lstJobVacancy.Where(s => s.ID == his.JobVacancyID).FirstOrDefault();
                    if (entityJobVacancy != null && his.LevelInterview != entityJobVacancy.NoLevelInterview && lstresultCampaignDetail.Count == 0 && his.Status != HRM.Infrastructure.Utilities.Interview.E_PASS.ToString())
                    {
                        ObjRecruitmentHistory = his;
                        resultRecruitmentHistory.Add(ObjRecruitmentHistory);
                    }
                }
            }
            #endregion

            var isDataTable = false;
            object obj = new Rec_RecruitmentHistoryModel();
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = resultRecruitmentHistory;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Rec_RecruitmentHistoryModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            var objInterview = new List<object>();
            objInterview.AddRange(new object[2]);
            objInterview[0] = 1;
            objInterview[1] = int.MaxValue - 1;
            var lstInterView = baseService.GetData<Rec_InterviewModel>(objInterview, ConstantSql.hrm_rec_sp_get_InterviewDataReport, UserLogin, ref status).ToList();

            foreach (var item in resultRecruitmentHistory)
            {
                if (lstInterView.Count > 0)
                {
                    var dataLevel1 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 1).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel2 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 2).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel3 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 3).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel4 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 4).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel5 = lstInterView.Where(s => s.CandidateID == item.CandidateID && s.LevelInterview == 5).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    if(dataLevel1 != null)
                    {
                        item.Score1_1 = dataLevel1.Score1;
                        item.Score1_2 = dataLevel1.Score2;
                        item.Score1_3 = dataLevel1.Score3;
                        item.KQ1 = dataLevel1.ResultInterviewView;
                        item.LanguageCode1 = dataLevel1.LanguageCode;
                        item.DateInterview1 = dataLevel1.DateInterview;
                    }
                    if (dataLevel2 != null)
                    {
                        item.Score2_1 = dataLevel2.Score1;
                        item.Score2_2 = dataLevel2.Score2;
                        item.Score2_3 = dataLevel2.Score3;
                        item.KQ2 = dataLevel2.ResultInterviewView;
                        item.LanguageCode2 = dataLevel2.LanguageCode;
                        item.DateInterview2 = dataLevel2.DateInterview;
                    }
                    if (dataLevel3 != null)
                    {
                        item.Score3_1 = dataLevel3.Score1;
                        item.Score3_2 = dataLevel3.Score2;
                        item.Score3_3 = dataLevel3.Score3;
                        item.KQ3 = dataLevel3.ResultInterviewView;
                        item.LanguageCode3 = dataLevel3.LanguageCode;
                        item.DateInterview3 = dataLevel3.DateInterview;
                    }
                    if (dataLevel4 != null)
                    {
                        item.Score4_1 = dataLevel4.Score1;
                        item.Score4_2 = dataLevel4.Score2;
                        item.Score4_3 = dataLevel4.Score3;
                        item.KQ4 = dataLevel4.ResultInterviewView;
                        item.LanguageCode4 = dataLevel4.LanguageCode;
                        item.DateInterview4 = dataLevel4.DateInterview;
                    }
                    if (dataLevel5 != null)
                    {
                        item.Score5_1 = dataLevel5.Score1;
                        item.Score5_2 = dataLevel5.Score2;
                        item.Score5_3 = dataLevel5.Score3;
                        item.KQ5 = dataLevel5.ResultInterviewView;
                        item.LanguageCode5 = dataLevel5.LanguageCode;
                        item.DateInterview5 = dataLevel5.DateInterview;
                    }
                }
            }

            if (model.ExportId != Guid.Empty)
            {

                var fullPath = ExportService.Export(model.ExportId, resultRecruitmentHistory, null, model.ExportType);
                return Json(fullPath);
            }

            return Json(resultRecruitmentHistory.ToDataSourceResult(request));
        }
Esempio n. 2
0
        // Click nút gọi điện ds ứng viên trúng tuyển
        public string ComputeResultInterview(string selectedIds, string UserLogin)
        {
            List<Rec_Interview> lstInterviewResultPass = new List<Rec_Interview>();
            List<Rec_Interview> lstInterviewResultFail = new List<Rec_Interview>();
            List<Rec_Candidate> lstCandidate = new List<Rec_Candidate>();
            List<Rec_RecruitmentHistory> lstRecruitmentHistory = new List<Rec_RecruitmentHistory>();
            using (var context = new VnrHrmDataContext())
            {
                int? levelinterview = 0;
                string status = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Rec_InterviewRepository(unitOfWork);
                var services = new Rec_InterviewServices();
                var Candidateservices = new Rec_CandidateServices();
                var Historyservices = new Rec_RecruitmentHistoryServices();
                BaseService service = new BaseService();
                List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
                var lstinterviews = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();

                #region Lấy ứng viên theo phỏng vấn
                var lstcandidateIDs = lstinterviews.Select(s => s.CandidateID).ToList();
                string strCandidateIDs = string.Empty;
                foreach (var candidatebyinterview in lstcandidateIDs)
                {
                    strCandidateIDs += Common.DotNetToOracle(candidatebyinterview.ToString()) + ",";
                }
                if (strCandidateIDs.IndexOf(",") > 0)
                    strCandidateIDs = strCandidateIDs.Substring(0, strCandidateIDs.Length - 1);

                var lstcandidate = service.GetData<Rec_Candidate>(strCandidateIDs, ConstantSql.hrm_rec_sp_get_CandidateByIds, UserLogin, ref status).ToList();
                var lstrecruitmentHistory = service.GetData<Rec_RecruitmentHistory>(strCandidateIDs, ConstantSql.hrm_hr_sp_get_RecHisByCandidateIds, UserLogin, ref status).ToList();
                #endregion

                #region Lấy nhóm đk tuyển theo phỏng vấn
                var lstgroupconditionIDs = lstinterviews.Where(s => s.CandidateID != null).Select(s => s.GroupConditionID).ToList();
                string strgroupIDs = string.Empty;
                foreach (var candidatebyinterview in lstgroupconditionIDs)
                {
                    strgroupIDs += Common.DotNetToOracle(candidatebyinterview.ToString()) + ",";
                }
                if (strgroupIDs.IndexOf(",") > 0)
                    strgroupIDs = strgroupIDs.Substring(0, strgroupIDs.Length - 1);

                var lstgroupconditions = service.GetData<Rec_GroupConditionEntity>(strgroupIDs, ConstantSql.hrm_rec_sp_get_GroupConditionByIds, UserLogin, ref status).ToList();
                if (lstgroupconditions == null)
                {
                    return null;
                }
                #endregion

                #region Lấy yêu cầu tuyển theo ứng viên
                var lstJobVaCancyIDs = lstcandidate.Select(s => s.JobVacancyID).ToList();
                string strJobVacancyIds = string.Empty;
                foreach (Guid candidatebyinterview in lstJobVaCancyIDs)
                {
                    strJobVacancyIds += candidatebyinterview;
                    strJobVacancyIds += ",";
                }
                if (strJobVacancyIds.Length > 0)
                {
                    strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
                }
                var lstJobVacancy = service.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, UserLogin, ref status).ToList();
                var repoJobCondition = new Rec_JobConditionRepository(unitOfWork);
                var lstJobCondition = repoJobCondition.FindBy(s => s.IsDelete == null).ToList();
                #endregion

                #region Lấy ds nv nghỉ việc
                var ProfileServices = new Hre_ProfileServices();
                List<object> lstparasearchpro = new List<object>();
                lstparasearchpro = new List<object>();
                lstparasearchpro.AddRange(new object[19]);
                lstparasearchpro[17] = 1;
                lstparasearchpro[18] = Int32.MaxValue - 1;
                var lstProfile = service.GetData<Hre_ProfileEntity>(lstparasearchpro, ConstantSql.hrm_hr_sp_get_ProfileQuit, UserLogin, ref status).ToList();
                #endregion

                #region Lấy ds bệnh
                List<object> lstparadiseelist = new List<object>();
                lstparadiseelist.Add(null);
                lstparadiseelist.Add(EnumDropDown.EntityType.E_SICK_REC.ToString());
                lstparadiseelist.Add(1);
                lstparadiseelist.Add(int.MaxValue - 1);
                var lstsick = service.GetData<Cat_NameEntityEntity>(lstparadiseelist, ConstantSql.hrm_cat_sp_get_LevelGeneral, UserLogin, ref status).ToList();

                #endregion

                #region Lấy ds trình độ học vấn
                List<object> lstparaEdu = new List<object>();
                lstparaEdu.Add(null);
                lstparaEdu.Add(1);
                lstparaEdu.Add(int.MaxValue - 1);
                var lstEducationLevel = service.GetData<Cat_NameEntityEntity>(lstparaEdu, ConstantSql.hrm_cat_sp_get_EducationLevel, UserLogin, ref status).ToList();
                #endregion

                string message = NotificationType.Success.ToString();
                foreach (var interview in lstinterviews)
                {
                    var candidatebyinterview = lstcandidate.Where(s => s.ID == interview.CandidateID.Value && s.JobVacancyID != null).FirstOrDefault();
                    if(candidatebyinterview.JobVacancyID == null)
                    {
                        message = ConstantMessages.Fail;
                        continue;
                    }
                    var jobvacancybyCandidate = lstJobVacancy.Where(s => candidatebyinterview.JobVacancyID != null && s.ID == candidatebyinterview.JobVacancyID.Value).FirstOrDefault();
                    var lstconditionidsbygroupcondition = lstgroupconditions.Where(s => s.ID == interview.GroupConditionID).FirstOrDefault();
                    if (lstconditionidsbygroupcondition == null)
                    {
                        continue;
                    }

                    if (interview.LevelInterview > jobvacancybyCandidate.NoLevelInterview || candidatebyinterview.Status == EnumDropDown.CandidateStatus.E_PASS.ToString()
                    || candidatebyinterview.Status == EnumDropDown.CandidateStatus.E_FAIL.ToString() || candidatebyinterview.Status == EnumDropDown.CandidateStatus.E_HIRE.ToString())
                    {
                        message = ConstantDisplay.HRM_Rec_EmpHaveResult;
                        continue;
                    }
                    List<Guid> ids = new List<Guid>();
                    ids = lstconditionidsbygroupcondition.JobConditionIDs
                           .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                           .Select(x => Guid.Parse(x))
                           .ToList();
                    var lstconditionbyGroup = lstJobCondition.Where(s => ids.Contains(s.ID)).ToList();
                    int countCondition = lstconditionbyGroup.Count;
                    int countAgree = 0;
                    #region MyRegion
                    foreach (var Condition in lstconditionbyGroup)
                    {
                        #region Kiểm tra Tổng Điểm Phỏng Vấn
                        if (Condition.ConditionName == ConditionName.E_INTERVIEW.ToString())
                        {
                            double valueInterview1 = 0;
                            try
                            {
                                valueInterview1 = double.Parse(Condition.Value1);
                            }
                            catch
                            {

                            }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.Interview == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valueInterview1 != 0 && candidatebyinterview.Interview.HasValue)
                            {

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueInterview1 <= candidatebyinterview.Interview)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueInterview1 >= candidatebyinterview.Interview)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueInterview1 == candidatebyinterview.Interview)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && valueInterview1 != 0 && candidatebyinterview.Interview.HasValue)
                            {


                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueInterview1 <= candidatebyinterview.Interview)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueInterview1 >= candidatebyinterview.Interview)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueInterview1 == candidatebyinterview.Interview)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                        }
                        #endregion
                        #region Kiểm tra Điểm Thi Viết
                        if (Condition.ConditionName == ConditionName.E_WRITETEST.ToString())
                        {
                            double valueWriteTest1 = 0;
                            try
                            {
                                valueWriteTest1 = double.Parse(Condition.Value1);
                            }
                            catch
                            { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.WriteTest == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valueWriteTest1 != 0 && candidatebyinterview.WriteTest.HasValue)
                            {

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueWriteTest1 <= candidatebyinterview.WriteTest)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueWriteTest1 >= candidatebyinterview.WriteTest)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueWriteTest1 == candidatebyinterview.WriteTest)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && valueWriteTest1 != 0 && candidatebyinterview.WriteTest.HasValue)
                            {


                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueWriteTest1 <= candidatebyinterview.WriteTest)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueWriteTest1 >= candidatebyinterview.WriteTest)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueWriteTest1 == candidatebyinterview.WriteTest)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                        }
                        #endregion
                        #region Kiểm tra Tổng Sức Khỏe
                        if (Condition.ConditionName == ConditionName.E_GENERALHEALTH.ToString())
                        {
                            double valueHealth1 = 0;
                            try
                            {
                                valueHealth1 = double.Parse(Condition.Value1);
                            }
                            catch
                            { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.GenaralHealth == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valueHealth1 != 0 && candidatebyinterview.GenaralHealth.HasValue)
                            {


                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueHealth1 <= candidatebyinterview.GenaralHealth)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueHealth1 >= candidatebyinterview.GenaralHealth)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueHealth1 == candidatebyinterview.GenaralHealth)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && candidatebyinterview.GenaralHealth.HasValue && valueHealth1 != 0)
                            {


                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueHealth1 <= candidatebyinterview.GenaralHealth)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueHealth1 >= candidatebyinterview.GenaralHealth)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueHealth1 == candidatebyinterview.GenaralHealth)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #region Kiểm tra cao
                        if (Condition.ConditionName == ConditionName.E_HEIGHT.ToString())
                        {
                            double valueHeight1 = 0;
                            try
                            {
                                valueHeight1 = double.Parse(Condition.Value1);
                            }
                            catch
                            { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.Height == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valueHeight1 != 0 && candidatebyinterview.Height.HasValue)
                            {


                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueHeight1 <= candidatebyinterview.Height)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueHeight1 >= candidatebyinterview.Height)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueHeight1 == candidatebyinterview.Height)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && candidatebyinterview.Height.HasValue && valueHeight1 != 0)
                            {


                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.Height <= valueHeight1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.Height >= valueHeight1)
                                {

                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueHeight1 == candidatebyinterview.Height)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #region Kiểm tra Cân Nặng
                        if (Condition.ConditionName == ConditionName.E_WEIGHT.ToString())
                        {

                            double valueWeight1 = 0;
                            try
                            {
                                valueWeight1 = double.Parse(Condition.Value1);
                            }
                            catch { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.Weight == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valueWeight1 != 0 && candidatebyinterview.Weight.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.Weight == valueWeight1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.Weight >= valueWeight1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.Height <= valueWeight1)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && valueWeight1 != 0 && candidatebyinterview.Weight.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.Weight == valueWeight1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.Weight <= valueWeight1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.Height >= valueWeight1)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #region Kiểm Tra Mắt
                        #region Mắt Trái
                        if (Condition.ConditionName == ConditionName.E_LEVELEYES.ToString())
                        {

                            double valueEyes1 = 0;
                            // double Eyes = 0;
                            try
                            {
                                valueEyes1 = double.Parse(Condition.Value1);
                                //  Eyes = double.Parse(candidatebyinterview.LevelEye);
                            }
                            catch { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (!candidatebyinterview.LevelEye.HasValue)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valueEyes1 != 0)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.LevelEye.Value == valueEyes1)
                                {
                                    countAgree++;
                                    continue;

                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.LevelEye.Value >= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.LevelEye.Value <= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && valueEyes1 != 0)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.LevelEye.Value == valueEyes1)
                                {
                                    countAgree++;
                                    continue;

                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.LevelEye.Value <= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.LevelEye.Value >= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #region Mắt Phải
                        if (Condition.ConditionName == ConditionName.E_LEVERIGHTLEYES.ToString())
                        {

                            double valueEyes1 = 0;
                            // double Eyes = 0;
                            try
                            {
                                valueEyes1 = double.Parse(Condition.Value1);
                                //  Eyes = double.Parse(candidatebyinterview.LevelEye);
                            }
                            catch { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (!candidatebyinterview.LevelEye.HasValue)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valueEyes1 != 0)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.LevelEyeRight.Value == valueEyes1)
                                {
                                    countAgree++;
                                    continue;

                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.LevelEyeRight.Value >= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.LevelEyeRight.Value <= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && valueEyes1 != 0)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.LevelEyeRight.Value == valueEyes1)
                                {
                                    countAgree++;
                                    continue;

                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.LevelEyeRight.Value <= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.LevelEyeRight.Value >= valueEyes1)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #endregion
                        #region Kiểm tra Thời Gian Trượt Kỳ Trước
                        if (Condition.ConditionName == ConditionName.E_DURATIONFAILPREVIOUS.ToString())
                        {
                            int valueDuration1 = int.Parse(Condition.Value1);
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                            {

                                var listCandidateHis = lstrecruitmentHistory.Where(x => x.CandidateID == candidatebyinterview.ID && x.Status == HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString())
                                    .OrderByDescending(x => x.DateApply).ToList();
                                if (listCandidateHis == null || listCandidateHis.Count == 0)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (listCandidateHis != null && listCandidateHis.Count != 0)
                                {
                                    var CandidateHistory = listCandidateHis.FirstOrDefault();
                                    int Monthhistory = CandidateHistory.DateApply.Value.Month;
                                    int monthcheck = candidatebyinterview.DateApply.Value.Month;

                                    int month = Math.Abs(monthcheck - Monthhistory);

                                    if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && month == valueDuration1)
                                    {
                                        countAgree++;
                                        continue;
                                    }

                                    if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && month > valueDuration1)
                                    {
                                        countAgree++;
                                        continue;
                                    }

                                    if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && month < valueDuration1)
                                    {
                                        countAgree++;
                                        continue;
                                    }
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                            {

                                var listCandidateHis = lstrecruitmentHistory.Where(x => x.CandidateID == candidatebyinterview.ID && x.Status == HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString())
                                    .OrderByDescending(x => x.DateApply).ToList();
                                if (listCandidateHis == null || listCandidateHis.Count == 0)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (listCandidateHis != null && listCandidateHis.Count != 0)
                                {

                                    var CandidateHistory = listCandidateHis.FirstOrDefault();
                                    int Monthhistory = CandidateHistory.DateApply.Value.Month;

                                    int monthcheck = candidatebyinterview.DateApply.Value.Month;

                                    int month = Math.Abs(monthcheck - Monthhistory);

                                    if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && month != valueDuration1)
                                    {
                                        countAgree++;
                                        continue;

                                    }

                                    if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && month < valueDuration1)
                                    {
                                        countAgree++;
                                        continue;
                                    }

                                    if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && month > valueDuration1)
                                    {
                                        countAgree++;
                                        continue;
                                    }
                                }
                            }

                        }
                        #endregion
                        #region Kiểm tra Từ Tuổi
                        if (Condition.ConditionName == ConditionName.E_AGE.ToString())
                        {
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.DateOfBirth == null)
                            {
                                countAgree++;
                                continue;
                            }
                            double? AgeCadidate = (new DateTime(DateTime.Now.Subtract(candidatebyinterview.DateOfBirth).Ticks).Year - 1) > 0 ? (new DateTime(DateTime.Now.Subtract(candidatebyinterview.DateOfBirth).Ticks).Year - 1) : (DateTime.Now.Subtract(candidatebyinterview.DateOfBirth).TotalDays / 365.242199);
                            double? valueAge = 0;
                            try
                            {
                                valueAge = int.Parse(Condition.Value1);
                            }
                            catch
                            {
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && AgeCadidate > 0)
                            {

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && AgeCadidate >= valueAge)
                                {
                                    countAgree++;
                                    continue;

                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && AgeCadidate <= valueAge)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && AgeCadidate == valueAge)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && AgeCadidate > 0)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && AgeCadidate >= valueAge)
                                {
                                    countAgree++;
                                    continue;

                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && AgeCadidate <= valueAge)
                                {
                                    countAgree++;
                                    continue;
                                }
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && AgeCadidate == valueAge)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                        }
                        #endregion
                        #region Kiểm tra Giới Tính
                        if (Condition.ConditionName == ConditionName.E_GENDER.ToString())
                        {
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (string.IsNullOrEmpty(candidatebyinterview.Gender))
                            {
                                countAgree++;
                                continue;
                            }
                            string valueGender = Condition.Value1;

                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                            {

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.Gender.Equals(valueGender))
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && !candidatebyinterview.Gender.Equals(valueGender))
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                        }
                        #endregion
                        #region Kiểm Tra Đã làm ở cty chưa
                        if (Condition.ConditionName == ConditionName.E_ISTERMINATEINCOMPANY.ToString() && Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString())
                        {
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                            {

                                if (lstProfile != null && lstProfile.Count != 0)
                                {
                                    // nếu có CMND thì ưu tiên kiểm tra trước
                                    if (!string.IsNullOrEmpty(candidatebyinterview.IdentifyNumber))
                                    {
                                        var Profile = lstProfile.FirstOrDefault(x => !string.IsNullOrEmpty(x.IDNo) && x.IDNo == candidatebyinterview.IdentifyNumber);
                                        if (Profile == null)
                                        {
                                            countAgree++;
                                            continue;
                                        }
                                    }
                                    // nếu ko có CMND thì kiểm tra tên và ngày sinh 
                                    else if (!string.IsNullOrEmpty(candidatebyinterview.CandidateName) && candidatebyinterview.DateOfBirth != null)
                                    {
                                        var Profile = lstProfile.FirstOrDefault(x => !string.IsNullOrEmpty(x.ProfileName) && x.DateOfBirth.HasValue && x.ProfileName == candidatebyinterview.CandidateName && candidatebyinterview.DateOfBirth == x.DateOfBirth.Value);
                                        if (Profile == null)
                                        {
                                            countAgree++;
                                            continue;
                                        }
                                    }

                                }
                            }
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                            {
                                if (lstProfile != null && lstProfile.Count != 0)
                                {
                                    // nếu có CMND thì ưu tiên kiểm tra trước
                                    if (!string.IsNullOrEmpty(candidatebyinterview.IdentifyNumber))
                                    {
                                        var Profile = lstProfile.FirstOrDefault(x => !string.IsNullOrEmpty(x.IDNo) && x.IDNo == candidatebyinterview.IdentifyNumber);
                                        if (Profile == null)
                                        {
                                            countAgree++;
                                            continue;
                                        }
                                    }
                                    // nếu ko có CMND thì kiểm tra tên và ngày sinh 
                                    else if (!string.IsNullOrEmpty(candidatebyinterview.CandidateName) && candidatebyinterview.DateOfBirth != null)
                                    {
                                        var Profile = lstProfile.FirstOrDefault(x => !string.IsNullOrEmpty(x.ProfileName) && x.DateOfBirth.HasValue && x.ProfileName == candidatebyinterview.CandidateName && candidatebyinterview.DateOfBirth.Date == x.DateOfBirth.Value.Date);
                                        if (Profile == null)
                                        {
                                            countAgree++;
                                            continue;
                                        }
                                    }

                                }


                            }
                        }
                        #endregion
                        #region Kiểm Tra Bệnh Loại Trừ
                        if (Condition.ConditionName == ConditionName.E_DISEASEIDS.ToString())
                        {
                            // nếu ko có bệnh thì qua
                            if (string.IsNullOrEmpty(candidatebyinterview.DiseaseListIDs))
                            {
                                countAgree++;
                                continue;

                            }
                            // nếu có chứa bệnh nào thì ko qua
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                            {
                                if (!string.IsNullOrEmpty(Condition.Value1))
                                {
                                    //lấy ds bệnh của đk tuyển
                                    var lstDiseaseCondition = Condition.Value1.Split(',').Select(x => x).ToList();

                                    var lstsickbycondition = lstsick.Where(s => lstDiseaseCondition.Contains(Common.DotNetToOracle(s.ID.ToString()))).ToList();
                                    // lấy ds mã bệnh của candidate - vì candidate lưu mã
                                    var lstDiseseCandidate = candidatebyinterview.DiseaseListIDs.Split(',').ToList();
                                    if (lstsickbycondition.Where(x => lstDiseseCandidate.Contains(x.Code)).Count() == 0)
                                    {
                                        countAgree++;
                                        continue;
                                    }
                                }
                            }
                            else if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                            {
                                if (!string.IsNullOrEmpty(Condition.Value1))
                                {
                                    //lấy ds bệnh của đk tuyển
                                    var lstDiseaseCondition = Condition.Value1.Split(',').Select(x => x).ToList();

                                    var lstsickbycondition = lstsick.Where(s => lstDiseaseCondition.Contains(Common.DotNetToOracle(s.ID.ToString()))).ToList();
                                    // lấy ds mã bệnh của candidate - vì candidate lưu mã
                                    var lstDiseseCandidate = candidatebyinterview.DiseaseListIDs.Split(',').ToList();
                                    if (lstsickbycondition.Where(x => lstDiseseCandidate.Contains(x.Code)).Count() != 0)
                                    {
                                        countAgree++;
                                        continue;
                                    }
                                }
                            }
                        }
                        #endregion
                        #region Kiểm tra điểm thi
                        #region Điểm 1
                        if (Condition.ConditionName == ConditionName.E_SCORE1.ToString())
                        {

                            double? valueScore1Condition = double.Parse(Condition.Value1);
                            double? valueScore1 = interview.Score1;
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueScore1 == valueScore1Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueScore1 > valueScore1Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueScore1 < valueScore1Condition)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueScore1 != valueScore1Condition)
                                {
                                    countAgree++;
                                    continue;

                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueScore1 < valueScore1Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueScore1 > valueScore1Condition)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                        }
                        #endregion
                        #region Điểm 2
                        if (Condition.ConditionName == ConditionName.E_SCORE2.ToString())
                        {
                            double? valueScore2Condition = double.Parse(Condition.Value1);
                            double? valueScore2 = interview.Score2;
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueScore2 == valueScore2Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueScore2 > valueScore2Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueScore2 < valueScore2Condition)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueScore2 != valueScore2Condition)
                                {
                                    countAgree++;
                                    continue;

                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueScore2 < valueScore2Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueScore2 > valueScore2Condition)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                        }
                        #endregion
                        #region Điểm 3
                        if (Condition.ConditionName == ConditionName.E_SCORE3.ToString())
                        {
                            double? valueScore3Condition = double.Parse(Condition.Value1);
                            double? valueScore3 = interview.Score3;
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueScore3 == valueScore3Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueScore3 > valueScore3Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueScore3 < valueScore3Condition)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && valueScore3 != valueScore3Condition)
                                {
                                    countAgree++;
                                    continue;

                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && valueScore3 < valueScore3Condition)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && valueScore3 > valueScore3Condition)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                        }
                        #endregion
                        #endregion
                        #region Kiểm tra Hệ Vận Động
                        if (Condition.ConditionName == ConditionName.E_MUSCULOSKELETAL.ToString())
                        {

                            double valuemusculoskeletal = 0;
                            try
                            {
                                valuemusculoskeletal = double.Parse(Condition.Value1);
                            }
                            catch { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.Musculoskeletal == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && valuemusculoskeletal != 0 && candidatebyinterview.Musculoskeletal.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.Musculoskeletal == valuemusculoskeletal)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.Musculoskeletal >= valuemusculoskeletal)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.Musculoskeletal <= valuemusculoskeletal)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && valuemusculoskeletal != 0 && candidatebyinterview.Musculoskeletal.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.Musculoskeletal != valuemusculoskeletal)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.Musculoskeletal < valuemusculoskeletal)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.Musculoskeletal > valuemusculoskeletal)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #region Kiểm tra Huyết Áp
                        if (Condition.ConditionName == ConditionName.E_BLOODPRESSURE.ToString())
                        {

                            double bloodpressure = 0;
                            try
                            {
                                bloodpressure = double.Parse(Condition.Value1);
                            }
                            catch { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.BloodPressure == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && bloodpressure != 0 && candidatebyinterview.BloodPressure.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.BloodPressure == bloodpressure)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.BloodPressure >= bloodpressure)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.BloodPressure <= bloodpressure)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && bloodpressure != 0 && candidatebyinterview.BloodPressure.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.BloodPressure != bloodpressure)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.BloodPressure < bloodpressure)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.BloodPressure > bloodpressure)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #region Kiểm tra Nhịp Tim
                        if (Condition.ConditionName == ConditionName.E_HEARTBEAT.ToString())
                        {

                            double heartbeat = 0;
                            try
                            {
                                heartbeat = double.Parse(Condition.Value1);
                            }
                            catch { }
                            // nếu giá trị của ứng viên là null thì ko kiểm tra =>thỏa
                            if (candidatebyinterview.HeartBeat == null)
                            {
                                countAgree++;
                                continue;
                            }
                            // Điều kiện thỏa
                            if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString() && heartbeat != 0 && candidatebyinterview.HeartBeat.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.HeartBeat == heartbeat)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.HeartBeat >= heartbeat)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.HeartBeat <= heartbeat)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }
                            //không thỏa
                            else if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString() && heartbeat != 0 && candidatebyinterview.HeartBeat.HasValue)
                            {
                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_EQUAL.ToString() && candidatebyinterview.HeartBeat != heartbeat)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_THAN.ToString() && candidatebyinterview.HeartBeat < heartbeat)
                                {
                                    countAgree++;
                                    continue;
                                }

                                if (Condition.ValueType == HRM.Infrastructure.Utilities.ValueType.E_LESS.ToString() && candidatebyinterview.HeartBeat > heartbeat)
                                {
                                    countAgree++;
                                    continue;
                                }
                            }

                        }
                        #endregion
                        #region Kiểm tra Trình độ học vấn
                        if (Condition.ConditionName == ConditionName.E_EDUCATIONLEVEL.ToString())
                        {
                            if (candidatebyinterview.EducationLevelID == null)
                            {
                                countAgree++;
                                continue;

                            }
                            else
                            {
                                if (Condition.ConditionBrand == ConditionBrand.E_AGREEMENT.ToString())
                                {
                                    if (!string.IsNullOrEmpty(Condition.Value1))
                                    {
                                        // Lấy list string mã trình độ học vấn
                                        var lstCodeEducationLevelOfCondition = Condition.Value1.Split(',').Select(x => x).ToList();
                                        // lấy mã trình độ học vấn của Candidate
                                        var CodeEduOfCandidate = lstEducationLevel.Where(s => s.ID == candidatebyinterview.EducationLevelID).Select(s => s.Code).FirstOrDefault();

                                        if (lstCodeEducationLevelOfCondition.Contains(CodeEduOfCandidate))
                                        {
                                            countAgree++;
                                            continue;
                                        }
                                    }
                                }
                                if (Condition.ConditionBrand == ConditionBrand.E_NOTAGREEMENT.ToString())
                                {
                                    var lstEduCondition = Condition.Value1.Split(',').Select(x => x).ToList();
                                    var CodeEduOfCandidate = lstEducationLevel.Where(s => s.ID == candidatebyinterview.EducationLevelID).Select(s => s.Code).FirstOrDefault();
                                    if (!lstEduCondition.Contains(CodeEduOfCandidate))
                                    {
                                        countAgree++;
                                        continue;
                                    }
                                }
                            }
                        }
                        #endregion
                    }
                    #endregion
                    // Son.Vo làm theo task 0045675 Nếu ko có vòng pv thì vòng pv = 0.
                    if (interview.LevelInterview == null) 
                    {
                        message = ConstantDisplay.HRM_Common_NotHaveLevelInterview.ToString();
                        continue;
                    }
                    else
                    {
                        levelinterview = interview.LevelInterview;
                    }

                    // Cập nhật lại trạng Ứng viên + lịch sử.
                    candidatebyinterview.LevelInterview = levelinterview;
                    var rechisbycandidate = lstrecruitmentHistory.Where(s => s.CandidateID == candidatebyinterview.ID).OrderByDescending(s => s.DateApply).FirstOrDefault();
                    interview.LevelInterview = levelinterview;
                    rechisbycandidate.LevelInterview = levelinterview;
                    if (countAgree == countCondition)
                    {
                        interview.Status = "E_PASS";
                        interview.ResultInterview = "E_PASS";
                        lstInterviewResultPass.Add(interview);
                        // Nếu là vòng pv cuối và kq là đậu thì cập nhật ứng viên + lịch sử
                        if (jobvacancybyCandidate != null && jobvacancybyCandidate.NoLevelInterview == levelinterview)
                        {
                            candidatebyinterview.Status = "E_PASS";
                            rechisbycandidate.Status = "E_PASS";
                        }
                    }
                    else
                    {
                        interview.Status = "E_FAIL";
                        interview.ResultInterview = "E_FAIL";
                        // Nếu là là rớt thì cập nhật ứng viên + lịch sử
                        candidatebyinterview.Status = "E_FAIL";
                        rechisbycandidate.Status = "E_FAIL";
                        lstInterviewResultFail.Add(interview);
                    }
                    lstCandidate.Add(candidatebyinterview);
                    lstRecruitmentHistory.Add(rechisbycandidate);
                }
                if (lstInterviewResultPass.Count > 0)
                {
                    services.Edit(lstInterviewResultPass);
                }
                if (lstInterviewResultFail.Count > 0)
                {

                    services.Edit(lstInterviewResultFail);
                }
                Candidateservices.Edit(lstCandidate);
                Historyservices.Edit(lstRecruitmentHistory);
                repo.SaveChanges();
                return message;
            }
        }
Esempio n. 3
0
        public ActionResult GetWaitingInterviewList([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_CandidateModel> resultCandidate = new List<Rec_CandidateModel>();
            Rec_CandidateModel ObjCandidate = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = baseService.GetData<Rec_CandidateModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterviewList, UserLogin, ref status);
            #region Kết quả là rớt hoặc vỏng phỏng vấn = cuối thì KHÔNG load vào danh sách chờ phỏng vấn

            result = result.Where(s => s.Status != HRM.Infrastructure.Utilities.Interview.E_FAIL.ToString()).ToList();
            foreach (var item in result)
            {
                ObjCandidate = new Rec_CandidateModel();
                objs = new List<object>();
                objs.Add(item.ID);
                objs.Add(1);
                objs.Add(10000);
                //var resultInterview = baseService.GetData<Rec_InterviewModel>(objs, ConstantSql.hrm_rec_sp_get_InterviewByCandidateID, ref status);
                //Danh sach ke hoach cua ung vien
                var resultCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(objs, ConstantSql.hrm_rec_sp_get_InCamDetailByCddId, UserLogin, ref status).ToList();
                if (item.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = service.GetByIdUseStore<Rec_JobVacancyEntity>(item.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    if (item.LevelInterview == null)
                        item.LevelInterview = 0;
                    if (item.LevelInterview != entityJobVacancy.NoLevelInterview && item.LevelInterview == resultCampaignDetail.Count)
                    {
                        ObjCandidate = item;
                        resultCandidate.Add(ObjCandidate);
                    }
                }
            }
            #endregion
            return Json(resultCandidate.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
Esempio n. 4
0
        //[Tho.Bui] - Load theo lich su ung vien
        public ActionResult GetWaitingInterList([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_RecruitmentHistoryModel> resultRecruitmentHistory = new List<Rec_RecruitmentHistoryModel>();
            Rec_RecruitmentHistoryModel ObjRecruitmentHistory = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var lstWaitingInterview = baseService.GetData<Rec_RecruitmentHistoryModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterList, UserLogin, ref status);

            if (lstWaitingInterview == null || lstWaitingInterview.Count == 0)
            {
                return null;
            }

          

            lstWaitingInterview = lstWaitingInterview.Where(s => s.JobVacancyID != null).ToList();

            var lstrechisids = lstWaitingInterview.Select(s => s.ID).Distinct().ToList();

            var objCampaignDetail = new List<object>();
            objCampaignDetail.AddRange(new object[16]);
            objCampaignDetail[14] = 1;
            objCampaignDetail[15] = int.MaxValue - 1;
            var resultCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(objCampaignDetail, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);

            resultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID != null && lstrechisids.Contains(s.RecruitmentHistoryID.Value)).ToList();

            var lstjobvacancyids = lstWaitingInterview.Where(s => s.JobVacancyID != null).Select(s => s.JobVacancyID).Distinct().ToList();
            string strJobVacancyIds = string.Empty;
            foreach (Guid item in lstjobvacancyids)
            {
                strJobVacancyIds += item;
                strJobVacancyIds += ",";
            }
            if (strJobVacancyIds.Length > 0)
            {
                strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
            }
            var lstJobVacancy = baseService.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, UserLogin, ref status);
            #region Kết quả là rớt hoặc vỏng phỏng vấn = cuối thì KHÔNG load vào danh sách chờ phỏng vấn
            foreach (var his in lstWaitingInterview)
            {
                ObjRecruitmentHistory = new Rec_RecruitmentHistoryModel();
                var lstresultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID == his.ID && s.LevelInterview == null).ToList();
                if (his.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = lstJobVacancy.Where(s => s.ID == his.JobVacancyID).FirstOrDefault();
                    if (entityJobVacancy != null && his.LevelInterview != entityJobVacancy.NoLevelInterview && lstresultCampaignDetail.Count == 0 && his.Status != HRM.Infrastructure.Utilities.Interview.E_PASS.ToString())
                    {
                        ObjRecruitmentHistory = his;
                        resultRecruitmentHistory.Add(ObjRecruitmentHistory);
                    }
                }
            }
            #endregion
            return Json(resultRecruitmentHistory.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
Esempio n. 5
0
 public ActionResult ComputeResultInterview(string selectedIds)
 {
     var service = new Rec_InterviewServices();
     var message = service.ComputeResultInterview(selectedIds, UserLogin);
     return Json(message);
 }
Esempio n. 6
0
        public ActionResult ExportAllWaitingInterviewList([DataSourceRequest] DataSourceRequest request, Rec_WaitingInterviewSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<Rec_RecruitmentHistoryModel> resultRecruitmentHistory = new List<Rec_RecruitmentHistoryModel>();
            Rec_RecruitmentHistoryModel ObjRecruitmentHistory = null;
            var InterviewServices = new Rec_InterviewServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var lstWaitingInterview = baseService.GetData<Rec_RecruitmentHistoryModel>(lstModel, ConstantSql.hrm_rec_sp_get_WaitingInterList, UserLogin, ref status);

            if (lstWaitingInterview == null || lstWaitingInterview.Count == 0)
            {
                return null;
            }
            lstWaitingInterview = lstWaitingInterview.Where(s => s.JobVacancyID != null).ToList();
            var lstrechisids = lstWaitingInterview.Select(s => s.ID).ToList();
            var resultCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();
            int _total = lstrechisids.Count;
            int _totalPage = _total / 100 + 1;
            int _pageSize = 100;
            for (int _page = 1; _page <= _totalPage; _page++)
            {
                int _skip = _pageSize * (_page - 1);
                var _listCurrenPage = lstrechisids.Skip(_skip).Take(_pageSize).ToList();
                string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));

                var lstCampaignDetail = baseService.GetData<Rec_InterviewCampaignDetailModel>(_strselectedIDs, ConstantSql.hrm_rec_sp_get_InCamDetailByLstRechisIDs, UserLogin, ref status).ToList();
                if (lstCampaignDetail != null && lstCampaignDetail.Count > 0)
                {
                    resultCampaignDetail.AddRange(lstCampaignDetail);
                }
            }

            var lstjobvacancyids = lstWaitingInterview.Where(s => s.JobVacancyID != null).Select(s => s.JobVacancyID).Distinct().ToList();
            string strJobVacancyIds = string.Empty;
            foreach (Guid item in lstjobvacancyids)
            {
                strJobVacancyIds += item;
                strJobVacancyIds += ",";
            }
            if (strJobVacancyIds.Length > 0)
            {
                strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
            }
            var lstJobVacancy = baseService.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, UserLogin, ref status);
            foreach (var his in lstWaitingInterview)
            {
                ObjRecruitmentHistory = new Rec_RecruitmentHistoryModel();
                var lstresultCampaignDetail = resultCampaignDetail.Where(s => s.RecruitmentHistoryID == his.ID && s.LevelInterview == null).ToList();
                if (his.JobVacancyID.HasValue)
                {
                    var entityJobVacancy = lstJobVacancy.Where(s => s.ID == his.JobVacancyID).FirstOrDefault();
                    if (his.LevelInterview == null)
                        his.LevelInterview = 0;
                    if (entityJobVacancy != null && his.LevelInterview != entityJobVacancy.NoLevelInterview && lstresultCampaignDetail.Count == 0 && his.Status != HRM.Infrastructure.Utilities.Interview.E_PASS.ToString())
                    {
                        ObjRecruitmentHistory = his;
                        resultRecruitmentHistory.Add(ObjRecruitmentHistory);
                    }
                }
            }

            status = ExportService.Export(resultRecruitmentHistory, model.GetPropertyValue("ValueFields").TryGetValue<string>().Split(','));

            return Json(status);
        }
        public string ActionPassing(string selectedIds, string userLogin)
        {

            using (var context = new VnrHrmDataContext())
            {
                BaseService service = new BaseService();
                Rec_InterviewServices services = new Rec_InterviewServices();
                Rec_InterviewCampaignDetailServices InterviewCampaignDetailServices = new Rec_InterviewCampaignDetailServices();
                Rec_RecruitmentHistoryServices RecruitmentHistoryServices = new Rec_RecruitmentHistoryServices();
                Rec_CandidateServices CandidateServices = new Rec_CandidateServices();
                string status = string.Empty;
                string message = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repo = new Rec_InterviewCampaignDetailRepository(unitOfWork);
                var InterviewRepository = new Rec_InterviewRepository(unitOfWork);
                var InterviewCampaignDetailRepository = new Rec_InterviewCampaignDetailRepository(unitOfWork);
                List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
                var lstInterviewCampaignDetail = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
                var lstcandidateid = lstInterviewCampaignDetail.Select(s => s.CandidateID).ToList();
                var objs = new List<object>();
                string strIDs = string.Empty;
                foreach (var item in lstcandidateid)
                {
                    strIDs += Common.DotNetToOracle(item.ToString()) + ",";
                }
                if (strIDs.IndexOf(",") > 0)
                    strIDs = strIDs.Substring(0, strIDs.Length - 1);
                objs.Add(strIDs);

                var lstcandidate = service.GetData<Rec_CandidateEntity>(strIDs, ConstantSql.hrm_rec_sp_get_CandidateByIds, userLogin, ref status).ToList();
                var lstrecruimenthistory = service.GetData<Rec_RecruitmentHistoryEntity>(strIDs, ConstantSql.hrm_hr_sp_get_RecHisByCandidateIds, userLogin, ref status).ToList();
                var lstinterviewbycandidateids = service.GetData<Rec_InterviewEntity>(strIDs, ConstantSql.hrm_hr_sp_get_InterViewByCandidateIds, userLogin, ref status).ToList();


                List<Rec_InterviewEntity> lstinterview = new List<Rec_InterviewEntity>();
                List<Rec_InterviewCampaignDetail> lstAllInterviewCampaignDetail = new List<Rec_InterviewCampaignDetail>();
                var lstJobVaCancyIDs = lstcandidate.Select(s => s.JobVacancyID).ToList();
                

                string strJobVacancyIds = string.Empty;
                foreach (Guid item in lstJobVaCancyIDs)
                {
                    strJobVacancyIds += item;
                    strJobVacancyIds += ",";
                }

                if (strJobVacancyIds.Length > 0)
                {
                    strJobVacancyIds = strJobVacancyIds.Substring(0, strJobVacancyIds.Length - 1);
                }

                var lstJobVacancy = service.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(strJobVacancyIds), ConstantSql.hrm_rec_sp_get_JobVacancyByIds, userLogin, ref status).ToList();

                Rec_InterviewCampaignDetail ObjRecInterviewDt = null;


                foreach (var candidate in lstcandidate)
                {
                    ObjRecInterviewDt = new Rec_InterviewCampaignDetail();
                    Rec_InterviewEntity Interview = new Rec_InterviewEntity();
                    var hisbycandidate = lstrecruimenthistory.Where(s => s.CandidateID == candidate.ID).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    Interview.CandidateID = candidate.ID;
                    Interview.RecruitmentHistoryID = hisbycandidate.ID;

                    var interviewbycan = lstinterviewbycandidateids.Where(s => s.RecruitmentHistoryID == hisbycandidate.ID).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    int? level = 0;
                    if (interviewbycan != null && interviewbycan.LevelInterview != null)
                    {
                        level = interviewbycan.LevelInterview + 1;
                    }
                    else
                    {
                        level = 1;
                    }

                    var InterviewCampaignDetail = lstInterviewCampaignDetail.Where(s => s.RecruitmentHistoryID == hisbycandidate.ID && s.LevelInterview == null).FirstOrDefault();
                    if (InterviewCampaignDetail == null)
                    {
                        continue;
                    }
                    ObjRecInterviewDt = InterviewCampaignDetail;
                    ObjRecInterviewDt.LevelInterview = level;

                    var jobVacancybyCandidate = lstJobVacancy.Where(s => s.ID == candidate.JobVacancyID).FirstOrDefault();
                    var rechisbycandidate = lstrecruimenthistory.Where(s => s.CandidateID == candidate.ID).OrderByDescending(s => s.DateApply).FirstOrDefault();

                    // nếu là vòng phỏng vấn cuối cùng thì cập nhật lại trạng thái.
                    if (jobVacancybyCandidate != null && jobVacancybyCandidate.NoLevelInterview == level)
                    {
                        rechisbycandidate.Status = "E_PASS";
                        candidate.Status = "E_PASS";
                    }
                    candidate.LevelInterview = level;
                    rechisbycandidate.LevelInterview = level;
                    rechisbycandidate.CandidateID = candidate.ID;
                    Interview.Status = "E_PASS";
                    Interview.ResultInterview = "E_PASS";
                    Interview.LevelInterview = level;
                    lstinterview.Add(Interview);
                    lstAllInterviewCampaignDetail.Add(ObjRecInterviewDt);
                    RecruitmentHistoryServices.Edit(rechisbycandidate);
                    CandidateServices.Edit(candidate);
                }
                services.Add(lstinterview);
                InterviewCampaignDetailServices.Edit(lstAllInterviewCampaignDetail);
                InterviewRepository.SaveChanges();
                InterviewCampaignDetailRepository.SaveChanges();
                message = NotificationType.Success.ToString();
                return message;
            }
        }