protected void LinkButton1_Click(object sender, EventArgs e)
    {
        string patientName = Label4.Text;
        string patientId = Label2.Text;
        int empId = Convert.ToInt32(Session["receptionistId"].ToString());
        int ipdId = Convert.ToInt32(Session["ipdId"].ToString());
        AddIpdRegistrationReportBL objAddIpdRegistrationReportBL = new AddIpdRegistrationReportBL();
        string reportId = objAddIpdRegistrationReportBL.AddIpdRegistrationReport(empId, ipdId);

        string patientGeneralHealth = RadioButtonList2.SelectedItem.Text;
        string patientRegularMedications = TextBox1.Text;
        string patientAllergyStatus = RadioButtonList1.SelectedItem.Text;
        string patientAllergies = "NA";
        if(patientAllergyStatus == "Yes")
            patientAllergies = TextBox2.Text;
        string patientPastSurgeryStatus = RadioButtonList5.SelectedItem.Text;
        string patientSurgery1 = "NA";
        string patientSurgery1Date = "NA";
        string patientSurgery2 = "NA";
        string patientSurgery2Date = "NA";
        string patientSurgery3 = "NA";
        string patientSurgery3Date = "NA";
        if(patientPastSurgeryStatus == "Yes")
        {
            patientSurgery1 = TextBox3.Text;
            patientSurgery1Date = TextBox4.Text;
            patientSurgery2 = TextBox5.Text;
            patientSurgery2Date = TextBox6.Text;
            patientSurgery3 = TextBox7.Text;
            patientSurgery3Date = TextBox8.Text;
        }
        string patientMedicalInsuranceStatus = RadioButtonList3.SelectedItem.Text;
        string patientMedicalInsuranceProvider = "NA";
        string patientMedicalInsurancePolicyNumber = "NA";
        if(patientMedicalInsuranceStatus == "Yes")
        {
            patientMedicalInsuranceProvider = TextBox15.Text;
            patientMedicalInsurancePolicyNumber = TextBox16.Text;
        }
        string patientHeight = TextBox9.Text;
        string patientWeight = TextBox10.Text;
        string patientAttendingDoctor = DropDownList2.SelectedItem.Text;
        string patientAdmissionWard = DropDownList3.SelectedItem.Text;
        string patientWardNumber = DropDownList5.SelectedItem.Text;
        string patientDateOfAdmit = TextBox18.Text;
        string patientTimeOfAdmit = TextBox19.Text;
        string patientRemark = TextBox17.Text;

        PrintIPDRegistrationReportBL objPrintIPDRegistrationReportBL = new PrintIPDRegistrationReportBL();
        byte[] file = objPrintIPDRegistrationReportBL.PrintIPDRegistrationReport(reportId,
            patientName, patientId, patientGeneralHealth, patientRegularMedications,
            patientAllergyStatus, patientAllergies, patientPastSurgeryStatus, patientSurgery1,
            patientSurgery1Date, patientSurgery2, patientSurgery2Date, patientSurgery3,
            patientSurgery3Date, patientMedicalInsuranceStatus, patientMedicalInsuranceProvider,
            patientMedicalInsurancePolicyNumber, patientHeight, patientWeight,
            patientAttendingDoctor, patientAdmissionWard, patientWardNumber, patientDateOfAdmit,
            patientTimeOfAdmit, patientRemark);
        Response.Clear();
        Response.ContentType = "application/pdf";
        Response.AddHeader("Content-Disposition", "attachment; filename=IPDRegistrationReport.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 patientName = Label4.Text;
        string patientId   = Label2.Text;
        int    empId       = Convert.ToInt32(Session["receptionistId"].ToString());
        int    ipdId       = Convert.ToInt32(Session["ipdId"].ToString());
        AddIpdRegistrationReportBL objAddIpdRegistrationReportBL = new AddIpdRegistrationReportBL();
        string reportId = objAddIpdRegistrationReportBL.AddIpdRegistrationReport(empId, ipdId);

        string patientGeneralHealth      = RadioButtonList2.SelectedItem.Text;
        string patientRegularMedications = TextBox1.Text;
        string patientAllergyStatus      = RadioButtonList1.SelectedItem.Text;
        string patientAllergies          = "NA";

        if (patientAllergyStatus == "Yes")
        {
            patientAllergies = TextBox2.Text;
        }
        string patientPastSurgeryStatus = RadioButtonList5.SelectedItem.Text;
        string patientSurgery1          = "NA";
        string patientSurgery1Date      = "NA";
        string patientSurgery2          = "NA";
        string patientSurgery2Date      = "NA";
        string patientSurgery3          = "NA";
        string patientSurgery3Date      = "NA";

        if (patientPastSurgeryStatus == "Yes")
        {
            patientSurgery1     = TextBox3.Text;
            patientSurgery1Date = TextBox4.Text;
            patientSurgery2     = TextBox5.Text;
            patientSurgery2Date = TextBox6.Text;
            patientSurgery3     = TextBox7.Text;
            patientSurgery3Date = TextBox8.Text;
        }
        string patientMedicalInsuranceStatus       = RadioButtonList3.SelectedItem.Text;
        string patientMedicalInsuranceProvider     = "NA";
        string patientMedicalInsurancePolicyNumber = "NA";

        if (patientMedicalInsuranceStatus == "Yes")
        {
            patientMedicalInsuranceProvider     = TextBox15.Text;
            patientMedicalInsurancePolicyNumber = TextBox16.Text;
        }
        string patientHeight          = TextBox9.Text;
        string patientWeight          = TextBox10.Text;
        string patientAttendingDoctor = DropDownList2.SelectedItem.Text;
        string patientAdmissionWard   = DropDownList3.SelectedItem.Text;
        string patientWardNumber      = DropDownList5.SelectedItem.Text;
        string patientDateOfAdmit     = TextBox18.Text;
        string patientTimeOfAdmit     = TextBox19.Text;
        string patientRemark          = TextBox17.Text;

        PrintIPDRegistrationReportBL objPrintIPDRegistrationReportBL = new PrintIPDRegistrationReportBL();

        byte[] file = objPrintIPDRegistrationReportBL.PrintIPDRegistrationReport(reportId,
                                                                                 patientName, patientId, patientGeneralHealth, patientRegularMedications,
                                                                                 patientAllergyStatus, patientAllergies, patientPastSurgeryStatus, patientSurgery1,
                                                                                 patientSurgery1Date, patientSurgery2, patientSurgery2Date, patientSurgery3,
                                                                                 patientSurgery3Date, patientMedicalInsuranceStatus, patientMedicalInsuranceProvider,
                                                                                 patientMedicalInsurancePolicyNumber, patientHeight, patientWeight,
                                                                                 patientAttendingDoctor, patientAdmissionWard, patientWardNumber, patientDateOfAdmit,
                                                                                 patientTimeOfAdmit, patientRemark);
        Response.Clear();
        Response.ContentType = "application/pdf";
        Response.AddHeader("Content-Disposition", "attachment; filename=IPDRegistrationReport.pdf");
        Response.ContentType = "application/pdf";
        Response.Buffer      = true;
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.BinaryWrite(file);
        Response.End();
        Response.Close();
    }