public List<Patient> GetAllPatientByRepeater()
        {
            SqlConnection connection = new SqlConnection(databaseConString);
            string query = "SELECT * FROM tbl_patient";
            SqlCommand command = new SqlCommand(query, connection);
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            List<Patient> patientList = new List<Patient>();

            int serialNo = 1;
            while (reader.Read())
            {
                Patient patient = new Patient();
                patient.SerialNo = serialNo++;
                patient.PatientName = reader["patient_name"].ToString();
                patient.Address = reader["address"].ToString();
                patient.Email = reader["email"].ToString();
                patient.ContactNo = reader["contact_number"].ToString();
                patient.Age = int.Parse(reader["age"].ToString());

                patientList.Add(patient);
            }
            reader.Close();
            connection.Close();

            return patientList;
        }
 public string Save(Patient patient)
 {
     if (patientGateway.Save(patient) > 0)
     {
         return "Added Successfully!";
     }
     else
     {
         return "Could Not Added!";
     }
 }
        protected void addPatientButton_Click(object sender, EventArgs e)
        {
            Patient patient = new Patient();
            patient.PatientName = patientNameTextBox.Text;
            patient.Address = addressTextBox.Text;
            patient.Email = emailTextBox.Text;
            patient.ContactNo = contactNumberTextBox.Text;
            patient.Age = int.Parse(ageTextBox.Text);

            message.InnerHtml = patientManager.Save(patient);
        }
        public int Save(Patient patient)
        {
            SqlConnection connection = new SqlConnection(databaseConString);
            string query = "INSERT INTO tbl_patient VALUES('" + patient.PatientName + "','" + patient.Address + "','" +
                           patient.Email + "','" + patient.ContactNo + "','" + patient.Age +
                           "')";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();
            int rowAffected = command.ExecuteNonQuery();
            connection.Close();
            return rowAffected;
        }
        public List<Patient> GetAllPatientByDropDownList()
        {
            SqlConnection connection = new SqlConnection(databaseConString);
            string query = "SELECT * FROM tbl_patient";
            SqlCommand command = new SqlCommand(query, connection);
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            List<Patient> patientList = new List<Patient>();

            while (reader.Read())
            {
                Patient patient = new Patient();
                patient.Id = int.Parse(reader["id"].ToString());
                patient.PatientName = reader["patient_name"].ToString();

                patientList.Add(patient);
            }
            reader.Close();
            connection.Close();

            return patientList;
        }