protected void Button5_Click(object sender, EventArgs e)
    {
        DataTable table = ViewState["CurrentTable"] as DataTable;

        foreach (GridViewRow row in GridView2.Rows)
        {
            int     ipdObservationReportId = Convert.ToInt32(row.Cells[0].Text);
            TextBox TextBoxProblem         = row.FindControl("TextBox2") as TextBox;
            TextBox TextBoxProblemDetail   = row.FindControl("TextBox3") as TextBox;
            TextBox TextBoxSystemReview    = row.FindControl("TextBox4") as TextBox;
            TextBox TextBoxAssessment      = row.FindControl("TextBox5") as TextBox;
            TextBox TextBoxPlan            = row.FindControl("TextBox6") as TextBox;
            string  problem        = TextBoxProblem.Text;
            string  problemDetails = TextBoxProblemDetail.Text;
            string  systemReview   = TextBoxSystemReview.Text;
            string  assessment     = TextBoxAssessment.Text;
            string  plan           = TextBoxPlan.Text;

            Doctor_AddIPDObservationReportBL objDoctor_AddIPDObservationReportBL = new Doctor_AddIPDObservationReportBL();
            objDoctor_AddIPDObservationReportBL.Doctor_AddIPDObservationReport(ipdObservationReportId, ipdObservationId, problem,
                                                                               problemDetails, systemReview, assessment, plan);
            Panel1.Visible       = false;
            Label1.Text          = "IPD Observation Submitted";
            Label1.ForeColor     = System.Drawing.Color.Black;
            Label1.BackColor     = System.Drawing.Color.Yellow;
            GridView1.DataSource = null;
            GridView1.DataBind();
        }

        int    doctorId               = Convert.ToInt32(Session["doctorId"].ToString());
        int    patientId              = Convert.ToInt32(ds.Tables[0].Rows[0][GridView1.SelectedIndex].ToString());
        string observationDate        = DateTime.ParseExact(TextBox8.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
        string observationTime        = TextBox9.Text;
        int    patientHealthCondition = Convert.ToInt32(RadioButtonList1.SelectedValue);
        int    transferToDoctorId     = -1;

        if (Session["transferToDoctorId"] != null)
        {
            transferToDoctorId = Convert.ToInt32(Session["transferToDoctorId"].ToString());
        }
        int wardTransferId = -1;

        if (Session["wardTransferId"] != null)
        {
            wardTransferId = Convert.ToInt32(Session["wardTransferId"].ToString());
        }

        Doctor_AddIPDObservationBL objDoctor_AddIPDObservationBL = new Doctor_AddIPDObservationBL();

        objDoctor_AddIPDObservationBL.Doctor_AddIPDObservation(ipdObservationId, doctorId, patientId,
                                                               observationDate, observationTime, patientHealthCondition, transferToDoctorId,
                                                               wardTransferId);
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        DataTable table = ViewState["CurrentTable"] as DataTable;
        foreach(GridViewRow row in GridView2.Rows)
        {
            int ipdObservationReportId = Convert.ToInt32(row.Cells[0].Text);
            TextBox TextBoxProblem = row.FindControl("TextBox2") as TextBox;
            TextBox TextBoxProblemDetail = row.FindControl("TextBox3") as TextBox;
            TextBox TextBoxSystemReview = row.FindControl("TextBox4") as TextBox;
            TextBox TextBoxAssessment = row.FindControl("TextBox5") as TextBox;
            TextBox TextBoxPlan = row.FindControl("TextBox6") as TextBox;
            string problem = TextBoxProblem.Text;
            string problemDetails = TextBoxProblemDetail.Text;
            string systemReview = TextBoxSystemReview.Text;
            string assessment = TextBoxAssessment.Text;
            string plan = TextBoxPlan.Text;

            Doctor_AddIPDObservationReportBL objDoctor_AddIPDObservationReportBL = new Doctor_AddIPDObservationReportBL();
            objDoctor_AddIPDObservationReportBL.Doctor_AddIPDObservationReport(ipdObservationReportId, ipdObservationId, problem,
                problemDetails, systemReview, assessment, plan);
            Panel1.Visible = false;
            Label1.Text = "IPD Observation Submitted";
            Label1.ForeColor = System.Drawing.Color.Black;
            Label1.BackColor = System.Drawing.Color.Yellow;
            GridView1.DataSource = null;
            GridView1.DataBind();
        }

        int doctorId = Convert.ToInt32(Session["doctorId"].ToString());
        int patientId = Convert.ToInt32(ds.Tables[0].Rows[0][GridView1.SelectedIndex].ToString());
        string observationDate = DateTime.ParseExact(TextBox8.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString();
        string observationTime = TextBox9.Text;
        int patientHealthCondition = Convert.ToInt32(RadioButtonList1.SelectedValue);
        int transferToDoctorId = -1;
        if(Session["transferToDoctorId"] != null)
            transferToDoctorId = Convert.ToInt32(Session["transferToDoctorId"].ToString());
        int wardTransferId = -1;
        if(Session["wardTransferId"] != null)
            wardTransferId = Convert.ToInt32(Session["wardTransferId"].ToString());

        Doctor_AddIPDObservationBL objDoctor_AddIPDObservationBL = new Doctor_AddIPDObservationBL();
        objDoctor_AddIPDObservationBL.Doctor_AddIPDObservation(ipdObservationId, doctorId, patientId,
            observationDate, observationTime, patientHealthCondition, transferToDoctorId,
            wardTransferId);
    }