public Doctor Doctor(int id)
        {
            aGateway.command.CommandText = "SELECT * FROM Doctor_tbl WHERE ID='" + id+ "'";
            aGateway.sqlConnection.Open();
            SqlDataReader reader = aGateway.command.ExecuteReader();
            Doctor aDoctor = new Doctor();

                while (reader.Read())
                {

                    aDoctor.ID = Convert.ToInt16(reader["ID"].ToString());
                    aDoctor.CenterID = Convert.ToInt16(reader["CenterID"].ToString());
                    aDoctor.Name = reader["Name"].ToString();

                }
            reader.Close();
            aGateway.sqlConnection.Close();
            return aDoctor;
        }
        protected void saveDoctorButton_Click(object sender, EventArgs e)
        {
            Doctor newDoctor = new Doctor();
            DAL.DAO.Center newCenter = (DAL.DAO.Center)Session["CenterInfoDetails"];
            newDoctor.CenterID = newCenter.ID;
            newDoctor.Name = nameOfDoctorTextBox.Text;
            newDoctor.Degree = degreeOfDoctorTextBox.Text;
            newDoctor.Specialization = specializationOfDoctorTextBox.Text;
            if (aCenterManager.SaveDoctorInfo(newDoctor) == true)
            {

                labelNotification.Text = "Doctor Information Saved Successfully";
                labelNotification.ForeColor = Color.Green;
                nameOfDoctorTextBox.Text = degreeOfDoctorTextBox.Text = specializationOfDoctorTextBox.Text = null;
            }
            else
            {
                labelNotification.Text = "Doctor Information can't save";
                labelNotification.ForeColor = Color.Red;

            }
        }
 public bool SaveDoctorInfo(Doctor newDoctor)
 {
     return aCenterGateway.SaveNewDoctorInfo(newDoctor);
 }
 public bool SaveNewDoctorInfo(Doctor newDoctor)
 {
     string query = "INSERT INTO Doctor_tbl(Name,Degree,Specialization,CenterID)VALUES('" + newDoctor.Name + "','" + newDoctor.Degree + "','" + newDoctor.Specialization + "','" + newDoctor.CenterID + "')";
     aGateway.command.CommandText = query;
     aGateway.sqlConnection.Open();
     aGateway.command.ExecuteNonQuery();
     aGateway.sqlConnection.Close();
     return true;
 }
        public List<Doctor> GetAllDoctorByCenterID(int CenterID)
        {
            aGateway.command.CommandText = "SELECT * FROM Doctor_tbl WHERE CenterID='" + CenterID + "'";
            aGateway.sqlConnection.Open();
            SqlDataReader reader = aGateway.command.ExecuteReader();
            List<Doctor> doctorList = new List<Doctor>();

            if (reader != null)
                while (reader.Read())
                {
                    Doctor aDoctor=new Doctor();
                    aDoctor.ID = Convert.ToInt16(reader["ID"].ToString());
                    aDoctor.CenterID = Convert.ToInt16(reader["CenterID"].ToString());
                    aDoctor.Name = reader["Name"].ToString();
                    doctorList.Add(aDoctor);

                }
            reader.Close();
            aGateway.sqlConnection.Close();
            return doctorList;
        }