Пример #1
0
        public ActionResult GetReportHDTJobOut([DataSourceRequest] DataSourceRequest request, Hre_ReportHDTJobOutSearchModel Model)
        {
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = Model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo2 };

            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_HDTJobModel(),
                    FileName = "Hre_HDTJob",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }
            #region Validate
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportHDTJobOutSearchModel>(Model, "Hre_ReportHDTJobOut", ref message);
            if (!checkValidate)
            {
                return Json(message, JsonRequestBehavior.AllowGet);
            }
            #endregion
            var ReportServices = new Hre_ReportServices();
            var result = ReportServices.GetReportHDTJobOut(Model.DateTo, Model.OrgStructureID, Model.WorkPlaceID, Model.ProfileName, Model.CodeEmp, UserLogin).Translate<Hre_HDTJobModel>();

            if (Model.ExportId != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportId, result, listHeaderInfo, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }