Beispiel #1
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson, string keyValue)
        {
            var watch    = CommonHelper.TimerStart();
            var data     = paydetailbll.GetPageListToTable(pagination, queryJson, keyValue);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
Beispiel #2
0
        /// <summary>
        /// 导出数据
        /// </summary>
        public ActionResult ExportCashData_New(string keyValue)
        {
            //获取数据
            PaydetailBLL paydetailbll = new PaydetailBLL();

            DataTable dt_list = paydetailbll.GetPageListToTable(null, null, keyValue);

            //设置导出格式
            ExcelConfig excelconfig = new ExcelConfig();

            excelconfig.Title           = "薪资明细";
            excelconfig.TitleFont       = "微软雅黑";
            excelconfig.TitlePoint      = 25;
            excelconfig.FileName        = DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
            excelconfig.IsAllSizeColumn = true;
            excelconfig.ColumnEntity    = new System.Collections.Generic.List <ColumnEntity>();
            excelconfig.ColumnEntity.Add(new ColumnEntity()
            {
                ExcelColumn = "员工编号", Column = "empid", Width = 10, Alignment = "right"
            });
            excelconfig.ColumnEntity.Add(new ColumnEntity()
            {
                ExcelColumn = "姓名", Column = "empname", Width = 10
            });
            excelconfig.ColumnEntity.Add(new ColumnEntity()
            {
                ExcelColumn = "部门", Column = "deptname", Width = 14
            });

            for (int i = 0; i < dt_list.Columns.Count; i++)
            {
                if (i > 4)
                {
                    excelconfig.ColumnEntity.Add(new ColumnEntity()
                    {
                        ExcelColumn = dt_list.Columns[i].ColumnName, Column = dt_list.Columns[i].ColumnName, Width = 10, Alignment = "right"
                    });
                }
            }

            ExcelHelper.ExcelDownload(dt_list, excelconfig);

            return(Success("导出成功!"));
        }