コード例 #1
0
        void btnExportToCSV_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                int identityID = 0;
                int.TryParse(cboSubContractor.SelectedValue, out identityID);
                DateTime startDate = dteStartDate.SelectedDate.Value;
                startDate = startDate.Subtract(startDate.TimeOfDay);
                DateTime endDate = dteEndDate.SelectedDate.Value;
                endDate = endDate.Subtract(endDate.TimeOfDay);
                endDate = endDate.Add(new TimeSpan(23, 59, 59));

                Facade.IJobSubContractor facJobSubcontractor = new Facade.Job();
                DataSet dsSubContractedHistory;

                dsSubContractedHistory = facJobSubcontractor.GetSubContractedHistoryCSV(identityID, startDate, endDate);

                Session["__ExportDS"] = dsSubContractedHistory.Tables[0];

                Server.Transfer("../Reports/csvexport.aspx?filename=SubContractedHistoryExport.csv");
            }
        }