public static bool UnAllocateDogsFromFinalClasses(string connString, Guid user_ID) { bool retVal = false; try { List <EntryClassesCount> entryClassesList = new List <EntryClassesCount>(); EntryClassesCount entryClasses = new EntryClassesCount(connString); entryClassesList = entryClasses.GetEntryClassCount(); foreach (EntryClassesCount entryClass in entryClassesList) { List <DogClasses> dogClassList = new List <DogClasses>(); DogClasses dogClasses = new DogClasses(connString); dogClassList = dogClasses.GetDog_ClassesByShow_Entry_Class_ID(entryClass.Show_Entry_Class_ID); foreach (DogClasses row in dogClassList) { row.Show_Final_Class_ID = null; Guid dog_Class_ID = new Guid(row.Dog_Class_ID.ToString()); retVal = row.Update_Dog_Class(dog_Class_ID, user_ID); } } } catch (Exception ex) { throw ex; } return(retVal); }
public static bool UnAllocateDogsFromFinalClasses(Guid user_ID) { bool success = false; List<EntryClassesCount> entryClassesList = new List<EntryClassesCount>(); EntryClassesCount entryClasses = new EntryClassesCount(); entryClassesList = entryClasses.GetEntryClassCount(); foreach (EntryClassesCount entryClass in entryClassesList) { List<DogClasses> dogClassList = new List<DogClasses>(); DogClasses dogClasses = new DogClasses(); dogClassList = dogClasses.GetDog_ClassesByShow_Entry_Class_ID(entryClass.Show_Entry_Class_ID); foreach (DogClasses row in dogClassList) { row.Show_Final_Class_ID = null; Guid dog_Class_ID = new Guid(row.Dog_Class_ID.ToString()); success = row.Update_Dog_Class(dog_Class_ID, user_ID); } } return success; }
public static bool AllocateDogsToFinalClasses(Guid show_ID, Guid user_ID) { bool success = false; List<ShowEntryClasses> showEntryClassList = new List<ShowEntryClasses>(); ShowEntryClasses showEntryClasses = new ShowEntryClasses(); showEntryClassList = showEntryClasses.GetShow_Entry_ClassesByShow_ID(show_ID); foreach (ShowEntryClasses showEntryClass in showEntryClassList) { List<ShowFinalClasses> showFinalClassList = new List<ShowFinalClasses>(); ShowFinalClasses showFinalClasses = new ShowFinalClasses(); showFinalClassList = showFinalClasses.GetShow_Final_ClassesByShow_Entry_Class_ID(showEntryClass.Show_Entry_Class_ID); if (showFinalClassList != null && showFinalClassList.Count > 0) { List<DogClasses> dogClassList = new List<DogClasses>(); DogClasses dogClasses = new DogClasses(); dogClassList = dogClasses.GetDog_ClassesByShow_Entry_Class_ID(showEntryClass.Show_Entry_Class_ID); if (showFinalClassList.Count == 1) { foreach (DogClasses dogClass in dogClassList) { dogClass.Show_Final_Class_ID = showFinalClassList[0].Show_Final_Class_ID; Guid dog_Class_ID = new Guid(dogClass.Dog_Class_ID.ToString()); success = dogClass.Update_Dog_Class(dog_Class_ID, user_ID); } } else { List<ClassParts> classParts = new List<ClassParts>(); foreach (ShowFinalClasses showFinalClass in showFinalClassList) { ClassParts classPart = new ClassParts(); FinalClassNames finalClassNames = new FinalClassNames(showFinalClass.Show_Final_Class_No); classPart.Show_Final_Class_ID = showFinalClass.Show_Final_Class_ID; classPart.Show_Final_Class_Description = showFinalClass.Show_Final_Class_Description; classPart.MaxDogsInPart = finalClassNames.Entries; classParts.Add(classPart); } List<DogsInClass> allDogsInClass = new List<DogsInClass>(); allDogsInClass = AllocateDogsToClassParts(dogClassList, classParts); List<DogClasses> failedUpdateList = new List<DogClasses>(); foreach (DogsInClass dog in allDogsInClass) { DogClasses dogClass = new DogClasses(dog.Dog_Class_ID); dogClass.Show_Final_Class_ID = dog.Show_Final_Class_ID; success = dogClass.Update_Dog_Class(dog.Dog_Class_ID, user_ID); if (!success) failedUpdateList.Add(dogClass); } } } } return success; }
public static bool AllocateDogsToFinalClasses(string connString, Guid show_ID, Guid user_ID) { bool retVal = false; try { List <ShowEntryClasses> showEntryClassList = new List <ShowEntryClasses>(); ShowEntryClasses showEntryClasses = new ShowEntryClasses(connString); showEntryClassList = showEntryClasses.GetShow_Entry_ClassesByShow_ID(show_ID); foreach (ShowEntryClasses showEntryClass in showEntryClassList) { List <ShowFinalClasses> showFinalClassList = new List <ShowFinalClasses>(); ShowFinalClasses showFinalClasses = new ShowFinalClasses(connString); showFinalClassList = showFinalClasses.GetShow_Final_ClassesByShow_Entry_Class_ID(showEntryClass.Show_Entry_Class_ID); if (showFinalClassList != null && showFinalClassList.Count > 0) { List <DogClasses> dogClassList = new List <DogClasses>(); DogClasses dogClasses = new DogClasses(connString); dogClassList = dogClasses.GetDog_ClassesByShow_Entry_Class_ID(showEntryClass.Show_Entry_Class_ID); if (showFinalClassList.Count == 1) { foreach (DogClasses dogClass in dogClassList) { dogClass.Show_Final_Class_ID = showFinalClassList[0].Show_Final_Class_ID; Guid dog_Class_ID = new Guid(dogClass.Dog_Class_ID.ToString()); retVal = dogClass.Update_Dog_Class(dog_Class_ID, user_ID); } } else { List <ClassParts> classParts = new List <ClassParts>(); foreach (ShowFinalClasses showFinalClass in showFinalClassList) { ClassParts classPart = new ClassParts(); FinalClassNames finalClassNames = new FinalClassNames(connString, showFinalClass.Show_Final_Class_No); classPart.Show_Final_Class_ID = showFinalClass.Show_Final_Class_ID; classPart.Show_Final_Class_Description = showFinalClass.Show_Final_Class_Description; classPart.MaxDogsInPart = finalClassNames.Entries; classParts.Add(classPart); } List <DogsInClass> allDogsInClass = new List <DogsInClass>(); allDogsInClass = AllocateDogsToClassParts(connString, dogClassList, classParts, show_ID); List <DogClasses> failedUpdateList = new List <DogClasses>(); foreach (DogsInClass dog in allDogsInClass) { DogClasses dogClass = new DogClasses(connString, dog.Dog_Class_ID); dogClass.Show_Final_Class_ID = dog.Show_Final_Class_ID; retVal = dogClass.Update_Dog_Class(dog.Dog_Class_ID, user_ID); if (!retVal) { failedUpdateList.Add(dogClass); } } } } } } catch (Exception ex) { throw ex; } return(retVal); }