Beispiel #1
0
        public ActionResult GetReportListCandidate([DataSourceRequest] DataSourceRequest request, Rec_ReportListCandidateModel model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Rec_ReportListCandidateModel>(model, "Rec_ReportListCandidateModel", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            #endregion
            var baseService = new BaseService();
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateExamFrom", Value = model.DateExamFrom == null ? DateTime.Now : model.DateExamFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateExamTo", Value = model.DateExamTo == null ? DateTime.Now : model.DateExamTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            var JobVacancyServices = new Rec_CandidateServices();
            List<object> listObj = new List<object>();
            listObj.Add(model.CodeCandidate);
            listObj.Add(model.CandidateName);
            listObj.Add(model.Gender);
            listObj.Add(model.PositionID);
            listObj.Add(model.RankID);
            listObj.Add(model.SourceAdsID);
            listObj.Add(model.Type);
            listObj.Add(model.DateExamFrom);
            listObj.Add(model.DateExamTo);
            listObj.Add(1);
            listObj.Add(int.MaxValue - 1);
            string status = string.Empty;
            var result = JobVacancyServices.GetData<Rec_ReportListCandidateEntity>(listObj, ConstantSql.hrm_rec_sp_get_ReportListCandidate, UserLogin, ref status).ToList().Translate<Rec_ReportListCandidateModel>();

            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Rec_ReportListCandidateModel(),
                    FileName = "Rec_ReportListCandidate",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                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 result)
            {
                if (lstInterView.Count > 0)
                {
                    var dataLevel1 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 1).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel2 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 2).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel3 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 3).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel4 = lstInterView.Where(s => s.CandidateID == item.ID && s.LevelInterview == 4).OrderByDescending(s => s.DateUpdate).FirstOrDefault();
                    var dataLevel5 = lstInterView.Where(s => s.CandidateID == item.ID && 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, result, listHeaderInfo, model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Beispiel #2
0
        public Rec_InterviewModel Post([Bind]Rec_InterviewModel model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Rec_InterviewModel>(model, "Rec_Interview", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion

           
            ActionService service = new ActionService(UserLogin);
            var result = service.UpdateOrCreate<Rec_InterviewEntity, Rec_InterviewModel>(model);

            var RecruitmentHisService = new Rec_RecruitmentHistoryServices();
            var candService = new Rec_CandidateServices();
            var InTerCamDetaiServices = new Rec_InterviewCampaignDetailServices();

            Rec_RecruitmentHistoryEntity ObjRecruitmentHistory = null;
            Rec_RecruitmentHistoryServices RecruitmentHistoryServices = new Rec_RecruitmentHistoryServices();

            Rec_CandidateEntity ObjCandidate = null;
            Rec_CandidateServices CandidateServices = new Rec_CandidateServices();

            Rec_InterviewCampaignDetailEntity ObjInterviewCampaignDetail = null;
            Rec_InterviewCampaignDetailServices InterviewCampaignDetailServices = new Rec_InterviewCampaignDetailServices();

            string status = string.Empty;
            #region xử lý cap nhat lich su ung vien, cap nhat ung vien
            if (result != null)
            {
                ObjRecruitmentHistory = new Rec_RecruitmentHistoryEntity();
                ObjCandidate = new Rec_CandidateEntity();
                ObjInterviewCampaignDetail = new Rec_InterviewCampaignDetailEntity();

                var IlRecruitmentHistory = RecruitmentHisService.GetData<Rec_RecruitmentHistoryEntity>(result.CandidateID, ConstantSql.hrm_rec_sp_get_RecruitmentHistoryIdByCandidateId,UserLogin, ref status).OrderByDescending(s => s.DateApply).FirstOrDefault();
                var IlCandate = candService.GetData<Rec_CandidateEntity>(result.CandidateID, ConstantSql.hrm_rec_sp_get_CandidateById, UserLogin, ref status).FirstOrDefault();
                var IlInterviewcampaugnDetail = InTerCamDetaiServices.GetData<Rec_InterviewCampaignDetailEntity>(result.CandidateID, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetailByCddId, UserLogin ,ref status).ToList();

                ObjCandidate = IlCandate;
                ObjRecruitmentHistory = IlRecruitmentHistory;
                if (IlCandate != null)
                {
                    string[] strCondition = model.ConditionTemp.Split('|').ToArray();
                    foreach (var Objitem in strCondition)
                    {
                        string[] item = Objitem.Split(',').ToArray();
                        if(item[0].ToString() == EnumDropDown.JobCondition.E_HEIGHT.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.Height = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_WEIGHT.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.Weight = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_LEVELEYES.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.LevelEye = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_LEVERIGHTLEYES.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.LevelEyeRight = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_MUSCULOSKELETAL.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.Musculoskeletal = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_BLOODPRESSURE.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.BloodPressure = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_HEARTBEAT.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.HeartBeat = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_GENARALHEALTH.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.GenaralHealth = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_DISEASELISTIDS.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.DiseaseListIDs = item[1].ToString();
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_WRITETEST.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.WriteTest = double.Parse(item[1].ToString());
                            }
                        }
                        else if (item[0].ToString() == EnumDropDown.JobCondition.E_INTERVIEW.ToString())
                        {
                            if (item[1] != null && item[1] != "")
                            {
                                ObjCandidate.Interview = double.Parse(item[1].ToString());
                            }
                        }
                    }
                    ObjCandidate.LevelInterview = result.LevelInterview;
                    if (result.ResultInterview.Equals(HRM.Infrastructure.Utilities.Interview.E_FAIL.ToString()))
                    {
                        ObjCandidate.Status = HRM.Infrastructure.Utilities.Interview.E_FAIL.ToString();
                        ObjCandidate.DateUpdate = DateTime.Now;
                    }
                    // Nếu có nhập điểm thì gán ngày đánh giá = ngày phỏng vấn
                    if (model != null && (model.Score1 != null || model.Score2 != null))
                    {
                        ObjCandidate.DateExam = model.DateInterview;
                        ObjCandidate.DateUpdate = DateTime.Now;
                    }
                    if(ObjCandidate.JobVacancyID != null)
                    {
                        var entityJobVacancy = service.GetData<Rec_JobVacancyEntity>(Common.DotNetToOracle(ObjCandidate.JobVacancyID.ToString()), ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status).FirstOrDefault();
                        if (entityJobVacancy.NoLevelInterview == result.LevelInterview && result.ResultInterview.Equals(HRM.Infrastructure.Utilities.Interview.E_PASS.ToString()))
                        {
                            if (IlCandate != null)
                            {
                                ObjCandidate.Status = HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_PASS.ToString();
                                ObjCandidate.DateUpdate = DateTime.Now;
                            }
                            if (IlRecruitmentHistory != null)
                            {
                                ObjRecruitmentHistory.Status = HRM.Infrastructure.Utilities.Interview.E_PASS.ToString();
                                ObjRecruitmentHistory.DateUpdate = DateTime.Now;
                            }
                        }
                    }
                }

                if (IlRecruitmentHistory != null)
                {
                    // Nếu có nhập điểm thì gán ngày đánh giá = ngày phỏng vấn
                    if (model != null && (model.Score1 != null || model.Score2 != null))
                    {
                        IlRecruitmentHistory.DateExam = model.DateInterview;
                    }
                    ObjRecruitmentHistory = IlRecruitmentHistory;
                    ObjRecruitmentHistory.LevelInterview = result.LevelInterview;
                    if (result.ResultInterview.Equals(HRM.Infrastructure.Utilities.Interview.E_FAIL.ToString()))
                    {
                        //cap nhat status cho lich su ung vien
                        ObjRecruitmentHistory.Status = HRM.Infrastructure.Utilities.Interview.E_FAIL.ToString();
                    }
                }

                //Cập nhật level cho intercampaigndetail
                if (IlInterviewcampaugnDetail != null)
                {
                    var ObjTemp = IlInterviewcampaugnDetail.Where(s => s.CandidateID == result.CandidateID && s.LevelInterview == null).FirstOrDefault();
                    if (ObjTemp != null)
                    {
                        ObjInterviewCampaignDetail = ObjTemp;
                        ObjInterviewCampaignDetail.LevelInterview = result.LevelInterview;
                    }
                }

                message = InterviewCampaignDetailServices.Edit(ObjInterviewCampaignDetail);
                message = RecruitmentHistoryServices.Edit(ObjRecruitmentHistory);
                message = CandidateServices.Edit(ObjCandidate);
            }
            #endregion
            return result;
        }
Beispiel #3
0
 public ActionResult UpdateReasonDenny([Bind]Rec_CandidateModel model)
 {
     IList<Rec_CandidateEntity> list = new List<Rec_CandidateEntity>();
     if (!string.IsNullOrEmpty(model.listId))
     {
         List<Guid> lisIDs = model.listId.Split(',').Select(x => Guid.Parse(x)).ToList();
         Rec_CandidateEntity ObjProfile = null;
         Rec_CandidateServices CandidateService = new Rec_CandidateServices();
         foreach (Guid item in lisIDs)
         {
             string status = string.Empty;
             ObjProfile = new Rec_CandidateEntity();
             var ResultProfile = CandidateService.GetData<Rec_CandidateEntity>(item, ConstantSql.hrm_rec_sp_get_CandidateById, UserLogin, ref status).FirstOrDefault();
             ObjProfile = ResultProfile;
             ObjProfile.StatusHire = HRM.Infrastructure.Utilities.ProfileStatusSyn.E_UNHIRE.ToString();
             ObjProfile.ReasonDeny = model.ReasonDeny;
             //ObjProfile.StatusSyn = HRM.Infrastructure.Utilities.ProfileStatusSyn.E_UNHIRE.ToString();
             CandidateService.Edit(ObjProfile);
             list.Add(ObjProfile);
         }
     }
     return Json(list);
 }