예제 #1
0
        public ActionResult ExportCashAdvanceByTemplate([DataSourceRequest] DataSourceRequest request, FIN_CashAdvanceSearchModel model)
        {
            string status = string.Empty;
            var isDataTable = false;
            object obj = new FIN_CashAdvanceItemModel();
            var lstModel = new List<FIN_CashAdvanceItemModel>();
            request.Page = 1;
            request.PageSize = int.MaxValue - 1;
            Guid[] Ids = null;
            if (!string.IsNullOrEmpty(model.ValueFields))
            {
                Ids = model.ValueFields.Split(',').Select(s => Guid.Parse(s)).ToArray();
            }
            var result = GetListData<FIN_CashAdvanceModel, Fin_CashAdvanceEntity, FIN_CashAdvanceSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_CashAdvance, ref status);
            //string _ProfileName="";
            //string _PositionName="";
            if (result != null)
            {
                //_ProfileName = result[0].ProfileName;
                //_PositionName = result[0].PositionName;
                var cashEntity = new FIN_CashAdvanceModel();
                if (Ids != null)
                {
                    cashEntity = result.Where(s => Ids.Contains(s.ID)).FirstOrDefault();
                }
                var actionService = new ActionService(UserLogin);
                var objs = new List<object>();

                if (cashEntity != null)
                {
                    objs.Add(cashEntity.ID);

                    lstModel = actionService.GetData<FIN_CashAdvanceItemModel>(objs, ConstantSql.hrm_hr_sp_get_CashAdvanceItemByCashAdvanceID, ref status);
                }
                //objs.Add(Common.DotNetToOracle(CashAdvanceID.ToString()));

            }
            //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_CashAdvanceItemModel",
                    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));
        }
예제 #2
0
 public ActionResult GetCashAdvanceList([DataSourceRequest] DataSourceRequest request, FIN_CashAdvanceSearchModel model)
 {
     return GetListDataAndReturn<FIN_CashAdvanceModel, Fin_CashAdvanceEntity, FIN_CashAdvanceSearchModel>(request, model, ConstantSql.hrm_hr_sp_get_CashAdvance);
 }