Esempio n. 1
0
    protected void btnDogSearch_Click(object sender, EventArgs e)
    {
        //ResetPage();
        //ClearEntryFields();
        string      searchValue = txtDogFilter.Text;
        Dogs        dog         = new Dogs(_connString);
        List <Dogs> tblDogs     = null;

        if (DogSearchType.SelectedValue == "c")
        {
            searchValue = string.Format("%{0}", searchValue);
        }

        switch (DogFilterBy.SelectedValue)
        {
        case "KC_Name":
            tblDogs = dog.GetDogsLikeDog_KC_Name(searchValue);
            break;

        case "Pet_Name":
            tblDogs = dog.GetDogsLikeDog_Pet_Name(searchValue);
            break;

        case "Breed_ID":
            DogBreeds        dogBreeds    = new DogBreeds(_connString);
            List <DogBreeds> lkpDogBreeds = null;
            lkpDogBreeds = dogBreeds.GetDog_BreedsByDog_Breed_Description(searchValue);
            tblDogs      = dog.GetDogsByDog_Breed_ID(lkpDogBreeds);
            break;

        default:
            tblDogs = dog.GetDogs();
            break;
        }

        Common.Dog_GridViewData = tblDogs;
        PopulateDogGridView(Common.Dog_GridViewData, 1);
        txtDogFilter.Text           = string.Empty;
        DogFilterBy.SelectedIndex   = -1;
        DogSearchType.SelectedIndex = -1;
    }