// Search & Auto Post Back Handlers private void lnkExportToExcel_Click(object sender, EventArgs e) { var criteria = new OrderSearchCriteria { IsPlaced = true, StatusCode = lstStatus.SelectedValue }; if (lstPaymentStatus.SelectedValue != string.Empty) { criteria.PaymentStatus = (OrderPaymentStatus)int.Parse(lstPaymentStatus.SelectedValue); } if (lstShippingStatus.SelectedValue != string.Empty) { criteria.ShippingStatus = (OrderShippingStatus)int.Parse(lstShippingStatus.SelectedValue); } criteria.StartDateUtc = DateRangePicker1.StartDate.ToUniversalTime(); criteria.EndDateUtc = DateRangePicker1.EndDate.ToUniversalTime(); criteria.Keyword = FilterField.Text.Trim(); criteria.SortDescending = chkNewestFirst.Checked; criteria.IsIncludeCanceledOrder = true; var pageSize = int.MaxValue; var totalCount = 0; var orders = HccApp.OrderServices.Orders.FindByCriteriaPaged(criteria, 1, pageSize, ref totalCount); var ordersExport = new OrdersExport(HccApp); ordersExport.ExportToExcel(Response, "Hotcakes_Orders.xlsx", orders); }
private void GenerateExcelFile(List <OrderSnapshot> orders) { var oExport = new OrdersExport(HccApp); oExport.ExportToExcel(Response, "Hotcakes_Orders.xlsx", orders.Where(o => o.OrderNumber != "DayTotal" && o.OrderNumber != "MonthTotal").ToList()); }