Ejemplo n.º 1
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"SupplierName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Price"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Gift"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"IsOrder"), typeof(string)));


            List <OfferUI> coll = OfferController.GetAllOfferByBidIdWithIsOrder(BidId);

            foreach (OfferUI offer in coll)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = offer.SupplierName;
                row[i++] = offer.TotalPrice;
                row[i++] = offer.Gift;
                row[i++] = GlobalStrings.GetYesNo(offer.IsOrder);
                dt.Rows.Add(row);
            }
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=OffersExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Ejemplo n.º 2
0
        protected void LoadItems()
        {
            phHasItems.Visible   = true;
            phHasNoItems.Visible = false;
            if (dgOffers.PageSize * dgOffers.CurrentPageIndex > dgOffers.VirtualItemCount)
            {
                dgOffers.CurrentPageIndex         = 0;
                hfCurrentPageIndex_dgOffers.Value = dgOffers.CurrentPageIndex.ToString();
            }
            List <OfferUI> coll = OfferController.GetAllOfferByBidIdWithIsOrder(BidId);

            BindList(coll);
        }