protected void searchButton_Click(object sender, EventArgs e)
 {
     if (billNoTextBox.Text != "" || mobileNoTextBox.Text != "")
     {
         DueView aDueView = new DueView();
         aDueView = aPaymentManager.GetDue(billNoTextBox.Text, mobileNoTextBox.Text);
         if (aDueView != null)
         {
             Session["patientId"] = aDueView.PatientId;
             amountTextBox.Text   = aDueView.Amount;
             dueDateTextBox.Text  = aDueView.DueDate;
         }
         else
         {
             outputLabel.ForeColor = Color.Red;
             outputLabel.Text      = "No Unpaid bill information found For this Bill No/Mobile No !";
         }
     }
     else
     {
         amountTextBox.Text    = "";
         dueDateTextBox.Text   = "";
         outputLabel.ForeColor = Color.Brown;
         outputLabel.Text      = "Please insert Bill No or Mobile No";
     }
 }
        public DueView GetDue(string billNo, string mobileNo)
        {
            DueView aDueView = null;

            Query   = "SELECT p.PatientId, p.BillAmount, tr.EntryDate AS DueDate FROM PatientInfo AS p JOIN TestRequest AS tr ON p.PatientId = tr.PatientId WHERE p.PaymentStatus='0' AND (p.PatientId='" + billNo + "' OR p.MobileNo='" + mobileNo + "') ";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            if (Reader.HasRows)
            {
                aDueView = new DueView();
                while (Reader.Read())
                {
                    aDueView.PatientId = Convert.ToInt32(Reader["PatientId"]);
                    aDueView.Amount    = Reader["BillAmount"].ToString();
                    aDueView.DueDate   = Reader["DueDate"].ToString();
                }
                Reader.Close();
                Connection.Close();
                return(aDueView);
            }
            else
            {
                Connection.Close();
                return(aDueView);
            }
        }