<%@ WebHandler Language="C#" CodeBehind="VendorStock.ashx.cs" Class="ZyckoWebsite.Services.Stock.VendorStock" %> using System; using System.Data; using System.Web; using DatabaseConnector; using SimianGroup.Extensions; using ZyckoWebsite.Functions; namespace ZyckoWebsite.Services.Stock { /// /// Summary description for VendorStock /// public class VendorStock : IHttpHandler { public void ProcessRequest( HttpContext context ) { DataTable dt = null; using (var db = new DatabaseConnection( WebsiteFunctions.GetSimianGlobalConnectionString() )) { db.AddParameter( “Vendor”, context.Request[“Vendor”] ); db.AddParameter( “ProductCategory”, context.Request[“ProductCategory”] ); dt = db.FillDataTable( “sSelectEmailStockPositionVendorStock” ); } context.Response.Clear(); context.Response.ClearContent(); context.Response.ClearHeaders(); context.Response.AddHeader( “content-disposition”, String.Format( “attachment;filename=Zycko{0}Stock.{1}.csv”, context.Request[“Vendor”], DateTime.Now.Ticks.ToString().Substring( 5 ) ) ); context.Response.ContentType = “text/csv”; context.Response.Write( dt.ToCSV() ); context.Response.End(); } public bool IsReusable { get { return false; } } } }