Ejemplo n.º 1
0
 public ActionResult ExportClaimList([DataSourceRequest] DataSourceRequest request, FIN_ClaimSearchModel model)
 {
     return ExportAllAndReturn<FIN_ClaimEntity, FIN_ClaimModel, FIN_ClaimSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_Claim);
 }
Ejemplo n.º 2
0
        public ActionResult ExportClaimByTemplate([DataSourceRequest] DataSourceRequest request, FIN_ClaimSearchModel model)
        {
            string status = string.Empty;
            var isDataTable = false;
            object obj = new FIN_ClaimItemModel();
            var lstModel = new List<FIN_ClaimItemModel>();
            request.Page = 1;
            request.PageSize = int.MaxValue - 1;
            var result = GetListData<FIN_ClaimModel, FIN_ClaimEntity, FIN_ClaimSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_Claim, ref status);
            Guid[] Ids = null;

            if (!string.IsNullOrEmpty(model.ValueFields))
            {
                Ids = model.ValueFields.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            //string _ProfileName = "";
            //string _PositionName = "";
            if (result != null)
            {
                //_ProfileName = result[0].ProfileName;
                //_PositionName = result[0].PositionName;
                var claimEntity = new FIN_ClaimModel();
                if (Ids != null)
                {
                    claimEntity = result.Where(s => Ids.Contains(s.ID)).FirstOrDefault();
                }

                var actionService = new ActionService(UserLogin);
                var objs = new List<object>();
                if (claimEntity != null)
                {
                    objs.Add(claimEntity.ID);
                    lstModel = actionService.GetData<FIN_ClaimItemModel>(objs, ConstantSql.hrm_hr_sp_get_ClaimItemByClaimID, ref status);
                }

            }
            //HeaderInfo headerInfo1 = new HeaderInfo() { Name = "ProfileName", Value = _ProfileName };
            //HeaderInfo headerInfo2 = new HeaderInfo() { Name = "PositionName", Value = _PositionName };
            //List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            if (model.IsCreateTemplateForDynamicGrid)
            {
                obj = lstModel;
                isDataTable = false;
            }
            if (model != null && model.IsCreateTemplate)
            {

                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();

                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = obj,
                    FileName = "FIN_ClaimItemModel",
                    OutPutPath = path,
                    //HeaderInfo = listHeaderInfo,
                    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, lstModel, null, model.ExportType);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }