public List<Doctor> DoctorAssignList() { string query = "select DoctorID,DoctorName from doctors where doctorid not in (select DoctorID from DoctorClinics)"; aSqlConnection.Open(); aSqlCommand = new SqlCommand(query, aSqlConnection); SqlDataReader aDataReader = aSqlCommand.ExecuteReader(); List<Doctor> aList = new List<Doctor>(); while (aDataReader.Read()) { //Designation aDesignation = new Designation(); Doctor aDoctor = new Doctor(); aDoctor.DoctorID = Convert.ToInt32(aDataReader[0]); aDoctor.DoctorName = aDataReader[1].ToString(); aList.Add(aDoctor); } aDataReader.Close(); aSqlConnection.Close(); return aList; }
public List<Doctor> GetDoctors() { string query = string.Format("select Doctors.DoctorID,DoctorName from Doctors,DoctorClinics where Doctors.DoctorID=DoctorClinics.DoctorID and DoctorClinics.CommunityClinicID={0}", Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[2])); aSqlConnection.Open(); aSqlCommand = new SqlCommand(query, aSqlConnection); SqlDataReader aDataReader = aSqlCommand.ExecuteReader(); List<Doctor> aList = new List<Doctor>(); while (aDataReader.Read()) { //Designation aDesignation = new Designation(); Doctor aDoctor = new Doctor(); aDoctor.DoctorID = Convert.ToInt32(aDataReader[0]); aDoctor.DoctorName = aDataReader[1].ToString(); aList.Add(aDoctor); } aDataReader.Close(); aSqlConnection.Close(); return aList; }