Exemple #1
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     CustomerReport rpt = new CustomerReport();
     rpt.Site = this.Site;
     return rpt;
 }
Exemple #2
0
		protected void buttonPreviewCus_Click(object sender, System.EventArgs e) {
			try {
				DatasetCustomer dsCustomer = new DatasetCustomer();
				dsCustomer.EnforceConstraints = false;
				dsCustomer.Customer.Clear();
				DatasetCustomer.CustomerRow cus = dsCustomer.Customer.NewCustomerRow();
				cus.c_Isdn = textPhone.Text;
				cus.c_Name = textCusFName.Text;
				cus.c_LName = textCusLName.Text;
				cus.c_Sex = comboCusSex.SelectedValue;
				cus.c_Id1 = textCusId1.Text;
				cus.c_Id2 = textCusId2.Text;
				cus.c_Id3 = textCusId3.Text;
				cus.c_Phone = textCusPhone.Text;
				cus.c_Email = textCusEmail.Text;
				cus.c_Job = comboCusProf.SelectedValue;
				cus.c_Industry = comboCusIndustry.SelectedValue;
				cus.c_City = comboCusCity.SelectedValue;
				cus.c_District = comboCusDistrict.SelectedValue;
				cus.c_Address = textCusAddr.Text;
				cus.c_Date = Convert.ToDateTime(labelCusDate.Text);

				dsCustomer.Customer.AddCustomerRow(cus);

				CustomerReport reportCus = new CustomerReport();
				reportCus.SetDataSource(dsCustomer);

				string fileName = string.Format("c:\\temp\\{0}{1:yyyyMMddHHmmss}.pdf", Session.SessionID, DateTime.Now);
				reportCus.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, fileName);

				Response.ClearContent();
				Response.ClearHeaders();
				Response.ContentType = "application/pdf";
				Response.WriteFile(fileName);
				Response.Flush();
				Response.Close();
				System.IO.File.Delete(fileName);
			} 			
			catch {					
			}
		}