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

            SqlDataReader reader = command.ExecuteReader();

            List<Appointment> appointmentList = new List<Appointment>();

            int serialNo = 1;
            while (reader.Read())
            {
                Appointment appointment = new Appointment();
                appointment.SerialNo = serialNo++;
                appointment.AppointmentDate = reader["appointment_date"].ToString();
                appointment.AppointmentSerial = int.Parse(reader["appointment_serial"].ToString());
                appointment.PatientName = reader["patient_name"].ToString();
                appointment.PatientContactNo = reader["contact_number"].ToString();
                appointment.DoctorName = reader["doctor_name"].ToString();

                appointmentList.Add(appointment);
            }
            reader.Close();
            connection.Close();

            return appointmentList;
        }
        protected void addAppointmentButton_Click(object sender, EventArgs e)
        {
            Appointment appointment = new Appointment();
            appointment.AppointmentDate = appointmentDateTextBox.Text;
            appointment.AppointmentSerial = int.Parse(appointmentSerialTextBox.Text);
            appointment.PatientId = int.Parse(patientNameDropDownList.SelectedValue);
            appointment.DoctorId = int.Parse(doctorNameDropDownList.SelectedValue);

            message.InnerHtml = appointmentManager.Save(appointment);
        }
 public string Save(Appointment appointment)
 {
     if (appointmentGateway.Save(appointment) > 0)
     {
         return "Added Successfully";
     }
     else
     {
         return "Could Not Added!";
     }
 }
 public int Save(Appointment appointment)
 {
     SqlConnection connection = new SqlConnection(databaseConString);
     string query = "INSERT INTO tbl_appointment VALUES ('" + appointment.AppointmentDate + "','" +
                    appointment.AppointmentSerial + "','" + appointment.PatientId + "','" + appointment.DoctorId +
                    "')";
     SqlCommand command = new SqlCommand(query,connection);
     connection.Open();
     int rowAffected = command.ExecuteNonQuery();
     connection.Close();
     return rowAffected;
 }