Exemple #1
0
        public ActionResult GetReportHCSeniority([DataSourceRequest] DataSourceRequest request, Hre_ReportHCSeniorityModel model)
        {
            var service = new Hre_ReportServices();
            var hrService = new Hre_ProfileServices();

            object obj = new Hre_ReportHCSeniorityModel();
            var isDataTable = false;
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = DateTime.Now };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };

            var result = service.GetReportHCSeniority(model.MonthSearch, model.JobtitleID, model.OrgStructureID, model.OrgStructureTypeID, model.isIncludeQuitEmp, model.IsCreateTemplate, UserLogin);

            if (model.IsCreateTemplateForDynamicGrid)
            {
                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);
                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_ReportHCSeniorityModel",
                    OutPutPath = path,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }


            if (model.ExportID != Guid.Empty)
            {
                result.Rows[0].Delete();
                //var row = result.Rows.Count;
                //result.Rows[row - 1].Delete();

                var col = result.Columns.Count;
                result.Columns.RemoveAt(col - 1);

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

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

        }