Beispiel #1
0
        public List <DogBreeds> GetDog_BreedsByDog_Breed_Description(string description)
        {
            List <DogBreeds> retVal = new List <DogBreeds>();

            try
            {
                DogBreedsBL dogBreeds = new DogBreedsBL(_connString);
                lkpDogBreeds = dogBreeds.GetDog_BreedsByDog_Breed_Description(description);

                if (lkpDogBreeds != null && lkpDogBreeds.Rows.Count > 0)
                {
                    foreach (DataRow row in lkpDogBreeds.Rows)
                    {
                        DogBreeds dogBreed = new DogBreeds(_connString, Utils.DBNullToInt(row["Dog_Breed_ID"]));
                        retVal.Add(dogBreed);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(retVal);
        }
Beispiel #2
0
        public List <DogBreeds> GetDog_Breeds()
        {
            List <DogBreeds> retVal = new List <DogBreeds>();

            try
            {
                DogBreedsBL dogBreeds = new DogBreedsBL(_connString);
                lkpDogBreeds = dogBreeds.GetDog_Breeds();

                if (lkpDogBreeds != null && lkpDogBreeds.Rows.Count > 0)
                {
                    DogBreeds firstDogBreed = new DogBreeds(_connString);
                    firstDogBreed.Dog_Breed_ID = 1;
                    firstDogBreed.Description  = "Please Select...";
                    retVal.Add(firstDogBreed);
                    foreach (DataRow row in lkpDogBreeds.Rows)
                    {
                        DogBreeds dogBreed = new DogBreeds(_connString, Utils.DBNullToInt(row["Dog_Breed_ID"]));
                        retVal.Add(dogBreed);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(retVal);
        }
Beispiel #3
0
        public List<DogBreeds> GetDog_Breeds()
        {
            List<DogBreeds> dogBreedList = new List<DogBreeds>();
            DogBreedsBL dogBreeds = new DogBreedsBL();
            lkpDogBreeds = dogBreeds.GetDog_Breeds();

            if (lkpDogBreeds != null && lkpDogBreeds.Count > 0)
            {
                DogBreeds firstDogBreed = new DogBreeds();
                firstDogBreed.Dog_Breed_ID = 1;
                firstDogBreed.Description = "Please Select...";
                dogBreedList.Add(firstDogBreed);
                foreach (sss.lkpDog_BreedsRow row in lkpDogBreeds)
                {
                    DogBreeds dogBreed = new DogBreeds(row.Dog_Breed_ID);
                    dogBreedList.Add(dogBreed);
                }
            }

            return dogBreedList;
        }
Beispiel #4
0
    protected void btnAddBreed_Click(object sender, EventArgs e)
    {
        string strDogBreed = txtNewBreed.Text;
        if (!string.IsNullOrEmpty(strDogBreed))
        {
            DogBreeds dogBreeds = new DogBreeds();
            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!";
        }
    }
Beispiel #5
0
    private void PopulateSire()
    {
        Guid sire_ID = new Guid(Sire_ID);
        Dogs dog = new Dogs(sire_ID);

        txtSireKCName.Text = dog.Dog_KC_Name;
        txtSirePetName.Text = dog.Dog_Pet_Name;

        if (dog.Dog_Breed_ID != null && dog.Dog_Breed_ID != 1)
        {
            int dog_Breed_ID = Int32.Parse(dog.Dog_Breed_ID.ToString());
            DogBreeds dogBreeds = new DogBreeds(dog_Breed_ID);
            txtSireBreed.Text = dogBreeds.Description;
        }
        if (dog.Dog_Gender_ID != null && dog.Dog_Gender_ID != 1)
        {
            int dog_Gender_ID = Int32.Parse(dog.Dog_Gender_ID.ToString());
            DogGender dogGender = new DogGender(dog_Gender_ID);
            txtSireGender.Text = dogGender.Description;
        }
        divGetSire.Visible = false;
        divChangeSire.Visible = true;
        divSireDetails.Visible = true;
    }
Beispiel #6
0
    private void PopulateDog()
    {
        Guid current_dog_ID = new Guid(Current_Dog_ID);
        Dogs dog = new Dogs(current_dog_ID);

        txtKCName.Text = dog.Dog_KC_Name;
        txtPetName.Text = dog.Dog_Pet_Name;
        lblNLWU.Text = string.Format("Tick this box if {0} is no longer with us.", dog.Dog_Pet_Name);

        if (dog.Dog_Breed_ID != null)
        {
            int dog_Breed_ID = Int32.Parse(dog.Dog_Breed_ID.ToString());
            DogBreeds dogBreeds = new DogBreeds(dog_Breed_ID);
            txtDogBreed.Text = dogBreeds.Description;
        }
        if (dog.Dog_Gender_ID != null)
        {
            int dog_Gender_ID = Int32.Parse(dog.Dog_Gender_ID.ToString());
            DogGender dogGender = new DogGender(dog_Gender_ID);
            txtDogGender.Text = dogGender.Description;
        }
        if (dog.Reg_No != null)
        {
            Reg_No = dog.Reg_No.ToString();
            Common.Reg_No = Reg_No;
            txtRegNo.Text = Reg_No;
        }
        if (dog.Date_Of_Birth != null)
        {
            string format = "yyyy-MM-dd";
            Date_Of_Birth = DateTime.Parse(dog.Date_Of_Birth.ToString()).ToString(format);
            Common.Date_Of_Birth = Date_Of_Birth;
            txtDogDOB.Text = Date_Of_Birth;
        }
        if (dog.Merit_Points != null)
        {
            Merit_Points = dog.Merit_Points.ToString();
            Common.Merit_Points = Merit_Points;
            txtMeritPoints.Text = Merit_Points;
        }
        else
        {
            Merit_Points = "0";
            Common.Merit_Points = Merit_Points;
            txtMeritPoints.Text = Merit_Points;
        }
        if (dog.NLWU != null)
        {
            NLWU = (bool)dog.NLWU;
            Common.NLWU = NLWU;
            chkNLWU.Checked = NLWU;
        }
        DogDams dogDams = new DogDams();
        List<DogDams> lnkDogDams;
        lnkDogDams = dogDams.GetDogDamsByDog_ID(dog.Dog_ID);
        if (lnkDogDams.Count != 0)
        {
            Dam_ID = lnkDogDams[0].Dam_ID.ToString();
            Common.Dam_ID = Dam_ID;
            PopulateDam();
        }
        DogSires dogSires = new DogSires();
        List<DogSires> lnkDogSires;
        lnkDogSires = dogSires.GetDogSiresByDog_ID(dog.Dog_ID);
        if (lnkDogSires.Count != 0)
        {
            Sire_ID = lnkDogSires[0].Sire_ID.ToString();
            Common.Sire_ID = Sire_ID;
            PopulateSire();
        }
    }
Beispiel #7
0
    private void PopulateDam()
    {
        Guid dam_ID = new Guid(Dam_ID);
        Dogs dog = new Dogs(dam_ID);

        txtDamKCName.Text = dog.Dog_KC_Name;
        txtDamPetName.Text = dog.Dog_Pet_Name;

        if (dog.Dog_Breed_ID != null && dog.Dog_Breed_ID != 1)
        {
            int dog_Breed_ID = Int32.Parse(dog.Dog_Breed_ID.ToString());
            DogBreeds dogBreeds = new DogBreeds(dog_Breed_ID);
            txtDamBreed.Text = dogBreeds.Description;
        }
        if (dog.Dog_Gender_ID != null && dog.Dog_Gender_ID != 1)
        {
            int dog_Gender_ID = Int32.Parse(dog.Dog_Gender_ID.ToString());
            DogGender dogGender = new DogGender(dog_Gender_ID);
            txtDamGender.Text = dogGender.Description;
        }
        divGetDam.Visible = false;
        divChangeDam.Visible = true;
        divDamDetails.Visible = true;
    }
Beispiel #8
0
    private void PopulateDogGridView(List<Dogs> tblDogs, int pageNo)
    {
        if (tblDogs == null)
        {
            tblDogs = Common.Dog_GridViewData;
        }
        List<Dogs> newDogs = new List<Dogs>();

        int itemsperPage = Int32.Parse(WebConfigurationManager.AppSettings["GridItemsPerPage"]);
        int startRowIndex = (pageNo -1) * itemsperPage;
        int currentIndex = 0;
        int itemsRead = 0;
        int totalRecords = tblDogs.Count;
        foreach (Dogs row in tblDogs)
        {
            if (itemsRead < itemsperPage && currentIndex < totalRecords && currentIndex >= startRowIndex)
            {
                Dogs newDog = new Dogs();
                newDog.Dog_ID = row.Dog_ID;
                newDog.Dog_KC_Name = row.Dog_KC_Name;
                newDog.Dog_Pet_Name = row.Dog_Pet_Name;
                if (!row.IsReg_NoNull)
                    newDog.Reg_No = row.Reg_No;
                DogBreeds dogBreeds = new DogBreeds(Convert.ToInt32(row.Dog_Breed_ID));
                newDog.Dog_Breed_Description = dogBreeds.Description;
                DogGender dogGender = new DogGender(Convert.ToInt32(row.Dog_Gender_ID));
                newDog.Dog_Gender = dogGender.Description;
                newDogs.Add(newDog);
                itemsRead++;
            }
            currentIndex++;
        }
        lblTotalPages.Text = CalculateTotalPages(totalRecords).ToString();

        lblCurrentPage.Text = CurrentPage.ToString();

        if (CurrentPage == 1)
        {
            Btn_Previous.Enabled = false;

            if (Int32.Parse(lblTotalPages.Text) > 0)
            {
                Btn_Next.Enabled = true;
            }
            else
                Btn_Next.Enabled = false;

        }

        else
        {
            Btn_Previous.Enabled = true;

            if (CurrentPage == Int32.Parse(lblTotalPages.Text))
                Btn_Next.Enabled = false;
            else Btn_Next.Enabled = true;
        }
        DogGridView.DataSource = newDogs;
        DogGridView.DataBind();
    }
Beispiel #9
0
 private void PopulateBreedList()
 {
     DogBreeds dogBreeds = new DogBreeds();
     List<DogBreeds> lkpDog_Breeds = dogBreeds.GetDog_Breeds();
     lstDogBreeds.DataSource = lkpDog_Breeds;
     lstDogBreeds.DataBind();
 }
Beispiel #10
0
    protected void btnDogSearch_Click(object sender, EventArgs e)
    {
        //ResetPage();
        //ClearEntryFields();
        string searchValue = txtDogFilter.Text;
        Dogs dog = new Dogs();
        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();
                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;
    }
Beispiel #11
0
        public List<DogBreeds> GetDog_BreedsByDog_Breed_Description(string description)
        {
            List<DogBreeds> dogBreedList = new List<DogBreeds>();
            DogBreedsBL dogBreeds = new DogBreedsBL();
            lkpDogBreeds = dogBreeds.GetDog_BreedsByDog_Breed_Description(description);

            if (lkpDogBreeds != null && lkpDogBreeds.Count > 0)
            {
                foreach (sss.lkpDog_BreedsRow row in lkpDogBreeds)
                {
                    DogBreeds dogBreed = new DogBreeds(row.Dog_Breed_ID);
                    dogBreedList.Add(dogBreed);
                }
            }

            return dogBreedList;
        }