public ActionResult GetOrders(OrderSearch condition) { string where = OrderSearch.StrWhere(condition); PageJsonModel <OrderShowVM> page = new PageJsonModel <OrderShowVM>(); page.pageIndex = condition.pageIndex; page.strForm = @" [Order] left join C_User on [Order].UserName=C_User.UserName "; page.strSelect = " [Order].*,C_User.Name C_User_Name,(select C_UserType.Name from C_UserType where C_UserType.Lever= C_User.C_UserTypeID) C_UserTypeName "; page.pageSize = condition.pageSize; page.strWhere = string.Format(" and [Order].ParentUser='' ") + where; if (string.IsNullOrWhiteSpace(condition.orderby) == false) { page.strOrder = Common.FilteSQLStr(condition.orderby); } else { page.strOrder = " [Order].ID Desc"; } page.LoadList(); return(Json(page.pageResponse, JsonRequestBehavior.AllowGet)); }
public ActionResult ExportExcel(OrderSearch condition) { StringBuilder where = new StringBuilder(); string[] field = { "OrderNo", "OrderName", "SumPrice", "OrderMan", "OrderMobile", "Remark" }; string[] list = { "订单编号", "订单名称", "订单金额", "收货人", "电话", "备注" }; string url = "/OrderManage/Orders"; exportHelper exhelper = exportHelper.getexport(field, list, url, CurrentUser.UserName); where.Append(string.Format("select {0} from [Order] where 1=1 ", string.Join(",", exhelper.field))); list = exhelper.list; where.Append(OrderSearch.StrWhere(condition)); DataTable dt = ExportWay.ExcelDataTable(where.ToString()); return(File(ExportWay.GetExcel(dt, list), "application/vnd.ms-excel", "订单" + DateTime.Now.ToShortTimeString() + ".xls")); }