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

            SqlDataReader reader = command.ExecuteReader();

            List<Doctor> doctorList = new List<Doctor>();

            int serialNo = 1;
            while (reader.Read())
            {
                Doctor doctor = new Doctor();
                doctor.SerialNo = serialNo++;
                doctor.DoctorCode = int.Parse(reader["doctor_code"].ToString());
                doctor.DoctorName = reader["doctor_name"].ToString();
                doctor.DoctorDegree = reader["doctor_degree"].ToString();
                doctor.Specialist = reader["Specialist"].ToString();
                doctor.DoctorPosition = reader["doctor_position"].ToString();
                doctor.Email = reader["email"].ToString();
                doctor.ContactNumber = reader["contact_number"].ToString();

                doctorList.Add(doctor);
            }
            reader.Close();
            connection.Close();

            return doctorList;
        }
 public string Save(Doctor doctor)
 {
     if (doctorGateway.Save(doctor) > 0)
     {
         return "Added Successfully";
     }
     else
     {
         return "Could Not Added!";
     }
 }
 public int Save(Doctor doctor)
 {
     SqlConnection connection = new SqlConnection(databaseConString);
     string query = "INSERT INTO tbl_doctor VALUES('" + doctor.DoctorCode + "','" + doctor.DoctorName + "','" +
                    doctor.DoctorDegree + "','" + doctor.Specialist + "','" + doctor.DoctorPosition + "','" +
                    doctor.Email + "','" + doctor.ContactNumber + "')";
     SqlCommand command = new SqlCommand(query,connection);
     connection.Open();
     int rowAffected = command.ExecuteNonQuery();
     connection.Close();
     return rowAffected;
 }
        protected void addDoctorButton_Click(object sender, EventArgs e)
        {
            Doctor doctor = new Doctor();
            doctor.DoctorCode = int.Parse(doctorCodeTextBox.Text);
            doctor.DoctorName = doctorNameTextBox.Text;
            doctor.DoctorDegree = doctorDegreeTextBox.Text;
            doctor.Specialist = specialistTextBox.Text;
            doctor.DoctorPosition = doctorPositionTextBox.Text;
            doctor.Email = emailTextBox.Text;
            doctor.ContactNumber = contactNumberTextBox.Text;

            message.InnerHtml = doctorManager.Save(doctor);
        }
        public List<Doctor> GetAllDoctorByDropDownList()
        {
            SqlConnection connection = new SqlConnection(databaseConString);
            string query = "SELECT * FROM tbl_doctor";
            SqlCommand command = new SqlCommand(query, connection);
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            List<Doctor> doctorList = new List<Doctor>();

            while (reader.Read())
            {
                Doctor doctor = new Doctor();
                doctor.Id = int.Parse(reader["id"].ToString());
                doctor.DoctorName = reader["doctor_name"].ToString();

                doctorList.Add(doctor);
            }
            reader.Close();
            connection.Close();

            return doctorList;
        }