Example #1
0
        private int?GetBreedIDFromBreedName(string breedName)
        {
            if (string.IsNullOrEmpty(breedName))
            {
                breedName = "Not Specified";
            }

            DogBreeds        breed     = new DogBreeds(Utils.ConnectionString());
            List <DogBreeds> breedList = breed.GetDog_BreedsByDog_Breed_Description(breedName);

            if (breedList.Count > 0)
            {
                return(breedList[0].Dog_Breed_ID);
            }

            //Create New Dog Breed if not empty
            int?breed_ID = breed.Insert_Dog_Breed(breedName);

            return(breed_ID);
        }
Example #2
0
    protected void btnAddBreed_Click(object sender, EventArgs e)
    {
        string strDogBreed = txtNewBreed.Text;

        if (!string.IsNullOrEmpty(strDogBreed))
        {
            DogBreeds dogBreeds     = new DogBreeds(_connString);
            int?      newDogBreedID = dogBreeds.Insert_Dog_Breed(strDogBreed);

            if (newDogBreedID != null && newDogBreedID > 0)
            {
                MessageLabel.Text = string.Format("{0} was added to the Dog Breed Table", strDogBreed);
            }
            else
            {
                MessageLabel.Text = "Error inserting the record";
            }
        }
        else
        {
            MessageLabel.Text = "Nothing Entered!";
        }
    }