コード例 #1
0
ファイル: Hre_GetDataController.cs プロジェクト: dtafe/vnr
        public ActionResult GetReportProfileWorking([DataSourceRequest] DataSourceRequest request, Hre_ReportProfileWorkingModel Model)
        {
            #region Validate

            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportProfileWorkingModel>(Model, "Hre_ReportProfileWorking", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }

            #endregion

            var service = new Hre_ReportServices();
            var actionServices = new ActionService(UserLogin);

            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            var isDataTable = false;
            object obj = new Hre_ReportProfileWorkingEntity();
            List<object> listObj = new List<object>();
            listObj.Add(Model.OrgStructureID);
            listObj.Add(Model.DateFrom);
            listObj.Add(Model.DateTo);
            listObj.Add(Model.CodeEmp);
            string status = string.Empty;
            var result = actionServices.GetData<Hre_ReportProfileWorkingEntity>(listObj, ConstantSql.hrm_hr_sp_get_RptWorkingProfile, ref status);

            if (Model.IsCreateTemplateForDynamicGrid)
            {
                obj = result;
                isDataTable = true;
            }
            if (Model != null && Model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "Hre_ReportProfileWorkingEntity",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (Model.ExportID != Guid.Empty)
            {

                string[] valueField = null;
                if (Model.ValueFields != null)
                {
                    valueField = Model.ValueFields.Split(',');
                }
                var fullPath = ExportService.Export(Model.ExportID, result, null, Model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
ファイル: Hre_GetDataController.cs プロジェクト: dtafe/vnr
        public ActionResult GetReportProfileWorkingValidate(Hre_ReportProfileWorkingModel model)
        {

            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_ReportProfileWorkingModel>(model, "Hre_ReportProfileWorking", ref message);
            if (!checkValidate)
            {
                var ls = new object[] { "error", message };
                return Json(ls);
            }
            #endregion
            return Json(message);
        }