public List<Disease> LoadAllDiseasesName()
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string query = "SELECT * FROM tbl_Disease_Entry";
            SqlCommand command = new SqlCommand(query, connection);
            List<Disease> diseaseEntryList = new List<Disease>();

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            int serial = 1;
            while (reader.Read())
            {
                Disease aDisease=new Disease();

                aDisease.id = serial;

                aDisease.diseaseName = reader["DiseaseName"].ToString();
                aDisease.diseaseDescription = reader["DiseaseDescription"].ToString();
                aDisease.diseaseTreatment = reader["DiseaseTreatment"].ToString();
                aDisease.diseaseProcedure = reader["DiseaseProcedure"].ToString();

                diseaseEntryList.Add(aDisease);
                serial++;
            }
            reader.Close();
            connection.Close();

            return diseaseEntryList;
        }
        public int saveDiseaseEntry(Disease aDisease)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string query = "insert into tbl_Disease_Entry values('" + aDisease.diseaseName + "','"+aDisease.diseaseDescription+"','"+aDisease.diseaseTreatment+"','"+aDisease.diseaseProcedure+"')";
            SqlCommand command = new SqlCommand(query, connection);
            connection.Open();
            int rowAffected = command.ExecuteNonQuery();
            connection.Close();

            return rowAffected;
        }
 public string SavediseaseEntry(Disease aDisease)
 {
     if (aDiseaseEntryGateway.IsDiseaseNameExists(aDisease))
     {
         return "Disease Name Already Exists";
     }
     else if (aDiseaseEntryGateway.saveDiseaseEntry(aDisease) > 0)
     {
         return "Disease Name Saved Successfully";
     }
     else
     {
         return "Disease name Not Saved Correctly";
     }
 }
        public bool IsDiseaseNameExists(Disease aDisease)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string query = "SELECT * FROM tbl_Disease_Entry WHERE DiseaseName='" + aDisease.diseaseName + "'";
            SqlCommand command = new SqlCommand(query, connection);
            bool isDiseaseNameExists = false;

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                isDiseaseNameExists = true;
            }
            reader.Close();
            connection.Close();

            return isDiseaseNameExists;
        }
 public List<Disease> LoaDiseases()
 {
     SqlConnection connection = new SqlConnection(connectionString);
     string query = "select * from tbl_Disease_Entry";
     SqlCommand command = new SqlCommand(query, connection);
     connection.Open();
     List<Disease> diseaseList = new List<Disease>();
     SqlDataReader reader = command.ExecuteReader();
     while (reader.Read())
     {
         Disease aDisease = new Disease();
         aDisease.id = int.Parse(reader["ID"].ToString());
         aDisease.diseaseName = reader["DiseaseName"].ToString();
         diseaseList.Add(aDisease);
     }
     reader.Close();
     connection.Close();
     return diseaseList;
 }