public List<Doctor> GetSelectedDoctors(int centerId)
        {
            List<Doctor> doctorList = new List<Doctor>();
            string query = "SELECT * FROM tbl_doctor WHERE center_id='" +centerId+ "'";
            ASqlCommand = new SqlCommand(query, ASqlConnection);
            ASqlConnection.Open();
            ASqlDataReader = ASqlCommand.ExecuteReader();
            Doctor aDoctor;

            while (ASqlDataReader.Read())
            {
                aDoctor = new Doctor();
                aDoctor.Id = (int) ASqlDataReader["id"];
                aDoctor.Name = ASqlDataReader["name"].ToString();
                aDoctor.Degree = ASqlDataReader["degree"].ToString();
                aDoctor.Specialization = ASqlDataReader["specialization"].ToString();
                aDoctor.CenterId = (int) ASqlDataReader["center_id"];

                doctorList.Add(aDoctor);
            }

            ASqlDataReader.Close();
            ASqlCommand.Dispose();
            ASqlConnection.Close();
            return doctorList;
        }
 public void SaveDoctor(Doctor aDoctor)
 {
     ASqlConnection.Open();
     string query = "INSERT INTO tbl_doctor VALUES('" + aDoctor.Name + "','" + aDoctor.Degree + "','" + aDoctor.Specialization + "','" + aDoctor.CenterId + "') ";
     ASqlCommand = new SqlCommand(query, ASqlConnection);
     ASqlCommand.ExecuteNonQuery();
     ASqlConnection.Close();
 }
 protected void saveButton_Click(object sender, EventArgs e)
 {
     aDoctor = new Doctor();
     DAO.Center aCenter = aCenterManager.GetCenter(Convert.ToInt32(Session["CenterId"]));
     aDoctor.Name = nameTextBox.Text;
     aDoctor.Degree = degreeTextBox.Text;
     aDoctor.Specialization = specializationTextBox.Text;
     aDoctor.CenterId = aCenter.Id;
     string msg = aDoctorManager.SaveDoctor(aDoctor);
     msgLabel.Text = msg;
 }
 public string SaveDoctor(Doctor aDoctor)
 {
     aDoctorDbGateway.SaveDoctor(aDoctor);
     return "Doctor Saved Successfully";
 }