Exemple #1
0
    private void PopulateOwnerList(DropDownList listToPopulate)
    {
        Guid             show_ID      = new Guid(Show_ID);
        DogOwnerList     dogOwnerList = new DogOwnerList();
        List <DogOwners> lnkDog_Owners;
        DogOwners        dogOwner = new DogOwners(_connString);

        lnkDog_Owners = dogOwner.GetDogOwnersByShow_ID(show_ID);
        if (lnkDog_Owners != null && lnkDog_Owners.Count > 0)
        {
            foreach (DogOwners dogOwnerRow in lnkDog_Owners)
            {
                People person = new People(_connString, dogOwnerRow.Owner_ID);
                dogOwnerList.AddOwner(person);
            }
            dogOwnerList.Sort();
        }
        List <OwnersDogsClassesHandlers> ownerList = new List <OwnersDogsClassesHandlers>();

        if (dogOwnerList != null)
        {
            foreach (People ownerRow in dogOwnerList.MyDogOwnerList)
            {
                OwnersDogsClassesHandlers owner = new OwnersDogsClassesHandlers(_connString);
                owner.Owner    = string.Format("{0} {1} {2}", ownerRow.Person_Title, ownerRow.Person_Forename, ownerRow.Person_Surname).TrimStart();
                owner.Owner_ID = ownerRow.Person_ID;
                ownerList.Add(owner);
            }
        }
        if (ownerList != null && ownerList.Count > 0)
        {
            listToPopulate.DataSource = ownerList;
            listToPopulate.DataBind();
        }
    }
Exemple #2
0
 protected void EntryGridView_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         EntryGridRowIndex = e.Row.RowIndex;
         Entrant_ID        = EntryGridView.DataKeys[EntryGridRowIndex].Value.ToString();
         if (!string.IsNullOrEmpty(Entrant_ID))
         {
             Guid              entrant_ID = new Guid(Entrant_ID);
             GridView          gvDogs     = e.Row.FindControl("DogGridView") as GridView;
             GridView          gvOwners   = e.Row.FindControl("OwnerGridView") as GridView;
             List <DogClasses> tblDog_Classes;
             DogClasses        dogClasses = new DogClasses(_connString);
             tblDog_Classes = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID, ExclNFC);
             if (tblDog_Classes != null && tblDog_Classes.Count > 0)
             {
                 DogOwnerList dogOwnerList = new DogOwnerList();
                 DogList      dogList      = new DogList();
                 foreach (DogClasses dogClassRow in tblDog_Classes)
                 {
                     Dogs dog = new Dogs(_connString, (Guid)dogClassRow.Dog_ID);
                     dogList.AddDog(dog);
                     List <DogOwners> lnkDog_Owners;
                     DogOwners        dogOwner = new DogOwners(_connString);
                     lnkDog_Owners = dogOwner.GetDogOwnersByDog_ID((Guid)dogClassRow.Dog_ID);
                     if (lnkDog_Owners != null && lnkDog_Owners.Count > 0)
                     {
                         foreach (DogOwners dogOwnerRow in lnkDog_Owners)
                         {
                             People person = new People(_connString, dogOwnerRow.Owner_ID);
                             dogOwnerList.AddOwner(person);
                         }
                         gvOwners.DataSource = dogOwnerList.MyDogOwnerList;
                         gvOwners.DataBind();
                     }
                     dogList.SortDogList();
                     gvDogs.DataSource = dogList.MyDogList;
                     gvDogs.DataBind();
                 }
             }
         }
     }
 }
Exemple #3
0
    protected void AddOwnerToList(string owner_ID)
    {
        Guid         new_Owner_ID = new Guid(owner_ID);
        People       person       = new People(_connString, new_Owner_ID);
        DogOwnerList ownerList    = new DogOwnerList();

        ownerList.MyDogOwnerList = Common.DogOwnerList;
        People pp = null;

        if (ownerList.MyDogOwnerList != null)
        {
            pp = ownerList.MyDogOwnerList.Find(delegate(People p) { return(p.Person_ID == new_Owner_ID); });
        }
        if (pp == null)
        {
            int ownerCount = ownerList.AddOwner(person);
            PopulateOwnerGridView(ownerList.MyDogOwnerList);
            Common.DogOwnerList = ownerList.MyDogOwnerList;
        }
    }