public List <DogOwners> GetDogOwnersByShow_ID(Guid show_ID) { List <DogOwners> dogOwnerList = new List <DogOwners>(); DogOwnersBL dogOwners = new DogOwnersBL(_connString); lnkDogOwners = dogOwners.GetDog_OwnersByShow_ID(show_ID); if (lnkDogOwners != null && lnkDogOwners.Rows.Count > 0) { foreach (DataRow row in lnkDogOwners.Rows) { DogOwners dogOwner = new DogOwners(_connString, Utils.DBNullToGuid(row["Dog_Owner_ID"])); dogOwnerList.Add(dogOwner); } } return(dogOwnerList); }
private void SetOwnerDogCounts(sss.tblOwnersDogsClassesDrawnListRow row, Guid show_ID) { RunningOrders.OwnerDogCount = 0; RunningOrders.OwnerDogsInClassCount = 0; RunningOrders.ClassesPerOwnerEnteredCount = 0; RunningOrders.ClassesPerDogEnteredCount = 0; List<Guid> ownerDogsList = new List<Guid>(); List<Guid> ownerDogsInClassList = new List<Guid>(); List<Guid> classesPerOwnerEnteredList = new List<Guid>(); List<Guid> classesPerDogEnteredList = new List<Guid>(); DogClasses dogClass = new DogClasses(); List<DogClasses> dogClasses1 = dogClass.GetDog_ClassesByDog_ID((Guid)row.Dog_ID); foreach (DogClasses dogClass1 in dogClasses1) { ShowFinalClasses sfc = new ShowFinalClasses((Guid)dogClass1.Show_Final_Class_ID); if ((Guid)sfc.Show_ID == show_ID) { if (classesPerDogEnteredList.IndexOf((Guid)dogClass1.Show_Entry_Class_ID) == -1) classesPerDogEnteredList.Add((Guid)dogClass1.Show_Entry_Class_ID); } } DogOwners dogOwner = new DogOwners(); List<DogOwners> dogOwnerList = dogOwner.GetDogOwnersByOwner_ID(row.Owner_ID); foreach (DogOwners dogOwnerRow in dogOwnerList) { List<DogClasses> dogClasses = dogClass.GetDog_ClassesByEntrant_ID(row.Entrant_ID); foreach (DogClasses dcRow in dogClasses) { ShowFinalClasses sfc = new ShowFinalClasses((Guid)dcRow.Show_Final_Class_ID); if ((Guid)sfc.Show_ID == show_ID) { Guid dog_ID = (Guid)dcRow.Dog_ID; Guid dog_Class_ID = (Guid)dcRow.Dog_Class_ID; Guid show_Entry_Class_ID = (Guid)dcRow.Show_Entry_Class_ID; ShowEntryClasses sec = new ShowEntryClasses(show_Entry_Class_ID); ClassNames cn = new ClassNames(int.Parse(sec.Class_Name_ID.ToString())); if (cn.Class_Name_Description != "NFC") { if (ownerDogsList.IndexOf(dog_ID) == -1) ownerDogsList.Add(dog_ID); if (classesPerOwnerEnteredList.IndexOf(show_Entry_Class_ID) == -1) classesPerOwnerEnteredList.Add(show_Entry_Class_ID); if (dcRow.Show_Entry_Class_ID == sfc.Show_Entry_Class_ID) { if (ownerDogsInClassList.IndexOf(dog_ID) == -1) ownerDogsInClassList.Add(dog_ID); } } } } } RunningOrders.OwnerDogCount = ownerDogsList.Count; RunningOrders.OwnerDogsInClassCount = ownerDogsInClassList.Count; RunningOrders.ClassesPerOwnerEnteredCount = classesPerOwnerEnteredList.Count; RunningOrders.ClassesPerDogEnteredCount = classesPerDogEnteredList.Count; }
private bool IsOldestDog(sss.tblOwnersDogsClassesDrawnListRow row) { bool oldestDog = true; Dogs currentDog = new Dogs(row.Dog_ID); int? currentYOB = currentDog.Year_Of_Birth; if(currentYOB == null) { DateTime? currentDOB = currentDog.Date_Of_Birth; if(currentDOB != null) { DateTime dteCurrentDOB = (DateTime)currentDOB; currentYOB = dteCurrentDOB.Year; } else { return true; } } DogOwners dogOwner = new DogOwners(); List<DogOwners> dogOwnerList = dogOwner.GetDogOwnersByOwner_ID(row.Owner_ID); foreach (DogOwners dogOwnerRow in dogOwnerList) { if (dogOwnerRow.Dog_ID != row.Dog_ID) { Dogs thisDog = new Dogs(dogOwnerRow.Dog_ID); int? thisYOB = thisDog.Year_Of_Birth; if (thisYOB == null) { DateTime? thisDOB = thisDog.Date_Of_Birth; if (thisDOB != null) { DateTime dteThisDOB = (DateTime)thisDOB; thisYOB = dteThisDOB.Year; } else { thisYOB=0; } } if (thisYOB < currentYOB) return false; } } return oldestDog; }
private void PopulateOwnerList(Guid entrant_ID) { bool foundOwner = false; List<DogClasses> tblDogClasses; DogClasses dogClasses = new DogClasses(); tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID); foreach (DogClasses dogClassesRow in tblDogClasses) { Guid dog_ID = new Guid(dogClassesRow.Dog_ID.ToString()); List<DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners row in lnkDogOwners) { AddOwnerToList(row.Owner_ID.ToString()); foundOwner = true; } } if (foundOwner) divOwnerList.Visible = true; }
private void PopulateOwnerList(DropDownList listToPopulate) { Guid show_ID = new Guid(Show_ID); DogOwnerList dogOwnerList = new DogOwnerList(); List<DogOwners> lnkDog_Owners; DogOwners dogOwner = new DogOwners(); 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(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(); 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(); } }
private void PopulateOwnerList() { bool foundOwner = false; Guid dog_ID = new Guid(Current_Dog_ID); List<DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners row in lnkDogOwners) { AddOwnerToList(row.Owner_ID.ToString()); foundOwner = true; } if(foundOwner) divOwnerList.Visible = true; }
private bool InsertDogOwners(Guid dog_ID, Guid user_ID) { bool insertOK = true; for (int i = 0; i < Common.DogOwnerList.Count; i++) { bool ownerFound = false; List<DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners row in lnkDogOwners) { if (Common.DogOwnerList[i].Person_ID == row.Owner_ID) { ownerFound = true; } } if (!ownerFound) { DogOwners dogOwner = new DogOwners(); dogOwner.Dog_ID = dog_ID; dogOwner.Owner_ID = Common.DogOwnerList[i].Person_ID; Guid? dog_Owner_ID = dogOwner.Insert_Dog_Owner(user_ID); if (dog_Owner_ID == null) insertOK = false; } } return insertOK; }
private short HasOwnerChanges() { bool Changed = false; short del = Constants.DATA_NO_CHANGE; short ins = Constants.DATA_NO_CHANGE; List<DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(); Guid dog_ID = new Guid(Current_Dog_ID); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners dogOwnersRow in lnkDogOwners) { bool foundOwner = false; if (Common.DogOwnerList != null && Common.DogOwnerList.Count != 0) { for (int i = 0; i < Common.DogOwnerList.Count; i++) { if (Common.DogOwnerList[i].Person_ID == dogOwnersRow.Owner_ID) //Dog in table still exists in list foundOwner = true; } } if (!foundOwner) //Dog in table no longer exists in list (deleted) Changed = true; } if (Changed) del = Constants.DATA_DELETED; Changed = false; if (Common.DogOwnerList != null && Common.DogOwnerList.Count != 0) { for (int i = 0; i < Common.DogOwnerList.Count; i++) { bool foundOwner = false; foreach (DogOwners dogOwnersRow in lnkDogOwners) { if (Common.DogOwnerList[i].Person_ID == dogOwnersRow.Owner_ID) //Dog in List already exists in table foundOwner = true; } if (!foundOwner) //Dog in list does not exist in table (inserted) Changed = true; } } else { if (lnkDogOwners.Count > 0) Changed = true; } if (Changed) ins = Constants.DATA_INSERTED; return del += ins; }
private bool DeleteDogOwners(Guid dog_ID, Guid user_ID) { bool deletedOK = false; List<DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners row in lnkDogOwners) { bool ownerFound = false; for (int i = 0; i < Common.DogOwnerList.Count; i++) { if (Common.DogOwnerList[i].Person_ID == row.Owner_ID) { ownerFound = true; } } if (!ownerFound) { DogOwners dogOwner = new DogOwners(row.Dog_Owner_ID); dogOwner.DeleteDogOwner = true; deletedOK = dogOwner.Update_Dog_Owner(row.Dog_Owner_ID, user_ID); } } return deletedOK; }
protected void btnSaveDog_Click(object sender, EventArgs e) { SaveFormFields(); StoreCommon(); MembershipUser userInfo = Membership.GetUser(); Guid user_ID = (Guid)userInfo.ProviderUserKey; bool Changed = false; string petName=null; bool DogChanges = false; bool DogSuccess = false; bool OwnerChanges = false; bool OwnerSuccess = false; bool BreederChanges = false; bool BreederSuccess = false; if (!string.IsNullOrEmpty(Current_Dog_ID)) { Guid dog_ID = new Guid(Current_Dog_ID); Dogs dog = new Dogs(dog_ID); petName=dog.Dog_Pet_Name; if (ValidDog()) { if (HasDogChanges()) { DogChanges = true; if (dog.Merit_Points.ToString() != Merit_Points && !string.IsNullOrEmpty(Merit_Points)) dog.Merit_Points = short.Parse(Merit_Points); if (dog.NLWU == null && NLWU) dog.NLWU = NLWU; if (dog.NLWU != null) { if ((bool)dog.NLWU != NLWU) dog.NLWU = null; } DogSuccess = dog.Update_Dog(dog_ID, user_ID); if (!DogSuccess) MessageLabel.Text += " Update_Dog Failed!"; if (!string.IsNullOrEmpty(btnReturn.PostBackUrl)) DivReturn.Visible = true; } else DogSuccess = true; List<DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); bool insertOK = true; bool deleteOK = true; switch (HasOwnerChanges()) { case Constants.DATA_NO_CHANGE: OwnerSuccess = true; break; case Constants.DATA_INSERTED: OwnerChanges = true; insertOK = InsertDogOwners(dog_ID, user_ID); if (insertOK) OwnerSuccess = true; else MessageLabel.Text = "Insert_Dog_Owners Failed"; break; case Constants.DATA_DELETED: OwnerChanges = true; deleteOK = DeleteDogOwners(dog_ID, user_ID); if (deleteOK) OwnerSuccess = true; else MessageLabel.Text = "Delete_Dog_Owners Failed"; break; case Constants.DATA_INSERTED_AND_DELETED: OwnerChanges = true; insertOK = InsertDogOwners(dog_ID, user_ID); deleteOK = DeleteDogOwners(dog_ID, user_ID); if (insertOK && deleteOK) OwnerSuccess = true; else { MessageLabel.Text = string.Empty; if (!insertOK) MessageLabel.Text = "Insert_Dog_Owners Failed"; if (!deleteOK) MessageLabel.Text += "Delete_Dog_Owners Failed"; } break; default: break; } List<DogBreeders> lnkDogBreeders; DogBreeders dogBreeders = new DogBreeders(); lnkDogBreeders = dogBreeders.GetDogBreedersByDog_ID(dog_ID); insertOK = true; deleteOK = true; switch (HasBreederChanges()) { case Constants.DATA_NO_CHANGE: BreederSuccess = true; break; case Constants.DATA_INSERTED: BreederChanges = true; insertOK = InsertDogBreeders(dog_ID, user_ID); if (insertOK) BreederSuccess = true; else MessageLabel.Text = "Insert_Dog_Breeders Failed"; break; case Constants.DATA_DELETED: BreederChanges = true; deleteOK = DeleteDogBreeders(dog_ID, user_ID); if (deleteOK) BreederSuccess = true; else MessageLabel.Text = "Delete_Dog_Breeders Failed"; break; case Constants.DATA_INSERTED_AND_DELETED: BreederChanges = true; insertOK = InsertDogBreeders(dog_ID, user_ID); deleteOK = DeleteDogBreeders(dog_ID, user_ID); if (insertOK && deleteOK) BreederSuccess = true; else { MessageLabel.Text = string.Empty; if (!insertOK) MessageLabel.Text = "Insert_Dog_Breeders Failed"; if (!deleteOK) MessageLabel.Text += "Delete_Dog_Breeders Failed"; } break; default: break; } if (HasDamChanges()) { DogDams dogDam = new DogDams(); List<DogDams> lnkDogDams; lnkDogDams = dogDam.GetDogDamsByDog_ID(dog_ID); if (lnkDogDams.Count == 0) { DogDams newDogDams = new DogDams(); newDogDams.Dog_ID = dog_ID; newDogDams.Dam_ID = new Guid(Dam_ID); Guid? dog_Dam_ID = newDogDams.Insert_Dog_Dams(user_ID); } else { Guid dog_Dam_ID = lnkDogDams[0].Dog_Dam_ID; DogDams newDogDams = new DogDams(dog_Dam_ID); newDogDams.Dam_ID = new Guid(Dam_ID); newDogDams.Update_Dog_Dams(dog_Dam_ID, user_ID); } Changed = true; } if (HasSireChanges()) { DogSires dogSire = new DogSires(); List<DogSires> lnkDogSires; lnkDogSires = dogSire.GetDogSiresByDog_ID(dog_ID); if (lnkDogSires.Count == 0) { DogSires newDogSires = new DogSires(); newDogSires.Dog_ID = dog_ID; newDogSires.Sire_ID = new Guid(Sire_ID); Guid? dog_Sire_ID = newDogSires.Insert_Dog_Sire(user_ID); } else { Guid dog_Sire_ID = lnkDogSires[0].Dog_Sire_ID; DogSires newDogSires = new DogSires(dog_Sire_ID); newDogSires.Sire_ID = new Guid(Sire_ID); newDogSires.Update_Dog_Sire(dog_Sire_ID, user_ID); } Changed = true; } if (OwnerChanges || BreederChanges || DogChanges) Changed = true; if (OwnerChanges && !OwnerSuccess) MessageLabel.Text += " Error with Owner Changes!"; if (BreederChanges && !BreederSuccess) MessageLabel.Text += " Error with Breeder Changes!"; if (DogChanges && !DogSuccess) MessageLabel.Text += " Error with Dog Changes!"; if (Changed) { if (OwnerSuccess && BreederSuccess && DogSuccess) { MessageLabel.Text = string.Format("{0} was updated successfully.", petName); PopulateDog(); } else { MessageLabel.Text = string.Format("{0}{1}", "Problem!", MessageLabel.Text); } } else { MessageLabel.Text = "Update cancelled as no changes have been made."; } } } }
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(); 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((Guid)dogClassRow.Dog_ID); dogList.AddDog(dog); List<DogOwners> lnkDog_Owners; DogOwners dogOwner = new DogOwners(); 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(dogOwnerRow.Owner_ID); dogOwnerList.AddOwner(person); } gvOwners.DataSource = dogOwnerList.MyDogOwnerList; gvOwners.DataBind(); } dogList.SortDogList(); gvDogs.DataSource = dogList.MyDogList; gvDogs.DataBind(); } } } } }
private static List<DogsInClass> AllocateDogsToClassParts(List<DogClasses> dogClassList, List<ClassParts> classParts) { PartCount = 0; List<DogsInClass> allDogsInClass = new List<DogsInClass>(); foreach (DogClasses dogClass in dogClassList) { Guid show_Entry_Class_ID = new Guid(dogClass.Show_Entry_Class_ID.ToString()); List<DogOwners> dogOwnersList = new List<DogOwners>(); DogOwners dogOwners = new DogOwners(); Guid dog_ID = new Guid(dogClass.Dog_ID.ToString()); dogOwnersList = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners owner in dogOwnersList) { List<DogOwners> dogOwnerDogList = new List<DogOwners>(); DogOwners dogOwnerDogs = new DogOwners(); dogOwnerDogList = dogOwnerDogs.GetDogOwnersByOwner_ID(owner.Owner_ID); List<Dogs> ownerDogsInClassList = new List<Dogs>(); ownerDogsInClassList = OwnerDogsInCurrentClass(dogOwnerDogList, show_Entry_Class_ID); if (ownerDogsInClassList.Count == 1) { if (!FoundInList(allDogsInClass, ownerDogsInClassList[0].Dog_ID)) { Dogs dog = new Dogs(ownerDogsInClassList[0].Dog_ID); DogsInClass dogInClass = new DogsInClass(); dogInClass.Dog = dog; dogInClass.Dog_Class_ID = GetDogClassID(dog.Dog_ID, show_Entry_Class_ID); dogInClass.Show_Final_Class_ID = NextPart(classParts); dogInClass.AddToPart = PartCount; allDogsInClass.Add(dogInClass); } } else if (ownerDogsInClassList.Count == 2) { if (!FoundInList(allDogsInClass, ownerDogsInClassList[0].Dog_ID)) { Dogs dog1 = new Dogs(ownerDogsInClassList[0].Dog_ID); DogsInClass dogInClass1 = new DogsInClass(); dogInClass1.Dog = dog1; dogInClass1.Dog_Class_ID = GetDogClassID(dog1.Dog_ID, show_Entry_Class_ID); dogInClass1.Show_Final_Class_ID = NextPart(classParts); dogInClass1.AddToPart = PartCount; allDogsInClass.Add(dogInClass1); } if (!FoundInList(allDogsInClass, ownerDogsInClassList[1].Dog_ID)) { Dogs dog2 = new Dogs(ownerDogsInClassList[1].Dog_ID); DogsInClass dogInClass2 = new DogsInClass(); dogInClass2.Dog = dog2; dogInClass2.Dog_Class_ID = GetDogClassID(dog2.Dog_ID, show_Entry_Class_ID); dogInClass2.Show_Final_Class_ID = NextPart(classParts); dogInClass2.AddToPart = PartCount; allDogsInClass.Add(dogInClass2); } } else { foreach (Dogs ownerDog in ownerDogsInClassList) { if (!FoundInList(allDogsInClass, ownerDog.Dog_ID)) { Dogs dog = new Dogs(ownerDog.Dog_ID); DogsInClass dogInClass = new DogsInClass(); dogInClass.Dog = dog; dogInClass.Dog_Class_ID = GetDogClassID(dog.Dog_ID, show_Entry_Class_ID); dogInClass.Show_Final_Class_ID = NextPart(classParts); dogInClass.AddToPart = PartCount; allDogsInClass.Add(dogInClass); } } } } } return allDogsInClass; }
private void PopulateOwnerList(Guid dog_ID) { Common.DogOwnerList = null; bool foundOwner = false; List<DogOwners> lnkDogOwners; DogOwners dogOwners = new DogOwners(); lnkDogOwners = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners row in lnkDogOwners) { AddOwnerToList(row.Owner_ID.ToString()); foundOwner = true; } if (foundOwner) divOwnerList.Visible = true; }
private static List <DogsInClass> AllocateDogsToClassParts(string connString, List <DogClasses> dogClassList, List <ClassParts> classParts, Guid show_ID) { List <DogsInClass> retVal = new List <DogsInClass>(); try { PartCount = 0; int[] dogsInPart = new int[classParts.Count]; foreach (DogClasses dogClass in dogClassList) { Guid show_Entry_Class_ID = new Guid(dogClass.Show_Entry_Class_ID.ToString()); List <DogOwners> dogOwnersList = new List <DogOwners>(); DogOwners dogOwners = new DogOwners(connString); Guid dog_ID = new Guid(dogClass.Dog_ID.ToString()); dogOwnersList = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners owner in dogOwnersList) { List <DogOwners> dogOwnerDogList = new List <DogOwners>(); DogOwners dogOwnerDogs = new DogOwners(connString); dogOwnerDogList = dogOwnerDogs.GetDogOwnersByOwner_ID(owner.Owner_ID); List <Dogs> ownerDogsInClassList = new List <Dogs>(); ownerDogsInClassList = OwnerDogsInCurrentClass(connString, dogOwnerDogList, show_ID, show_Entry_Class_ID); if (dogClass.Preferred_Part > 0) { foreach (Dogs ownerDog in ownerDogsInClassList) { if (!FoundInList(retVal, ownerDog.Dog_ID)) { Dogs dog = new Dogs(connString, ownerDog.Dog_ID); DogsInClass dogInClass = new DogsInClass(); dogInClass.Dog = dog; dogInClass.Dog_Class_ID = GetDogClassID(connString, dog.Dog_ID, show_Entry_Class_ID); dogInClass.Show_Final_Class_ID = classParts[dogClass.Preferred_Part - 1].Show_Final_Class_ID; dogInClass.AddToPart = dogClass.Preferred_Part; retVal.Add(dogInClass); dogsInPart[dogClass.Preferred_Part - 1]++; } } } } } foreach (DogClasses dogClass in dogClassList) { Guid show_Entry_Class_ID = new Guid(dogClass.Show_Entry_Class_ID.ToString()); List <DogOwners> dogOwnersList = new List <DogOwners>(); DogOwners dogOwners = new DogOwners(connString); Guid dog_ID = new Guid(dogClass.Dog_ID.ToString()); dogOwnersList = dogOwners.GetDogOwnersByDog_ID(dog_ID); foreach (DogOwners owner in dogOwnersList) { List <DogOwners> dogOwnerDogList = new List <DogOwners>(); DogOwners dogOwnerDogs = new DogOwners(connString); dogOwnerDogList = dogOwnerDogs.GetDogOwnersByOwner_ID(owner.Owner_ID); List <Dogs> ownerDogsInClassList = new List <Dogs>(); ownerDogsInClassList = OwnerDogsInCurrentClass(connString, dogOwnerDogList, show_ID, show_Entry_Class_ID); if (dogClass.Preferred_Part > 0) { foreach (Dogs ownerDog in ownerDogsInClassList) { if (!FoundInList(retVal, ownerDog.Dog_ID)) { Dogs dog = new Dogs(connString, ownerDog.Dog_ID); DogsInClass dogInClass = new DogsInClass(); dogInClass.Dog = dog; dogInClass.Dog_Class_ID = GetDogClassID(connString, dog.Dog_ID, show_Entry_Class_ID); dogInClass.Show_Final_Class_ID = classParts[dogClass.Preferred_Part - 1].Show_Final_Class_ID; dogInClass.AddToPart = dogClass.Preferred_Part; retVal.Add(dogInClass); dogsInPart[dogClass.Preferred_Part - 1]++; } } } if (ownerDogsInClassList.Count == 1) { if (!FoundInList(retVal, ownerDogsInClassList[0].Dog_ID)) { Dogs dog = new Dogs(connString, ownerDogsInClassList[0].Dog_ID); DogsInClass dogInClass = new DogsInClass(); dogInClass.Dog = dog; dogInClass.Dog_Class_ID = GetDogClassID(connString, dog.Dog_ID, show_Entry_Class_ID); dogInClass.Show_Final_Class_ID = GetEmptiestClassPart(classParts, dogsInPart); dogInClass.AddToPart = PartCount; retVal.Add(dogInClass); dogsInPart[PartCount - 1]++; } } else if (ownerDogsInClassList.Count == 2) { if (!FoundInList(retVal, ownerDogsInClassList[0].Dog_ID)) { Dogs dog1 = new Dogs(connString, ownerDogsInClassList[0].Dog_ID); DogsInClass dogInClass1 = new DogsInClass(); dogInClass1.Dog = dog1; dogInClass1.Dog_Class_ID = GetDogClassID(connString, dog1.Dog_ID, show_Entry_Class_ID); dogInClass1.Show_Final_Class_ID = NextPart(classParts); dogInClass1.AddToPart = PartCount; retVal.Add(dogInClass1); dogsInPart[PartCount - 1]++; } if (!FoundInList(retVal, ownerDogsInClassList[1].Dog_ID)) { Dogs dog2 = new Dogs(connString, ownerDogsInClassList[1].Dog_ID); DogsInClass dogInClass2 = new DogsInClass(); dogInClass2.Dog = dog2; dogInClass2.Dog_Class_ID = GetDogClassID(connString, dog2.Dog_ID, show_Entry_Class_ID); dogInClass2.Show_Final_Class_ID = NextPart(classParts); dogInClass2.AddToPart = PartCount; retVal.Add(dogInClass2); dogsInPart[PartCount - 1]++; } } else { foreach (Dogs ownerDog in ownerDogsInClassList) { if (!FoundInList(retVal, ownerDog.Dog_ID)) { Dogs dog = new Dogs(connString, ownerDog.Dog_ID); DogsInClass dogInClass = new DogsInClass(); dogInClass.Dog = dog; dogInClass.Dog_Class_ID = GetDogClassID(connString, dog.Dog_ID, show_Entry_Class_ID); dogInClass.Show_Final_Class_ID = NextPart(classParts); dogInClass.AddToPart = PartCount; retVal.Add(dogInClass); dogsInPart[PartCount - 1]++; } } } } } } catch (Exception ex) { throw ex; } return(retVal); }
public List<DogOwners> GetDogOwnersByShow_ID(Guid show_ID) { List<DogOwners> dogOwnerList = new List<DogOwners>(); DogOwnersBL dogOwners = new DogOwnersBL(); lnkDogOwners = dogOwners.GetDog_OwnersByShow_ID(show_ID); if (lnkDogOwners != null && lnkDogOwners.Count > 0) { foreach (sss.lnkDog_OwnersRow row in lnkDogOwners) { DogOwners dogOwner = new DogOwners(row.Dog_Owner_ID); dogOwnerList.Add(dogOwner); } } return dogOwnerList; }