protected void LinkButton1_Click(object sender, EventArgs e) { int empId = Convert.ToInt32(Session["receptionistId"].ToString()); string appointmentToken = Label3.Text; string appointmentDate = TextBox1.Text; string appointmentTime = TextBox2.Text; GetDoctorNameByAppointmentTokenBL objGetDoctorNameByAppointmentTokenBL = new GetDoctorNameByAppointmentTokenBL(); string doctorName = objGetDoctorNameByAppointmentTokenBL.GetDoctorNameByAppointmentToken(Label3.Text); AddAppointmentInvoiceBL objAddAppointmentInvoiceBL = new AddAppointmentInvoiceBL(); string invoiceId = objAddAppointmentInvoiceBL.AddAppointmentInvoice(empId, appointmentToken); PrintAppointmentInvoiceBL objPrintAppointmentInvoiceBL = new PrintAppointmentInvoiceBL(); byte[] file = objPrintAppointmentInvoiceBL.PrintAppointmentInvoice(invoiceId, appointmentToken, doctorName, appointmentDate, appointmentTime); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=AppointmentInvoice.pdf"); Response.ContentType = "application/pdf"; Response.Buffer = true; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(file); Response.End(); Response.Close(); }
protected void LinkButton1_Click(object sender, EventArgs e) { string appointmentToken = Session["appointmentToken"].ToString(); AddAppointmentInvoiceBL objAddAppointmentInvoiceBL = new AddAppointmentInvoiceBL(); string invoiceId = objAddAppointmentInvoiceBL.AddAppointmentInvoice(Convert.ToInt32(Session["receptionistId"].ToString()), appointmentToken); string appointmentDate = DateTime.ParseExact(TextBox2.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString(); string appointmentTime = TextBox3.Text; string doctorName = DropDownList2.SelectedItem.Text; PrintAppointmentInvoiceBL objPrintAppointmentInvoiceBL = new PrintAppointmentInvoiceBL(); byte[] file = objPrintAppointmentInvoiceBL.PrintAppointmentInvoice(invoiceId, appointmentToken, doctorName, appointmentDate, appointmentTime); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename=AppointmentInvoice.pdf"); Response.ContentType = "application/pdf"; Response.Buffer = true; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(file); Response.End(); Response.Close(); }