コード例 #1
0
        public void DownloadAttachment(HttpContext context, int id)
        {
            FuelOrderInvoices invoice = new FuelOrderInvoices();

            invoice.Id = id;
            invoice.GetAttachmentFile();
            DownloadFileFromBinary(context, invoice.ContentType, invoice.InvoiceName, invoice.InvoiceData);
        }
コード例 #2
0
        public FuelOrderInvoices GetAttachmentFile()
        {
            FuelOrderInvoices   fileInfo   = new FuelOrderInvoices();
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@Id", Id));
            using (SqlDataReader reader = ExecutionHelper.ExecuteReader("up_Select_FuelOrderInvoice", parameters))
            {
                if (ConnectionHelper.IsReadingOneRowSuccessful(reader))
                {
                    fileInfo.ContentType = reader["ContentType"].ToString();
                    fileInfo.InvoiceData = (byte[])reader["InvoiceData"];
                    SetProperties(reader);
                }
            }
            return(fileInfo);
        }