protected void Button2_Click(object sender, EventArgs e)
    {
        Page.Validate();
        if(Page.IsValid)
        {
            int patientId = Convert.ToInt32(Label2.Text);
            int patientGeneralHealth = Convert.ToInt32(RadioButtonList2.SelectedValue);
            string patientRegularMedications = TextBox2.Text;
            int patientAllergyStatus = Convert.ToInt32(RadioButtonList1.SelectedValue);
            string patientAllergies = TextBox3.Text;
            int patientPastSurgeryStatus = Convert.ToInt32(RadioButtonList5.SelectedValue);
            string patientSurgery1 = TextBox4.Text;
            string patientSurgery1Date = "1900-01-01";
            if(TextBox4.Text != "")
                patientSurgery1Date = DateTime.ParseExact(TextBox5.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            string patientSurgery2 = TextBox6.Text;
            string patientSurgery2Date = "1900-01-01";
            if(TextBox6.Text != "")
                patientSurgery2Date = DateTime.ParseExact(TextBox7.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            string patientSurgery3 = TextBox8.Text;
            string patientSurgery3Date = "1900-01-01";
            if(TextBox8.Text != "")
                patientSurgery3Date = DateTime.ParseExact(TextBox9.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            int patientMedicalInsuranceStatus = Convert.ToInt32(RadioButtonList3.SelectedValue);
            string patientMedicalInsuranceProvider = "";
            string patientMedicalInsurancePolicyNumber = "";
            if(patientMedicalInsuranceStatus == 1)
            {
                patientMedicalInsuranceProvider = TextBox15.Text;
                patientMedicalInsurancePolicyNumber = TextBox16.Text;
            }
            string patientHeight = TextBox10.Text;
            string patientWeight = TextBox11.Text;
            string patientBloodGroup = DropDownList1.SelectedItem.Text;
            int patientAttendingDoctor = Convert.ToInt32(DropDownList2.SelectedValue);
            int patientAdmissionWard = Convert.ToInt32(DropDownList3.Text);
            int patientWardNumber = Convert.ToInt32(DropDownList5.Text);
            string patientDateOfAdmit = DateTime.ParseExact(TextBox18.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            string patientTimeOfAdmit = TextBox19.Text;
            string patientRemark = TextBox17.Text;

            RegisterIndoorPatientBL objRegisterIndoorPatientBL = new RegisterIndoorPatientBL();
            Session["ipdId"] = objRegisterIndoorPatientBL.RegisterIndoorPatient(patientId, patientGeneralHealth,
            patientRegularMedications, patientAllergyStatus, patientAllergies,
            patientPastSurgeryStatus, patientSurgery1, patientSurgery1Date, patientSurgery2,
            patientSurgery2Date, patientSurgery3, patientSurgery3Date,
            patientMedicalInsuranceStatus, patientMedicalInsuranceProvider,
            patientMedicalInsurancePolicyNumber, patientHeight, patientWeight, patientBloodGroup,
            patientAttendingDoctor, patientDateOfAdmit,
            patientTimeOfAdmit, patientRemark);

            AddCaseBL objAddCaseBL = new AddCaseBL();
            int caseId = objAddCaseBL.AddCase(patientAttendingDoctor, patientId, patientDateOfAdmit, DateTime.ParseExact("01/01/1900", "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString());

            AddWardEntryBL objAddWardEntryBL = new AddWardEntryBL();
            objAddWardEntryBL.AddWardEntry(patientAdmissionWard, patientWardNumber, patientId, caseId);

            UpdatePatientTypeBL objUpdatePatientTypeBL = new UpdatePatientTypeBL();
            objUpdatePatientTypeBL.UpdatePatientType(patientId, "IN");

            Panel2.Visible = true;
            Label3.Focus();
            TextBox2.Enabled = false;
            TextBox3.Enabled = false;
            TextBox4.Enabled = false;
            TextBox5.Enabled = false;
            TextBox6.Enabled = false;
            TextBox7.Enabled = false;
            TextBox8.Enabled = false;
            TextBox9.Enabled = false;
            TextBox10.Enabled = false;
            TextBox15.Enabled = false;
            TextBox16.Enabled = false;
            TextBox17.Enabled = false;
            TextBox18.Enabled = false;
            TextBox19.Enabled = false;
            RadioButtonList1.Enabled = false;
            RadioButtonList2.Enabled = false;
            RadioButtonList3.Enabled = false;
            RadioButtonList5.Enabled = false;
            DropDownList2.Enabled = false;
            DropDownList3.Enabled = false;
            DropDownList5.Enabled = false;
            Button2.Enabled = false;
            Button1.Enabled = false;
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Page.Validate();
        if (Page.IsValid)
        {
            int    patientId                 = Convert.ToInt32(Label2.Text);
            int    patientGeneralHealth      = Convert.ToInt32(RadioButtonList2.SelectedValue);
            string patientRegularMedications = TextBox2.Text;
            int    patientAllergyStatus      = Convert.ToInt32(RadioButtonList1.SelectedValue);
            string patientAllergies          = TextBox3.Text;
            int    patientPastSurgeryStatus  = Convert.ToInt32(RadioButtonList5.SelectedValue);
            string patientSurgery1           = TextBox4.Text;
            string patientSurgery1Date       = "1900-01-01";
            if (TextBox4.Text != "")
            {
                patientSurgery1Date = DateTime.ParseExact(TextBox5.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            }
            string patientSurgery2     = TextBox6.Text;
            string patientSurgery2Date = "1900-01-01";
            if (TextBox6.Text != "")
            {
                patientSurgery2Date = DateTime.ParseExact(TextBox7.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            }
            string patientSurgery3     = TextBox8.Text;
            string patientSurgery3Date = "1900-01-01";
            if (TextBox8.Text != "")
            {
                patientSurgery3Date = DateTime.ParseExact(TextBox9.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            }
            int    patientMedicalInsuranceStatus       = Convert.ToInt32(RadioButtonList3.SelectedValue);
            string patientMedicalInsuranceProvider     = "";
            string patientMedicalInsurancePolicyNumber = "";
            if (patientMedicalInsuranceStatus == 1)
            {
                patientMedicalInsuranceProvider     = TextBox15.Text;
                patientMedicalInsurancePolicyNumber = TextBox16.Text;
            }
            string patientHeight          = TextBox10.Text;
            string patientWeight          = TextBox11.Text;
            string patientBloodGroup      = DropDownList1.SelectedItem.Text;
            int    patientAttendingDoctor = Convert.ToInt32(DropDownList2.SelectedValue);
            int    patientAdmissionWard   = Convert.ToInt32(DropDownList3.Text);
            int    patientWardNumber      = Convert.ToInt32(DropDownList5.Text);
            string patientDateOfAdmit     = DateTime.ParseExact(TextBox18.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
            string patientTimeOfAdmit     = TextBox19.Text;
            string patientRemark          = TextBox17.Text;

            RegisterIndoorPatientBL objRegisterIndoorPatientBL = new RegisterIndoorPatientBL();
            Session["ipdId"] = objRegisterIndoorPatientBL.RegisterIndoorPatient(patientId, patientGeneralHealth,
                                                                                patientRegularMedications, patientAllergyStatus, patientAllergies,
                                                                                patientPastSurgeryStatus, patientSurgery1, patientSurgery1Date, patientSurgery2,
                                                                                patientSurgery2Date, patientSurgery3, patientSurgery3Date,
                                                                                patientMedicalInsuranceStatus, patientMedicalInsuranceProvider,
                                                                                patientMedicalInsurancePolicyNumber, patientHeight, patientWeight, patientBloodGroup,
                                                                                patientAttendingDoctor, patientDateOfAdmit,
                                                                                patientTimeOfAdmit, patientRemark);

            AddCaseBL objAddCaseBL = new AddCaseBL();
            int       caseId       = objAddCaseBL.AddCase(patientAttendingDoctor, patientId, patientDateOfAdmit, DateTime.ParseExact("01/01/1900", "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString());

            AddWardEntryBL objAddWardEntryBL = new AddWardEntryBL();
            objAddWardEntryBL.AddWardEntry(patientAdmissionWard, patientWardNumber, patientId, caseId);

            UpdatePatientTypeBL objUpdatePatientTypeBL = new UpdatePatientTypeBL();
            objUpdatePatientTypeBL.UpdatePatientType(patientId, "IN");

            Panel2.Visible = true;
            Label3.Focus();
            TextBox2.Enabled         = false;
            TextBox3.Enabled         = false;
            TextBox4.Enabled         = false;
            TextBox5.Enabled         = false;
            TextBox6.Enabled         = false;
            TextBox7.Enabled         = false;
            TextBox8.Enabled         = false;
            TextBox9.Enabled         = false;
            TextBox10.Enabled        = false;
            TextBox15.Enabled        = false;
            TextBox16.Enabled        = false;
            TextBox17.Enabled        = false;
            TextBox18.Enabled        = false;
            TextBox19.Enabled        = false;
            RadioButtonList1.Enabled = false;
            RadioButtonList2.Enabled = false;
            RadioButtonList3.Enabled = false;
            RadioButtonList5.Enabled = false;
            DropDownList2.Enabled    = false;
            DropDownList3.Enabled    = false;
            DropDownList5.Enabled    = false;
            Button2.Enabled          = false;
            Button1.Enabled          = false;
        }
    }