Exemplo n.º 1
0
        private void EditBreed()
        {
            int selectedBreed = -1;

            cboNewValue       = new ComboBox();
            cboNewValue.Width = panel1.Width;
            panel1.Controls.Add(cboNewValue);
            dog = new Dogs(_connString, new Guid(_dogID));
            DogBreeds        db        = new DogBreeds(_connString);
            List <DogBreeds> breedList = db.GetDog_Breeds();

            foreach (DogBreeds breed in breedList)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.Text  = breed.Description;
                item.Value = breed.Dog_Breed_ID;
                cboNewValue.Items.Add(item);
                if (dog.Dog_Breed_ID == breed.Dog_Breed_ID)
                {
                    selectedBreed           = breed.Dog_Breed_ID;
                    lblCurrentValue.Text    = breed.Description;
                    lblCurrentValue.Visible = true;
                }
            }
        }
Exemplo n.º 2
0
    private void PopulateBreedList()
    {
        DogBreeds        dogBreeds     = new DogBreeds(_connString);
        List <DogBreeds> lkpDog_Breeds = dogBreeds.GetDog_Breeds();

        lstDogBreeds.DataSource = lkpDog_Breeds;
        lstDogBreeds.DataBind();
    }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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;
    }
Exemplo n.º 5
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!";
        }
    }
Exemplo n.º 6
0
    private void PopulateSire()
    {
        Guid sire_ID = new Guid(Sire_ID);
        Dogs dog     = new Dogs(_connString, 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(_connString, 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(_connString, dog_Gender_ID);
            txtSireGender.Text = dogGender.Description;
        }
        divGetSire.Visible     = false;
        divChangeSire.Visible  = true;
        divSireDetails.Visible = true;
    }
Exemplo n.º 7
0
    private void PopulateDam()
    {
        Guid dam_ID = new Guid(Dam_ID);
        Dogs dog    = new Dogs(_connString, 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(_connString, 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(_connString, dog_Gender_ID);
            txtDamGender.Text = dogGender.Description;
        }
        divGetDam.Visible     = false;
        divChangeDam.Visible  = true;
        divDamDetails.Visible = true;
    }
Exemplo n.º 8
0
 public ShelterDogs(DogBreeds b)
 {
     Breed = b;
 }
Exemplo n.º 9
0
        private void PopulateDogClassesGrid(string entrantID)
        {
            string connString = Utils.ConnectionString();

            Guid entrant_ID = new Guid(entrantID);

            DogClasses        dogClasses = new DogClasses(connString);
            List <DogClasses> dcList     = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);

            DataTable dt = new DataTable();

            DataColumn dcDogClassID     = new DataColumn("DogClassID");
            DataColumn dcEntrantID      = new DataColumn("EntrantID");
            DataColumn dcDogID          = new DataColumn("DogID");
            DataColumn dcKCName         = new DataColumn("KCName");
            DataColumn dcBreed          = new DataColumn("Breed");
            DataColumn dcGender         = new DataColumn("Gender");
            DataColumn dcRegNo          = new DataColumn("RegNo");
            DataColumn dcDOB            = new DataColumn("DOB");
            DataColumn dcMeritPoints    = new DataColumn("MeritPoints");
            DataColumn dcBreeder        = new DataColumn("Breeder");
            DataColumn dcSire           = new DataColumn("Sire");
            DataColumn dcDam            = new DataColumn("Dam");
            DataColumn dcEntryClassName = new DataColumn("EntryClassName");
            DataColumn dcPreferredPart  = new DataColumn("PreferredPart");
            DataColumn dcFinalClassName = new DataColumn("FinalClassName");
            DataColumn dcHandler        = new DataColumn("Handler");
            DataColumn dcRingNo         = new DataColumn("RingNo");
            DataColumn dcRunningOrder   = new DataColumn("RunningOrder");
            DataColumn dcSpecialRequest = new DataColumn("SpecialRequest");

            dt.Columns.Add(dcDogClassID);
            dt.Columns.Add(dcEntrantID);
            dt.Columns.Add(dcDogID);
            dt.Columns.Add(dcKCName);
            dt.Columns.Add(dcBreed);
            dt.Columns.Add(dcGender);
            dt.Columns.Add(dcRegNo);
            dt.Columns.Add(dcDOB);
            dt.Columns.Add(dcMeritPoints);
            dt.Columns.Add(dcBreeder);
            dt.Columns.Add(dcSire);
            dt.Columns.Add(dcDam);
            dt.Columns.Add(dcEntryClassName);
            dt.Columns.Add(dcPreferredPart);
            dt.Columns.Add(dcFinalClassName);
            dt.Columns.Add(dcHandler);
            dt.Columns.Add(dcRingNo);
            dt.Columns.Add(dcRunningOrder);
            dt.Columns.Add(dcSpecialRequest);

            object[] dogRow = new object[19];
            foreach (DogClasses dc in dcList)
            {
                Dogs             dog = new Dogs(connString, (Guid)dc.Dog_ID);
                ShowEntryClasses sec = new ShowEntryClasses(connString, (Guid)dc.Show_Entry_Class_ID);
                ClassNames       cn  = new ClassNames(connString, (int)sec.Class_Name_ID);
                DogBreeds        db  = new DogBreeds(connString, (int)dog.Dog_Breed_ID);
                DogGender        dg  = new DogGender(connString, (int)dog.Dog_Gender_ID);

                dogRow[0] = dc.Dog_Class_ID;
                dogRow[1] = entrant_ID;
                dogRow[2] = dog.Dog_ID;
                dogRow[3] = dog.Dog_KC_Name;
                dogRow[4] = db.Description;
                dogRow[5] = dg.Description;
                dogRow[6] = dog.Reg_No;
                DateTime DOB = (DateTime)dog.Date_Of_Birth;
                dogRow[7]  = string.Format("{0}/{1}/{2}", DOB.Day, DOB.Month, DOB.Year);
                dogRow[8]  = dog.Merit_Points;
                dogRow[9]  = dog.Breeder;
                dogRow[10] = dog.Sire;
                dogRow[11] = dog.Dam;
                dogRow[12] = string.Concat(sec.Class_No, " - ", cn.Class_Name_Description);
                dogRow[13] = dc.Preferred_Part.ToString();
                if (dc.Show_Final_Class_ID != null && dc.Show_Final_Class_ID != new Guid())
                {
                    ShowFinalClasses sfc = new ShowFinalClasses(connString, (Guid)dc.Show_Final_Class_ID);
                    dogRow[14] = sfc.Show_Final_Class_Description;
                }
                else
                {
                    dogRow[14] = "Not Yet Assigned";
                }
                People handler = new People(connString, (Guid)dc.Handler_ID);
                dogRow[15] = handler.Person_FullName;
                dogRow[16] = string.IsNullOrWhiteSpace(dc.Ring_No.ToString()) ? "Not Yet Assigned" : dc.Ring_No.ToString();
                dogRow[17] = string.IsNullOrWhiteSpace(dc.Running_Order.ToString()) ? "Not Yet Assigned" : dc.Running_Order.ToString();
                dogRow[18] = dc.Special_Request;

                dt.Rows.Add(dogRow);
            }
            dgvDogClasses.DataSource = dt;
            dgvDogClasses.Columns["DogClassID"].Visible = false;
            dgvDogClasses.Columns["EntrantID"].Visible  = false;
            dgvDogClasses.Columns["DogID"].Visible      = false;
            //dgvDogClasses.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            //dgvDogClasses.AutoSize = true;
        }
Exemplo n.º 10
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(_connString);
                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(_connString, Convert.ToInt32(row.Dog_Breed_ID));
                newDog.Dog_Breed_Description = dogBreeds.Description;
                DogGender dogGender = new DogGender(_connString, 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();
    }
Exemplo n.º 11
0
 public ShelterDogs(DogBreeds b)
 {
     Breed = b;
 }
Exemplo n.º 12
0
    private void PopulateDog()
    {
        Guid current_dog_ID = new Guid(Current_Dog_ID);
        Dogs dog            = new Dogs(_connString, 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(_connString, 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(_connString, 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(_connString);
        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(_connString);
        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();
        }
    }
Exemplo n.º 13
0
 /// <summary>
 /// Get an array of dogs sub-breeds via <see cref="DogBreeds"/>
 /// </summary>
 /// <param name="index"></param>
 /// <returns></returns>
 public string[] this[DogBreeds index]
 {
     get
     {
         return(index switch
         {
             DogBreeds.affenpinscher => affenpinscher,
             DogBreeds.african => african,
             DogBreeds.airedale => airedale,
             DogBreeds.akita => akita,
             DogBreeds.appenzeller => appenzeller,
             DogBreeds.australian => australian,
             DogBreeds.basenji => basenji,
             DogBreeds.beagle => beagle,
             DogBreeds.bluetick => bluetick,
             DogBreeds.borzoi => borzoi,
             DogBreeds.bouvier => bouvier,
             DogBreeds.boxer => boxer,
             DogBreeds.brabancon => brabancon,
             DogBreeds.briard => briard,
             DogBreeds.bulldog => bulldog,
             DogBreeds.bullterrier => bullterrier,
             DogBreeds.cairn => cairn,
             DogBreeds.cattledog => cattledog,
             DogBreeds.chihuahua => chihuahua,
             DogBreeds.chow => chow,
             DogBreeds.clumber => clumber,
             DogBreeds.cockapoo => cockapoo,
             DogBreeds.collie => collie,
             DogBreeds.coonhound => coonhound,
             DogBreeds.corgi => corgi,
             DogBreeds.cotondetulear => cotondetulear,
             DogBreeds.dachshund => dachshund,
             DogBreeds.dalmatian => dalmatian,
             DogBreeds.dane => dane,
             DogBreeds.deerhound => deerhound,
             DogBreeds.dhole => dhole,
             DogBreeds.dingo => dingo,
             DogBreeds.doberman => doberman,
             DogBreeds.elkhound => elkhound,
             DogBreeds.entlebucher => entlebucher,
             DogBreeds.eskimo => eskimo,
             DogBreeds.finnish => finnish,
             DogBreeds.frise => frise,
             DogBreeds.germanshepherd => germanshepherd,
             DogBreeds.greyhound => greyhound,
             DogBreeds.groenendael => groenendael,
             DogBreeds.havanese => havanese,
             DogBreeds.hound => hound,
             DogBreeds.husky => husky,
             DogBreeds.keeshond => keeshond,
             DogBreeds.kelpie => kelpie,
             DogBreeds.komondor => komondor,
             DogBreeds.kuvasz => kuvasz,
             DogBreeds.labradoodle => labradoodle,
             DogBreeds.labrador => labrador,
             DogBreeds.leonberg => leonberg,
             DogBreeds.lhasa => lhasa,
             DogBreeds.malamute => malamute,
             DogBreeds.malinois => malinois,
             DogBreeds.maltese => maltese,
             DogBreeds.mastiff => mastiff,
             DogBreeds.mexicanhairless => mexicanhairless,
             DogBreeds.mix => mix,
             DogBreeds.mountain => mountain,
             DogBreeds.newfoundland => newfoundland,
             DogBreeds.otterhound => otterhound,
             DogBreeds.ovcharka => ovcharka,
             DogBreeds.papillon => papillon,
             DogBreeds.pekinese => pekinese,
             DogBreeds.pembroke => pembroke,
             DogBreeds.pinscher => pinscher,
             DogBreeds.pitbull => pitbull,
             DogBreeds.pointer => pointer,
             DogBreeds.pomeranian => pomeranian,
             DogBreeds.poodle => poodle,
             DogBreeds.pug => pug,
             DogBreeds.puggle => puggle,
             DogBreeds.pyrenees => pyrenees,
             DogBreeds.redbone => redbone,
             DogBreeds.retriever => retriever,
             DogBreeds.ridgeback => ridgeback,
             DogBreeds.rottweiler => rottweiler,
             DogBreeds.saluki => saluki,
             DogBreeds.samoyed => samoyed,
             DogBreeds.schipperke => schipperke,
             DogBreeds.schnauzer => schnauzer,
             DogBreeds.setter => setter,
             DogBreeds.sheepdog => sheepdog,
             DogBreeds.shiba => shiba,
             DogBreeds.shihtzu => shihtzu,
             DogBreeds.spaniel => spaniel,
             DogBreeds.springer => springer,
             DogBreeds.stbernard => stbernard,
             DogBreeds.terrier => terrier,
             DogBreeds.vizsla => vizsla,
             DogBreeds.waterdog => waterdog,
             DogBreeds.weimaraner => weimaraner,
             DogBreeds.whippet => whippet,
             DogBreeds.wolfhound => wolfhound,
             _ => Array.Empty <string>(),
         });