예제 #1
0
        public ActionResult GetJobVacancyByID(string JobVacancyID)
        {
            string status = string.Empty;
            var profileID = Guid.Empty;
            if (JobVacancyID.IndexOf(',') > 0)
            {
                return null;
            }
            if (!string.IsNullOrEmpty(JobVacancyID))
            {
                profileID = Common.ConvertToGuid(JobVacancyID);
            }

            var profileServices = new Rec_JobVacancyServices();
            ActionService service = new ActionService(UserLogin);
            var jobVacancy = profileServices.GetData<Rec_JobVacancyEntity>(profileID, ConstantSql.hrm_rec_sp_get_JobVacancyId, UserLogin, ref status).FirstOrDefault();

            if (jobVacancy != null)
            {
                return Json(jobVacancy, JsonRequestBehavior.AllowGet);
            }
            return null;
        }
예제 #2
0
        public ActionResult GetReportJobVacancy([DataSourceRequest] DataSourceRequest request, Rec_ReportJobVacancySearchModel model)
        {
            #region Validate
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateStart", Value = model.DateStart };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateEnd", Value = model.DateEnd };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Rec_ReportJobVacancySearchModel>(model, "Rec_ReportJobVacancySearch", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            #endregion

            var JobVacancyServices = new Rec_JobVacancyServices();
            List<object> listObj = new List<object>();

            listObj.Add(model.OrgStructureID);
            listObj.Add(model.DateStart);
            listObj.Add(model.DateEnd);
            listObj.Add(model.RankID);
            listObj.Add(model.Type);
            string status = string.Empty;
            var result = JobVacancyServices.GetData<Rec_JobVacancyEntity>(listObj, ConstantSql.hrm_rec_sp_get_ReportJobVacancy, UserLogin, ref status).ToList().Translate<Rec_JobVacancyModel>();
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Rec_JobVacancyModel(),
                    FileName = "Rec_ReportJobVacancy",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, result, listHeaderInfo, model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }