public ActionResult GetPageListJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); var queryParam = queryJson.ToJObject(); ArrivalEntity para = new ArrivalEntity(); if (!queryParam["keyword"].IsEmpty()) { para.KeyWord = queryParam["keyword"].ToString(); } var pageList = ArrivalBLL.Instance.GetPageList(para, ref pagination); var JsonData = new { rows = pageList, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(Content(JsonData.ToJson())); }
public ActionResult SaveForm(string keyValue, ArrivalEntity entity) { try { if (keyValue == "") { //新增 entity.ArrivalId = Util.Util.NewUpperGuid(); ArrivalBLL.Instance.Add(entity); } else { entity.ArrivalId = keyValue; ArrivalBLL.Instance.Update(entity); } return(Success("操作成功。")); } catch (Exception ex) { return(Error("操作失败。")); } }
/// <summary> /// 导出EXCEL /// </summary> public void ExportExcel(string queryJson) { string cacheKey = Request["cacheid"] as string; HttpRuntime.Cache[cacheKey + "-state"] = "processing"; HttpRuntime.Cache[cacheKey + "-row"] = "0"; try { //这里要url解码 var queryParam = Server.UrlDecode(queryJson).ToJObject(); var para = new ArrivalEntity(); if (!queryParam["keyword"].IsEmpty()) { para.KeyWord = queryParam["keyword"].ToString(); } var list = ArrivalBLL.Instance.GetList(para); foreach (var item in list) { if (item.ArrivalStatus != null) { item.ArrivalStatusName = ((Trade.Model.Enums.ArrivalStatus)item.ArrivalStatus).ToString(); } } //设置导出格式 ExcelConfig excelconfig = new ExcelConfig(); excelconfig.Title = "到货列表信息"; excelconfig.TitleFont = "微软雅黑"; excelconfig.TitlePoint = 10; excelconfig.FileName = "到货列表信息.xls"; excelconfig.IsAllSizeColumn = true; //每一列的设置,没有设置的列信息,系统将按datatable中的列名导出 List <ColumnEntity> listColumnEntity = new List <ColumnEntity>(); excelconfig.ColumnEntity = listColumnEntity; ColumnEntity columnentity = new ColumnEntity(); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "BillCode", ExcelColumn = "订单号", Width = 20 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "Title", ExcelColumn = "标题", Width = 15 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "ArrivalStatusName", ExcelColumn = "到货状态", Width = 20 }); excelconfig.ColumnEntity.Add(new ColumnEntity() { Column = "Remark", ExcelColumn = "备注", Width = 50 }); //需合并索引 //excelconfig.MergeRangeIndexArr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; //调用导出方法 ExcelHelper <ArrivalEntity> .ExcelDownload(list, excelconfig); HttpRuntime.Cache[cacheKey + "-state"] = "done"; } catch (Exception ex) { HttpRuntime.Cache[cacheKey + "-state"] = "error"; } }