Example #1
0
        public ActionResult GetReportMonthlyHC([DataSourceRequest] DataSourceRequest request, Hre_ReportMonthlyHCModel model)
        {
            var service = new Hre_ReportServices();
            var hrService = new Hre_ProfileServices();
            object obj = new Hre_ReportMonthlyHCModel();
            var isDataTable = false;
            //List<object> listObj = new List<object>();
            //listObj.Add(model.OrgStructureID);
            //listObj.Add(string.Empty);
            //listObj.Add(string.Empty);

            //string status = string.Empty;

            //var listEntity = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, ref status).Select(s => s.ID).ToList();

            var result = service.GetReportMonthlyHC(model.dateSearch, model.JobtitleID, model.OrgStructureID, model.OrgStructureTypeID, model.IsCreateTemplate, UserLogin);
            var rs = result.Translate<Hre_ReportMonthlyHCModel>();

            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_ReportMonthlyHCModel",
                    OutPutPath = path,
                    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, result, null, model.ExportType);

                return Json(fullPath);
            }
            //0string dataReturn = result.ConvertDataTabletoString();
            return Json(rs.ToDataSourceResult(request));
        }
Example #2
0
        public ActionResult GetReportMonthlyHCValidate(Hre_ReportMonthlyHCModel model)
        {
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Hre_ReportMonthlyHCModel>(model, "Hre_ReportMonthlyHC", ref message);
            if (!checkValidate)
            {
                var ls = new object[] { "error", message };
                return Json(ls);
                //return Json(message);
            }
            #endregion
            return Json(message);

        }