Пример #1
0
        public ActionResult ExportAllInterviewDetailListNew([DataSourceRequest] DataSourceRequest request, Rec_InterviewCampaignDetailSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<object> objshis = new List<object>();
            List<Rec_InterviewCampaignDetailModel> resultInterviewCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();
            var InterviewServices = new Rec_InterviewCampaignDetailServices();

            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = baseService.GetData<Rec_InterviewCampaignDetailModel>(lstModel, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);
            if (result != null)
            {
                var InTerCamDetaiServices = new Rec_InterviewCampaignDetailServices();
                var HistoryServices = new Rec_RecruitmentHistoryServices();
                var lstCandidateIDS = result.Select(s => s.CandidateID).Distinct().ToList();
                //string temp = string.Empty;
                //foreach (Guid item in lstCandidateIDS)
                //{
                //    temp += item;
                //    temp += ",";
                //}
                //if (temp.Length > 0)
                //{
                //    temp = temp.Substring(0, temp.Length - 1);
                //}

               // var lstCandidateHistory = HistoryServices.GetData<Rec_RecruitmentHistoryEntity>(Common.DotNetToOracle(temp), ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                var lstCandidateHistory = new List<Rec_RecruitmentHistoryEntity>();
                int _total = lstCandidateIDS.Count;
                int _totalPage = _total / 100 + 1;
                int _pageSize = 100;
                for (int _page = 1; _page <= _totalPage; _page++)
                {
                    int _skip = _pageSize * (_page - 1);
                    var _listCurrenPage = lstCandidateIDS.Skip(_skip).Take(_pageSize).ToList();
                    string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));

                    var lstRecruitmentHistory = baseService.GetData<Rec_RecruitmentHistoryEntity>(_strselectedIDs, ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                    if (lstRecruitmentHistory != null && lstRecruitmentHistory.Count > 0)
                    {
                        lstCandidateHistory.AddRange(lstRecruitmentHistory);
                    }
                }
                foreach (var item in result)
                {
                    //var IlInterviewcampaugnDetail = result.Where(s => s.CandidateID == item.CandidateID).ToList();
                    var ObjHisCandidate = lstCandidateHistory.Where(s => s.ID == item.RecruitmentHistoryID).FirstOrDefault();
                    if (ObjHisCandidate == null)
                    {
                        continue;
                    }
                    Rec_JobVacancyEntity entityJobVacancy = null;
                    if (ObjHisCandidate != null && ObjHisCandidate.JobVacancyID != Guid.Empty && ObjHisCandidate.JobVacancyID != null)
                    {
                        entityJobVacancy = service.GetByIdUseStore<Rec_JobVacancyEntity>(ObjHisCandidate.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    }
                    if (entityJobVacancy != null)
                    {
                        if (item.LevelInterview != null && item.LevelInterview == entityJobVacancy.NoLevelInterview)
                        {
                            continue;
                        }
                    }
                    if (item.LevelInterview == null && (ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_PASS.ToString()
                     && ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString()
                        ))
                    {
                        if (ObjHisCandidate != null)
                        {
                            if (ObjHisCandidate.LevelInterview == null)
                            {
                                item.LevelInterview = 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                            else
                            {
                                item.LevelInterview = ObjHisCandidate.LevelInterview + 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                        }
                    }
                }
            }
            resultInterviewCampaignDetail = resultInterviewCampaignDetail.Distinct().ToList();
            if (status == NotificationType.Success.ToString())
            {
                status = ExportService.Export(resultInterviewCampaignDetail, model.GetPropertyValue("ValueFields").TryGetValue<string>().Split(','));
            }
            return Json(status);

        }
Пример #2
0
 public ActionResult GetIntervieCampaignDetailValidate(Rec_InterviewCampaignDetailSearchModel Model)
 {
     #region Validate
     string message = string.Empty;
     var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Rec_InterviewCampaignDetailSearchModel>(Model, "Rec_InterviewCampaignDetail", ref message);
     if (!checkValidate)
     {
         var ls = new object[] { "error", message };
         return Json(ls);
     }
     #endregion
     return Json(message);
 }
Пример #3
0
        public ActionResult GetIntervieCampaignDetailList([DataSourceRequest] DataSourceRequest request, Rec_InterviewCampaignDetailSearchModel model)
        {
            List<Rec_InterviewCampaignDetailModel> resultInterviewCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();

            string status = string.Empty;
            var baseService = new BaseService();
            var actionService = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<object> objshis = new List<object>();

            var InterviewServices = new Rec_InterviewCampaignDetailServices();

            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            int? level = (model != null && model.LevelInterview != 0) ? model.LevelInterview : null;
            List<object> lstModels = new List<object>();
            lstModels.AddRange(new object[16]);
            lstModels[0] = model.CandidateName;
            lstModels[1] = model.DateFrom;
            lstModels[2] = model.DateTo;
            lstModels[3] = model.CodeCandidate;
            lstModels[4] = model.RankID;
            lstModels[5] = model.OrgStructureID;
            lstModels[6] = model.JobVacancyID;
            lstModels[7] = model.PositionID;
            lstModels[8] = level;
            lstModels[13] = model.WorkPlaceID;
            lstModels[14] = 1;
            lstModels[15] = Int32.MaxValue - 1;

            var result = actionService.GetData<Rec_InterviewCampaignDetailModel>(lstModels, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, ref status);
            #region Load Chi tiet ke hoach chua phong van
            if (result != null)
            {
                var InTerCamDetaiServices = new Rec_InterviewCampaignDetailServices();
                var HistoryServices = new Rec_RecruitmentHistoryServices();
                var lstCandidateIDS = result.Select(s => s.CandidateID).Distinct().ToList();

                var lstCandidateHistory = new List<Rec_RecruitmentHistoryEntity>();
                int _total = lstCandidateIDS.Count;
                int _totalPage = _total / 100 + 1;
                int _pageSize = 100;
                for (int _page = 1; _page <= _totalPage; _page++)
                {
                    int _skip = _pageSize * (_page - 1);
                    var _listCurrenPage = lstCandidateIDS.Skip(_skip).Take(_pageSize).ToList();
                    string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));

                    var lstRecruitmentHistory = baseService.GetData<Rec_RecruitmentHistoryEntity>(_strselectedIDs, ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                    if (lstRecruitmentHistory != null && lstRecruitmentHistory.Count > 0)
                    {
                        lstCandidateHistory.AddRange(lstRecruitmentHistory);
                    }
                }

                foreach (var item in result)
                {
                    bool IsAdd = false;
                    //var IlInterviewcampaugnDetail = result.Where(s => s.CandidateID == item.CandidateID).ToList();
                    var ObjHisCandidate = lstCandidateHistory.Where(s => s.ID == item.RecruitmentHistoryID).FirstOrDefault();
                    if (ObjHisCandidate == null)
                    {
                        continue;
                    }
                    if (item.LevelInterview == null)
                    {
                        IsAdd = true;
                    }

                    Rec_JobVacancyEntity entityJobVacancy = null;
                    if (ObjHisCandidate != null && ObjHisCandidate.JobVacancyID != Guid.Empty && ObjHisCandidate.JobVacancyID != null)
                    {
                        entityJobVacancy = actionService.GetByIdUseStore<Rec_JobVacancyEntity>(ObjHisCandidate.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    }
                    if (entityJobVacancy != null)
                    {
                        if (item.LevelInterview != null && item.LevelInterview == entityJobVacancy.NoLevelInterview)
                        {
                            continue;
                        }
                    }
                    if (item.LevelInterview == null && (ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_PASS.ToString()
                     && ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString()
                        ))
                    {
                        if (ObjHisCandidate != null)
                        {
                            if (ObjHisCandidate.LevelInterview == null)
                            {
                                item.LevelInterview = 1;
                            }
                            else
                            {
                                item.LevelInterview = ObjHisCandidate.LevelInterview + 1;
                            }

                            if (IsAdd == true)
                            {
                                resultInterviewCampaignDetail.Add(item);
                            }
                        }
                    }
                }
            }
            resultInterviewCampaignDetail = resultInterviewCampaignDetail.Distinct().ToList();
            #endregion

            var isDataTable = false;
            object obj = new Rec_InterviewCampaignDetailModel();
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = resultInterviewCampaignDetail;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

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

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Rec_InterviewCampaignDetailModel",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    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();


            if (model.ExportId != Guid.Empty)
            {
                foreach (var item in resultInterviewCampaignDetail)
                {
                    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;
                    }
                }
                var fullPath = ExportService.Export(model.ExportId, resultInterviewCampaignDetail, listHeaderInfo, model.ExportType);
                return Json(fullPath);
            }

            // return Json(resultInterviewCampaignDetail.ToDataSourceResult(request));
            return Json(resultInterviewCampaignDetail.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
            //var result = GetListDataAndReturn<Rec_InterviewCampaignDetailModel, Rec_InterviewCampaignDetailEntity, Rec_InterviewCampaignDetailSearchModel>(request, model, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail);
            //return result;
        }
Пример #4
0
        public ActionResult ExportIntervieCampaignDetaiByTemplate([DataSourceRequest] DataSourceRequest request, Rec_InterviewCampaignDetailSearchModel model)
        {
            string status = string.Empty;
            var baseService = new BaseService();
            ActionService service = new ActionService(UserLogin);
            List<object> objs = new List<object>();
            List<object> objshis = new List<object>();
            List<Rec_InterviewCampaignDetailModel> resultInterviewCampaignDetail = new List<Rec_InterviewCampaignDetailModel>();
            var InterviewServices = new Rec_InterviewCampaignDetailServices();

            ListQueryModel lstModel = new ListQueryModel
            {
                PageSize = int.MaxValue - 1,
                PageIndex = 1,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request),
                AdvanceFilters = ExtractAdvanceFilterAttributes(model)
            };
            var result = baseService.GetData<Rec_InterviewCampaignDetailModel>(lstModel, ConstantSql.hrm_rec_sp_get_InterviewCampaignDetail, UserLogin, ref status);
            #region Load Chi tiet ke hoach chua phong van
            if (result != null)
            {
                var InTerCamDetaiServices = new Rec_InterviewCampaignDetailServices();
                var HistoryServices = new Rec_RecruitmentHistoryServices();
                var lstCandidateIDS = result.Select(s => s.CandidateID).Distinct().ToList();
                string temp = string.Empty;
                foreach (Guid item in lstCandidateIDS)
                {
                    temp += item;
                    temp += ",";
                }
                if (temp.Length > 0)
                {
                    temp = temp.Substring(0, temp.Length - 1);
                }
                var lstCandidateHistory = HistoryServices.GetData<Rec_RecruitmentHistoryEntity>(Common.DotNetToOracle(temp), ConstantSql.hrm_rec_sp_get_RecHisByListCandidateID, UserLogin, ref status).ToList();
                foreach (var item in result)
                {
                    //var IlInterviewcampaugnDetail = result.Where(s => s.CandidateID == item.CandidateID).ToList();
                    var ObjHisCandidate = lstCandidateHistory.Where(s => s.ID == item.RecruitmentHistoryID).FirstOrDefault();
                    if (ObjHisCandidate == null)
                    {
                        continue;
                    }
                    Rec_JobVacancyEntity entityJobVacancy = null;
                    if (ObjHisCandidate != null && ObjHisCandidate.JobVacancyID != Guid.Empty && ObjHisCandidate.JobVacancyID != null)
                    {
                        entityJobVacancy = service.GetByIdUseStore<Rec_JobVacancyEntity>(ObjHisCandidate.JobVacancyID.Value, ConstantSql.hrm_rec_sp_get_JobVacancyId, ref status);
                    }
                    if (entityJobVacancy != null)
                    {
                        if (item.LevelInterview != null && item.LevelInterview == entityJobVacancy.NoLevelInterview)
                        {
                            continue;
                        }
                    }
                    if (item.LevelInterview == null && (ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_PASS.ToString()
                     && ObjHisCandidate.Status != HRM.Infrastructure.Utilities.EnumDropDown.CandidateStatus.E_FAIL.ToString()
                        ))
                    {
                        if (ObjHisCandidate != null)
                        {
                            if (ObjHisCandidate.LevelInterview == null)
                            {
                                item.LevelInterview = 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                            else
                            {
                                item.LevelInterview = ObjHisCandidate.LevelInterview + 1;
                                resultInterviewCampaignDetail.Add(item);
                            }
                        }
                    }
                }
            }
            resultInterviewCampaignDetail = resultInterviewCampaignDetail.Distinct().ToList();
            #endregion

            var isDataTable = false;
            object obj = new Rec_InterviewCampaignDetailModel();
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = resultInterviewCampaignDetail;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

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

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

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

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

            return Json(resultInterviewCampaignDetail.ToDataSourceResult(request));
        }