Ejemplo n.º 1
0
        public List <DogClasses> GetDog_ClassesByDog_IDAndShow_Entry_Class_ID(Guid dog_ID, Guid show_Entry_Class_ID)
        {
            List <DogClasses> retVal = new List <DogClasses>();

            try
            {
                DogClassesBL dogClasses = new DogClassesBL(_connString);
                tblDogClasses = dogClasses.GetDog_ClassesByDog_IDAndShow_Entry_Class_ID(dog_ID, show_Entry_Class_ID);

                if (tblDogClasses != null && tblDogClasses.Rows.Count > 0)
                {
                    foreach (DataRow row in tblDogClasses.Rows)
                    {
                        DogClasses dogClass = new DogClasses(_connString, Utils.DBNullToGuid(row["Dog_Class_ID"]));
                        retVal.Add(dogClass);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(retVal);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public List <DogClasses> GetDog_ClassesByEntrant_ID(Guid entrant_ID, bool excl_NFC)
        {
            List <DogClasses> retVal = new List <DogClasses>();

            try
            {
                DogClassesBL dogClasses = new DogClassesBL(_connString);
                tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);

                if (tblDogClasses != null && tblDogClasses.Rows.Count > 0)
                {
                    foreach (DataRow row in tblDogClasses.Rows)
                    {
                        DogClasses dogClass = new DogClasses(_connString, Utils.DBNullToGuid(row["Dog_Class_ID"]));
                        if ((excl_NFC && !dogClass.IsNFC) || !excl_NFC)
                        {
                            retVal.Add(dogClass);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(retVal);
        }
Ejemplo n.º 4
0
        private static List <Dogs> OwnerDogsInCurrentClass(string connString, List <DogOwners> ownerDogList, Guid show_ID, Guid show_Entry_Class_ID)
        {
            List <Dogs> retVal = new List <Dogs>();

            try
            {
                List <Dogs> existsInCurrentClass       = new List <Dogs>();
                List <Dogs> ownerDogsNotInCurrentClass = new List <Dogs>();
                foreach (DogOwners dog in ownerDogList)
                {
                    DogClasses        dc     = new DogClasses(connString);
                    List <DogClasses> dcList = dc.GetDog_ClassesByDog_ID(show_ID, dog.Dog_ID);
                    if (dcList != null && dcList.Count > 0)
                    {
                        foreach (DogClasses dogClassRow in dcList)
                        {
                            Guid dog_ID = new Guid(dogClassRow.Dog_ID.ToString());
                            if (dogClassRow.Show_Entry_Class_ID == show_Entry_Class_ID)
                            {
                                if (!retVal.Exists(delegate(Dogs i) { return(i.Dog_ID == dog_ID); }))
                                {
                                    Dogs d = new Dogs(connString, dog_ID);
                                    retVal.Add(d);
                                }
                                else
                                {
                                    Dogs d = new Dogs(connString, dog_ID);
                                    existsInCurrentClass.Add(d);
                                }
                            }
                            else
                            {
                                Dogs d = new Dogs(connString, dog_ID);
                                ownerDogsNotInCurrentClass.Add(d);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(retVal);
        }
Ejemplo n.º 5
0
        private static Guid GetDogClassID(string connString, Guid dog_ID, Guid show_Entry_Class_ID)
        {
            Guid dog_Class_ID = new Guid();

            try
            {
                DogClasses        dogClass     = new DogClasses(connString);
                List <DogClasses> dogClassList = dogClass.GetDog_ClassesByDog_IDAndShow_Entry_Class_ID(dog_ID, show_Entry_Class_ID);
                if (dogClassList != null && dogClassList.Count > 0)
                {
                    Guid newDog_Class_ID = new Guid(dogClassList[0].Dog_Class_ID.ToString());
                    dog_Class_ID = newDog_Class_ID;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dog_Class_ID);
        }
Ejemplo n.º 6
0
 private static void SetRunningOrderNull(OwnersDogsClassesDrawn row, Guid user_ID)
 {
     DogClasses dc = new DogClasses(row.Dog_Class_ID);
     dc.Running_Order = null;
     dc.Update_Dog_Class(row.Dog_Class_ID, user_ID);
 }
Ejemplo n.º 7
0
 private void PopulateDogList(Guid entrant_ID)
 {
     if (Common.MyDogList == null)
     {
         List<DogClasses> tblDogClasses;
         DogClasses dogClasses = new DogClasses();
         tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
         foreach (DogClasses dogClassesRow in tblDogClasses)
         {
             AddDogToList(dogClassesRow.Dog_ID.ToString());
         }
     }
 }
Ejemplo n.º 8
0
    private short HasDogChanges()
    {
        bool Changed = false;
        short del = Constants.DATA_NO_CHANGE;
        short ins = Constants.DATA_NO_CHANGE;
        List<DogClasses> tblDogClasses;
        DogClasses dogClasses = new DogClasses();
        Guid entrant_ID = new Guid(Entrant_ID);
        tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
        foreach (DogClasses dogClassesRow in tblDogClasses)
        {
            bool foundDog = false;
            for (int i = 0; i < Common.MyDogList.Count; i++)
            {
                if (Common.MyDogList[i].Dog_ID == dogClassesRow.Dog_ID)
                    //Dog in table still exists in list
                    foundDog = true;
            }
            if (!foundDog)
                //Dog in table no longer exists in list (deleted)
                Changed = true;
        }
        if (Changed)
            del = Constants.DATA_DELETED;

        Changed = false;
        for (int i = 0; i < Common.MyDogList.Count; i++)
        {
            bool foundDog = false;
            foreach (DogClasses dogClassesRow in tblDogClasses)
            {
                if (Common.MyDogList[i].Dog_ID == dogClassesRow.Dog_ID)
                    //Dog in List already exists in table
                    foundDog = true;
            }
            if (!foundDog)
                //Dog in list does not exist in table (inserted)
                Changed = true;
        }
        if (Changed)
            ins = Constants.DATA_INSERTED;

        return del += ins;
    }
Ejemplo n.º 9
0
    protected void btnUpdateCompetitor_Click(object sender, EventArgs e)
    {
        SaveFormFields();
        StoreCommon();
        if (ValidEntry())
        {
            MembershipUser userInfo = Membership.GetUser();
            Guid user_ID = (Guid)userInfo.ProviderUserKey;
            Guid entrant_ID = new Guid(Entrant_ID);
            bool EntrantChanges = false;
            bool EntrantSuccess = false;
            bool DogChanges = false;
            bool DogSuccess = false;
            if (HasEntrantChanges())
            {
                EntrantChanges = true;
                Entrants entrant = new Entrants();
                Guid show_ID = new Guid(Show_ID);
                entrant.Show_ID = show_ID;
                if (Catalogue)
                    entrant.Catalogue = Catalogue;
                if (Overnight_Camping)
                    entrant.Overnight_Camping = Overnight_Camping;
                if (!string.IsNullOrEmpty(Overpayment))
                    entrant.Overpayment = decimal.Parse(Overpayment);
                if (!string.IsNullOrEmpty(Underpayment))
                    entrant.Underpayment = decimal.Parse(Underpayment);
                if (Offer_Of_Help)
                    entrant.Offer_Of_Help = Offer_Of_Help;
                if (!string.IsNullOrEmpty(Help_Details))
                    entrant.Help_Details = Help_Details;
                if (Withold_Address)
                    entrant.Withold_Address = Withold_Address;
                if (Send_Running_Order)
                    entrant.Send_Running_Order = Send_Running_Order;
                if (!string.IsNullOrEmpty(Entry_Date))
                {
                    if (entrant.Entry_Date.ToString() != Entry_Date && !string.IsNullOrEmpty(Entry_Date))
                        entrant.Entry_Date = DateTime.Parse(Entry_Date);
                }
                EntrantSuccess = entrant.Update_Entrant(entrant_ID, user_ID);
            }
            else
                EntrantSuccess = true;

            List<DogClasses> tblDogClasses;
            DogClasses dogClasses = new DogClasses();
            tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
            bool insertOK = true;
            bool deleteOK = true;
            switch (HasDogChanges())
            {
                case Constants.DATA_NO_CHANGE:
                    DogSuccess = true;
                    break;
                case Constants.DATA_INSERTED:
                    DogChanges = true;
                    insertOK = InsertDogClass(entrant_ID, user_ID);
                    if (insertOK)
                        DogSuccess = true;
                    else
                        MessageLabel.Text = "Insert_Dog_Class Failed";
                    break;
                case Constants.DATA_DELETED:
                    DogChanges = true;
                    deleteOK = DeleteDogClass(entrant_ID, user_ID);
                    if (deleteOK)
                        DogSuccess = true;
                    else
                        MessageLabel.Text = "Delete_Dog_Class Failed";
                    break;
                case Constants.DATA_INSERTED_AND_DELETED:
                    DogChanges = true;
                    insertOK = InsertDogClass(entrant_ID, user_ID);
                    deleteOK = DeleteDogClass(entrant_ID, user_ID);
                    if (insertOK && deleteOK)
                        DogSuccess = true;
                    else
                    {
                        MessageLabel.Text = string.Empty;
                        if (!insertOK)
                            MessageLabel.Text = "Insert_Dog_Class Failed";
                        if (!deleteOK)
                            MessageLabel.Text += "Delete_Dog_Class Failed";
                    }
                    break;
                default:
                    break;
            }

            if (EntrantChanges && !EntrantSuccess)
                MessageLabel.Text = "Update_Entrant Failed!";
            if (DogChanges && !DogSuccess)
                MessageLabel.Text += " Error with Dog Changes!";
            if (!EntrantChanges && !DogChanges)
            {
                string returnChars = Common.AppendReturnChars(Request.QueryString, "coc");
                Server.Transfer("~/Competitors/AddDogToClasses.aspx?" + returnChars);
            }
            if (EntrantSuccess && DogSuccess)
            {
                string returnChars = Common.AppendReturnChars(Request.QueryString, "coc");
                Server.Transfer("~/Competitors/AddDogToClasses.aspx?" + returnChars);
            }
        }
    }
Ejemplo n.º 10
0
    protected void OwnersDogsClassesGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        MembershipUser userInfo = Membership.GetUser();
        Guid user_ID = (Guid)userInfo.ProviderUserKey;

        Guid dog_Class_ID = new Guid(OwnersDogsClassesGridView.DataKeys[e.RowIndex].Values[0].ToString());
        DogClasses dogClass = new DogClasses(dog_Class_ID);
        DropDownList ddlNewHandler = (DropDownList)OwnersDogsClassesGridView.Rows[e.RowIndex].FindControl("ddlNewHandler");
        Guid newHandler_ID = new Guid(ddlNewHandler.SelectedValue);
        dogClass.Handler_ID = newHandler_ID;
        dogClass.Update_Dog_Class(dog_Class_ID, user_ID);
        OwnersDogsClassesGridView.EditIndex = -1;
        PopulateOwnersDogsClassesGridView();
    }
Ejemplo n.º 11
0
 private bool DogAlreadyEntered()
 {
     bool ret = false;
     if (Is_Dam_Or_Sire)
         ret = false;
     DogClasses dogClasses = new DogClasses();
     List<DogClasses> tblDog_Classes;
     Guid dog_ID = new Guid(Dog_ID);
     tblDog_Classes = dogClasses.GetDog_ClassesByDog_ID(dog_ID);
     if (tblDog_Classes != null && tblDog_Classes.Count > 0)
     {
         foreach (DogClasses row in tblDog_Classes)
         {
             if (!row.IsEntrant_IDNull)
             {
                 if (string.IsNullOrEmpty(Common.Entrant_ID) || Common.Entrant_ID != row.Entrant_ID.ToString())
                 {
                     Guid entrant_ID = new Guid(row.Entrant_ID.ToString());
                     Entrants entrant = new Entrants(entrant_ID);
                     if (Common.Show_ID == entrant.Show_ID.ToString())
                     {
                         Common.ExistingEntrant_ID = entrant_ID.ToString();
                         ret = true;
                     }
                 }
             }
         }
     }
     return ret;
 }
Ejemplo n.º 12
0
    protected void btnAddDogClass_Click(object sender, EventArgs e)
    {
        GetFormFields();
        StoreCommon();
        if (ValidEntry())
        {
            MembershipUser userInfo = Membership.GetUser();
            Guid user_ID = (Guid)userInfo.ProviderUserKey;

            List<DogClasses> tblDogClasses;
            DogClasses dogClasses = new DogClasses();
            Guid dog_ID = new Guid(Dog_ID);
            Guid show_Entry_Class_ID = new Guid(Show_Entry_Class_ID);
            Guid entrant_ID = new Guid(Entrant_ID);
            tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
            bool rowUpdated = false;
            bool success = false;
            foreach (DogClasses row in tblDogClasses)
            {
                if (dog_ID == row.Dog_ID && !rowUpdated)
                {
                    if (row.IsShow_Entry_Class_IDNull || (!row.IsShow_Entry_Class_IDNull && row.Show_Entry_Class_ID == show_Entry_Class_ID))
                    {
                        Dog_Class_ID = row.Dog_Class_ID.ToString();
                        Guid dog_Class_ID = new Guid(Dog_Class_ID);
                        DogClasses dogClass = new DogClasses(dog_Class_ID);
                        dogClass.Show_Entry_Class_ID = show_Entry_Class_ID;
                        if (!string.IsNullOrEmpty(Special_Request))
                            dogClass.Special_Request = Special_Request;
                        if (!string.IsNullOrEmpty(Handler_ID))
                        {
                            if (GetClassName(show_Entry_Class_ID) != "NFC")
                            {
                                Guid handler_ID = new Guid(Handler_ID);
                                dogClass.Handler_ID = handler_ID;
                            }
                        }
                        dogClass.DeleteDogClass = false;
                        if (dogClass.Update_Dog_Class(dog_Class_ID, user_ID))
                        {
                            rowUpdated = true;
                            success = true;
                        }
                    }
                }
            }
            if (!rowUpdated)
            {
                DogClasses dogClass = new DogClasses();
                dogClass.Entrant_ID = entrant_ID;
                dogClass.Dog_ID = dog_ID;
                dogClass.Show_Entry_Class_ID = show_Entry_Class_ID;
                if (!string.IsNullOrEmpty(Special_Request))
                    dogClass.Special_Request = Special_Request;
                if (!string.IsNullOrEmpty(Handler_ID))
                {
                    if (GetClassName(show_Entry_Class_ID) != "NFC")
                    {
                        Guid handler_ID = new Guid(Handler_ID);
                        dogClass.Handler_ID = handler_ID;
                    }
                }
                Guid? dog_Class_ID = new Guid?();
                dog_Class_ID = dogClass.Insert_Dog_Class(user_ID);
                if (dog_Class_ID != null)
                    success = true;
            }
            if (success)
            {
                ShowEntryClasses showEntryClass = new ShowEntryClasses(show_Entry_Class_ID);
                int class_Name_ID = Int32.Parse(showEntryClass.Class_Name_ID.ToString());
                ClassNames className = new ClassNames(class_Name_ID);
                string class_Name_Description = className.Description;
                Dogs dog = new Dogs(dog_ID);
                MessageLabel.Text = string.Format("{0} was successfully added to {1}.", dog.Dog_KC_Name, class_Name_Description);
                PopulateDogClassGridView();
                ClearFormFields();
            }
        }
    }
Ejemplo n.º 13
0
    protected void RunningOrdersGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        MembershipUser userInfo = Membership.GetUser();
        Guid user_ID = (Guid)userInfo.ProviderUserKey;

        Guid dog_Class_ID = new Guid(RunningOrdersGridView.DataKeys[e.RowIndex].Values[1].ToString());
        DogClasses dogClass = new DogClasses(dog_Class_ID);
        TextBox txtRunningOrder = (TextBox)RunningOrdersGridView.Rows[e.RowIndex].FindControl("txtRunningOrder");
        if (string.IsNullOrEmpty(txtRunningOrder.Text) || txtRunningOrder.Text == "0")
            dogClass.Running_Order = null;
        else
        {
            short test;
            short.TryParse(txtRunningOrder.Text, out test);
            if (test > 0)
                dogClass.Running_Order = short.Parse(txtRunningOrder.Text);
            else
                dogClass.Running_Order = null;
        }
        dogClass.Update_Dog_Class(dog_Class_ID, user_ID);
        RunningOrdersGridView.EditIndex = -1;
        FillRunningOrdersGrid(RunningOrdersGridView, true);
    }
Ejemplo n.º 14
0
 protected void RunningOrdersGridView_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         Guid dog_Class_ID = new Guid(RunningOrdersGridView.DataKeys[e.Row.RowIndex].Values[1].ToString());
         DogClasses dogClass = new DogClasses(dog_Class_ID);
         string strRunningOrder = "0";
         if (dogClass.Running_Order != null)
             strRunningOrder = dogClass.Running_Order.ToString();
         Label lblRunningOrder = (Label)e.Row.FindControl("lblRunningOrder");
         if (lblRunningOrder != null)
         {
             lblRunningOrder.Text = strRunningOrder;
         }
         TextBox txtRunningOrder = (TextBox)e.Row.FindControl("txtRunningOrder");
         if (txtRunningOrder != null)
         {
             txtRunningOrder.Text = strRunningOrder;
         }
     }
 }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
 private bool IsHighestClass(sss.tblOwnersDogsClassesDrawnListRow row)
 {
     bool isHighestClass = true;
     ShowFinalClasses sfcCurrent = new ShowFinalClasses(row.Show_Final_Class_ID);
     short currentClassNo = sfcCurrent.Show_Final_Class_No;
     DogClasses dc = new DogClasses();
     List<DogClasses> dogClassesList = dc.GetDog_ClassesByDog_ID(row.Dog_ID);
     foreach (DogClasses dcRow in dogClassesList)
     {
         if (dcRow.Show_Final_Class_ID != null)
         {
             Guid show_Final_Class_ID = (Guid)dcRow.Show_Final_Class_ID;
             ShowFinalClasses sfc = new ShowFinalClasses(show_Final_Class_ID);
             if (sfc.Show_Final_Class_No > currentClassNo)
                 isHighestClass = false;
         }
     }
     return isHighestClass;
 }
Ejemplo n.º 17
0
 public static void AllocateRunningOrdersStage3(Guid show_ID, Guid user_ID)
 {
     if (AllEntriesInClass != null && AllEntriesInClass.Count > 0)
     {
         SetClassesAndDrawQty(show_ID);
         if (ClassesAndDrawQtyList != null && ClassesAndDrawQtyList.Count > 0)
         {
             //All Classes - Lowest to Highest
             //Owner has more than one class entered
             for (int i = (ClassesAndDrawQtyList.Count-1); i > -1; i--)
             {
                 Guid thisClass_ID = ClassesAndDrawQtyList[i].Show_Final_Class_ID;
                 DogClasses dogClass = new DogClasses();
                 short thisClassRunningOrder = dogClass.GetMaxRunningOrderForClass(thisClass_ID);
                 foreach (OwnersDogsClassesDrawn thisClassRow in AllEntriesInClass)
                 {
                     if (OwnersDrawn.IndexOf(thisClassRow.Owner_ID) == -1 && DogsDrawn.IndexOf(thisClassRow.Dog_ID) == -1)
                     //if (!thisClassRow.OwnerDrawnOnDay)
                     {
                         if (thisClassRow.Show_Final_Class_ID == thisClass_ID)
                         {
                             if (!thisClassRow.Helper && !(thisClassRow.OwnerDogCount == 1 && thisClassRow.ClassesPerOwnerEnteredCount == 1))
                             {
                                 if (thisClassRow.ClassesPerOwnerEnteredCount > 1)
                                 {
                                     thisClassRunningOrder += 1;
                                     if (thisClassRunningOrder <= ClassesAndDrawQtyList[i].DrawQty)
                                     {
                                         UpdateRunningOrder(thisClassRow, thisClassRunningOrder, user_ID);
                                         if (OwnersDrawn.IndexOf(thisClassRow.Owner_ID) == -1)
                                             OwnersDrawn.Add(thisClassRow.Owner_ID);
                                         ShowFinalClasses sfc = new ShowFinalClasses(thisClassRow.Show_Final_Class_ID);
                                         if (sfc.Show_ID == Day1_Show_ID)
                                         {
                                             if (OwnersDrawnOnDay1.IndexOf(thisClassRow.Owner_ID) == -1)
                                                 OwnersDrawnOnDay1.Add(thisClassRow.Owner_ID);
                                         }
                                         else
                                         {
                                             if (OwnersDrawnOnDay2.IndexOf(thisClassRow.Owner_ID) == -1)
                                                 OwnersDrawnOnDay2.Add(thisClassRow.Owner_ID);
                                         }
                                         if (DogsDrawn.IndexOf(thisClassRow.Dog_ID) == -1)
                                             DogsDrawn.Add(thisClassRow.Dog_ID);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 18
0
    protected void DogClassGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        MembershipUser userInfo = Membership.GetUser();
        Guid user_ID = (Guid)userInfo.ProviderUserKey;

        string dc_id = DogClassGridView.DataKeys[e.RowIndex]["Dog_Class_ID"].ToString();
        Guid dog_Class_ID = new Guid(dc_id);
        DogClasses dogClasses = new DogClasses(dog_Class_ID);
        dogClasses.DeleteDogClass = true;
        if (dogClasses.Update_Dog_Class(dog_Class_ID, user_ID))
        {
            PopulateDogClassGridView();
        }
    }
Ejemplo n.º 19
0
 protected void SpecialRequestGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     MembershipUser userInfo = Membership.GetUser();
     Guid user_ID = (Guid)userInfo.ProviderUserKey;
     Guid dog_Class_ID = new Guid(SpecialRequestGridView.DataKeys[e.RowIndex].Values[0].ToString());
     DogClasses dogClass = new DogClasses(dog_Class_ID);
     DropDownList ddlNewPart = (DropDownList)SpecialRequestGridView.Rows[e.RowIndex].FindControl("ddlNewPart");
     Guid newShowFinalClassID = new Guid(ddlNewPart.SelectedValue);
     dogClass.Show_Final_Class_ID = newShowFinalClassID;
     dogClass.Update_Dog_Class(dog_Class_ID, user_ID);
     SpecialRequestGridView.EditIndex = -1;
     FillSpecialRequestGrid(SpecialRequestGridView, true);
 }
Ejemplo n.º 20
0
 private void PopulateDogClassGridView()
 {
     List<DogClasses> tblDogClasses;
     DogClasses dogClasses = new DogClasses();
     Guid entrant_ID = new Guid(Entrant_ID);
     tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
     List<DogClasses> dogClassList = new List<DogClasses>();
     foreach (DogClasses row in tblDogClasses)
     {
         if (!row.IsShow_Entry_Class_IDNull)
         {
             DogClasses dogClass = new DogClasses((Guid)row.Dog_Class_ID);
             Dogs dog = new Dogs((Guid)row.Dog_ID);
             dogClass.Dog_Class_ID = row.Dog_Class_ID;
             dogClass.Dog_KC_Name = dog.Dog_KC_Name;
             ShowEntryClasses showEntryClass = new ShowEntryClasses((Guid)row.Show_Entry_Class_ID);
             ClassNames className = new ClassNames(Int32.Parse(showEntryClass.Class_Name_ID.ToString()));
             dogClass.Class_Name_Description = string.Format("{0} : {1}", showEntryClass.Class_No, className.Description);
             if (!row.IsHandler_IDNull)
             {
                 People handler = new People((Guid)row.Handler_ID);
                 dogClass.Handler_Name = string.Format("{0} {1}", handler.Person_Forename, handler.Person_Surname);
             }
             dogClassList.Add(dogClass);
         }
     }
     if (dogClassList != null)
     {
         DogClassGridView.DataSource = dogClassList;
         DogClassGridView.DataBind();
     }
 }
Ejemplo n.º 21
0
 private void PopulateDogList()
 {
     List<DogClasses> tblDog_Classes;
     DogClasses dogClasses = new DogClasses();
     Guid entrant_ID = new Guid(Common.Entrant_ID);
     DogList dogList = new DogList();
     tblDog_Classes = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
     if (tblDog_Classes != null && tblDog_Classes.Count > 0)
     {
         DogOwnerList dogOwnerList = new DogOwnerList();
         foreach (DogClasses dogClassRow in tblDog_Classes)
         {
             Dogs dog = new Dogs((Guid)dogClassRow.Dog_ID);
             dogList.AddDog(dog);
         }
     }
     if (dogList != null)
         Common.MyDogList = dogList.MyDogList;
 }
Ejemplo n.º 22
0
    private void PopulateListBoxes()
    {
        List<DogClasses> tblDogClasses;
        DogClasses dogClasses = new DogClasses();
        Guid entrant_ID = new Guid(Entrant_ID);
        tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
        List<Dogs> dogs = new List<Dogs>();
        foreach (DogClasses row in tblDogClasses)
        {
            Dogs dog = new Dogs((Guid)row.Dog_ID);
            Dogs dg = dogs.Find(delegate(Dogs d) { return d.Dog_ID == row.Dog_ID; });
            if (dg == null)
                dogs.Add(dog);
        }
        lstDogs.DataSource = dogs;
        lstDogs.DataBind();

        if (!string.IsNullOrEmpty(Show_ID))
        {
            Guid show_ID = new Guid(Show_ID);
            ShowEntryClasses showEntryClasses = new ShowEntryClasses();
            List<ShowEntryClasses> tblShowEntryClasses = showEntryClasses.GetShow_Entry_ClassesByShow_ID(show_ID);
            lstClasses.DataSource = tblShowEntryClasses;
            lstClasses.DataBind();
        }
    }
Ejemplo n.º 23
0
    protected void btnAddCompetitor_Click(object sender, EventArgs e)
    {
        SaveFormFields();
        StoreCommon();

        if (ValidEntry())
        {
            MembershipUser userInfo = Membership.GetUser();
            Guid user_ID = (Guid)userInfo.ProviderUserKey;

            Entrants entrant = new Entrants();
            Guid show_ID = new Guid(Show_ID);
            entrant.Show_ID = show_ID;
            if(Catalogue)
                entrant.Catalogue = Catalogue;
            if (Overnight_Camping)
                entrant.Overnight_Camping = Overnight_Camping;
            if (!string.IsNullOrEmpty(Overpayment))
                entrant.Overpayment = decimal.Parse(Overpayment);
            if (!string.IsNullOrEmpty(Underpayment))
                entrant.Underpayment = decimal.Parse(Underpayment);
            if (Offer_Of_Help)
                entrant.Offer_Of_Help = Offer_Of_Help;
            if (!string.IsNullOrEmpty(Help_Details))
                entrant.Help_Details = Help_Details;
            if (Withold_Address)
                entrant.Withold_Address = Withold_Address;
            if (Send_Running_Order)
                entrant.Send_Running_Order = Send_Running_Order;
            if (!string.IsNullOrEmpty(Entry_Date))
            {
                if (entrant.Entry_Date.ToString() != Entry_Date && !string.IsNullOrEmpty(Entry_Date))
                    entrant.Entry_Date = DateTime.Parse(Entry_Date);
            }

            Guid? entrant_ID = entrant.Insert_Entrant(user_ID);

            if (entrant_ID != null)
            {
                Entrant_ID = entrant_ID.ToString();
                Common.Entrant_ID = Entrant_ID;
                bool insertFailed = false;
                for (int i = 0; i < Common.MyDogList.Count; i++)
                {
                    DogClasses dogClass = new DogClasses();
                    dogClass.Entrant_ID = entrant_ID;
                    dogClass.Dog_ID = Common.MyDogList[i].Dog_ID;

                    Guid? dog_Class_ID = dogClass.Insert_Dog_Class(user_ID);

                    if (dog_Class_ID == null)
                        insertFailed = true;
                }
                if (!insertFailed)
                {
                    string returnChars = Common.AppendReturnChars(Request.QueryString, "coc");
                    Server.Transfer("~/Competitors/AddDogToClasses.aspx?" + returnChars);
                }
                else
                {
                    MessageLabel.Text = "Dog_Classes Insert Failed!";
                }
            }
            else
            {
                MessageLabel.Text = "Entrants Insert Failed!";
            }
        }
    }
Ejemplo n.º 24
0
    private bool ValidEntry()
    {
        bool valid = true;
        Guid show_ID = new Guid(Show_ID);
        Shows show = new Shows(show_ID);
        List<DogClasses> tblDogClasses;
        DogClasses dogClasses = new DogClasses();
        Guid entrant_ID = new Guid(Entrant_ID);
        tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
        short dogClassCount = 0;
        if (string.IsNullOrEmpty(Handler_ID) && lstClasses.SelectedItem.Text != "NFC")
        {
            MessageLabel.Text = "You must select the Handler.";
            valid = false;
        }
        if (!string.IsNullOrEmpty(Dog_ID) && lstClasses.SelectedItem.Text != "NFC")
        {
            Guid dog_ID = new Guid(Dog_ID);
            Dogs dog = new Dogs(dog_ID);
            if (!IsCorrectClassGender(dog))
            {
                MessageLabel.Text = "This dog is the wrong gender for this class.";
                valid = false;
            }
        }
        foreach (DogClasses row in tblDogClasses)
        {
            if (!row.IsShow_Entry_Class_IDNull && Dog_ID == row.Dog_ID.ToString())
            {
                if (Show_Entry_Class_ID == row.Show_Entry_Class_ID.ToString())
                {
                    MessageLabel.Text = string.Format("You have already entered this dog in {0}.", GetClassName((Guid)row.Show_Entry_Class_ID));
                    valid = false;
                }
                else if (lstClasses.SelectedItem.Text == "NFC" && GetClassName((Guid)row.Show_Entry_Class_ID) != "NFC")
                {
                    MessageLabel.Text = "This dog is already entered in other classes, so cannot be NFC";
                    valid = false;
                }
                else if (GetClassName((Guid)row.Show_Entry_Class_ID) == "NFC")
                {
                    MessageLabel.Text = "This dog is entered NFC so cannot be entered in other classes.";
                    valid = false;
                }
                if (valid)
                {
                    dogClassCount += 1;
                    if (dogClassCount >= show.MaxClassesPerDog)
                    {
                        MessageLabel.Text = string.Format("There is a maximum of {0} classes per dog for this show.", show.MaxClassesPerDog.ToString());
                        valid = false;
                    }
                }
            }
        }

        return valid;
    }
Ejemplo n.º 25
0
 private bool DeleteDogClass(Guid entrant_ID, Guid user_ID)
 {
     bool deletedOK = false;
     List<DogClasses> tblDogClasses;
     DogClasses dogClasses = new DogClasses();
     tblDogClasses = dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
     foreach (DogClasses row in tblDogClasses)
     {
         bool dogFound = false;
         for (int i = 0; i < Common.MyDogList.Count; i++)
         {
             if (Common.MyDogList[i].Dog_ID == row.Dog_ID)
             {
                 dogFound = true;
             }
         }
         if (!dogFound)
         {
             DogClasses dc = new DogClasses((Guid)row.Dog_Class_ID);
             dc.DeleteDogClass = true;
             deletedOK = dc.Update_Dog_Class((Guid)row.Dog_Class_ID, user_ID);
         }
     }
     return deletedOK;
 }
Ejemplo n.º 26
0
        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;
        }
Ejemplo n.º 27
0
    private bool InsertDogClass(Guid entrant_ID, Guid user_ID)
    {
        bool insertOK=true;
        for (int i = 0; i < Common.MyDogList.Count; i++)
        {
            bool dogFound = false;
            List<DogClasses> tblDogClasses;
            DogClasses dogClasses = new DogClasses();
            tblDogClasses=dogClasses.GetDog_ClassesByEntrant_ID(entrant_ID);
            foreach (DogClasses row in tblDogClasses)
            {
                if (Common.MyDogList[i].Dog_ID == row.Dog_ID)
                {
                    dogFound = true;
                }
            }
            if (!dogFound)
            {

                DogClasses dogClass = new DogClasses();
                dogClass.Entrant_ID = entrant_ID;
                dogClass.Dog_ID = Common.MyDogList[i].Dog_ID;

                Guid? dog_Class_ID = dogClass.Insert_Dog_Class(user_ID);

                if (dog_Class_ID == null)
                    insertOK = false;

            }
        }
        return insertOK;
    }
Ejemplo n.º 28
0
 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;
 }
Ejemplo n.º 29
0
 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;
 }
Ejemplo n.º 30
0
 private static Guid GetDogClassID(Guid dog_ID, Guid show_Entry_Class_ID)
 {
     Guid dog_Class_ID = new Guid();
     DogClasses dogClass = new DogClasses();
     List<DogClasses> dogClassList = dogClass.GetDog_ClassesByDog_IDAndShow_Entry_Class_ID(dog_ID, show_Entry_Class_ID);
     if (dogClassList != null && dogClassList.Count > 0)
     {
         Guid newDog_Class_ID = new Guid(dogClassList[0].Dog_Class_ID.ToString());
         dog_Class_ID = newDog_Class_ID;
     }
     return dog_Class_ID;
 }
Ejemplo n.º 31
0
 private static void UpdateRunningOrder(OwnersDogsClassesDrawn row, int runningOrder, Guid user_ID)
 {
     DogClasses dc = new DogClasses(row.Dog_Class_ID);
     dc.Running_Order = short.Parse(runningOrder.ToString());
     dc.Update_Dog_Class(row.Dog_Class_ID, user_ID);
 }
Ejemplo n.º 32
0
 private static List<Dogs> OwnerDogsInCurrentClass(List<DogOwners> ownerDogList, Guid show_Entry_Class_ID)
 {
     List<Dogs> ownerDogsInCurrentClass = new List<Dogs>();
     List<Dogs> existsInCurrentClass = new List<Dogs>();
     List<Dogs> ownerDogsNotInCurrentClass = new List<Dogs>();
     foreach (DogOwners dog in ownerDogList)
     {
         DogClasses dc = new DogClasses();
         List<DogClasses> dcList = dc.GetDog_ClassesByDog_ID(dog.Dog_ID);
         if(dcList != null && dcList.Count > 0)
         {
             foreach (DogClasses dogClassRow in dcList)
             {
                 Guid dog_ID = new Guid(dogClassRow.Dog_ID.ToString());
                 if (dogClassRow.Show_Entry_Class_ID == show_Entry_Class_ID)
                 {
                     if (!ownerDogsInCurrentClass.Exists(delegate(Dogs i) { return i.Dog_ID == dog_ID; }))
                     {
                         Dogs d = new Dogs(dog_ID);
                         ownerDogsInCurrentClass.Add(d);
                     }
                     else
                     {
                         Dogs d = new Dogs(dog_ID);
                         existsInCurrentClass.Add(d);
                     }
                 }
                 else
                 {
                     Dogs d = new Dogs(dog_ID);
                     ownerDogsNotInCurrentClass.Add(d);
                 }
             }
         }
     }
     return ownerDogsInCurrentClass;
 }
Ejemplo n.º 33
0
        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;
        }
Ejemplo n.º 34
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();
             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();
                 }
             }
         }
     }
 }
Ejemplo n.º 35
0
 public static void SetClassesAndDrawQty(Guid show_ID)
 {
     bool lowestClassSet = false;
     List<ClassesAndDrawQty> classesAndDrawQtyList = new List<ClassesAndDrawQty>();
     ShowFinalClasses showFinalClasses = new ShowFinalClasses();
     List<ShowFinalClasses> showFinalClassList = showFinalClasses.GetShow_Final_ClassesByShow_ID(show_ID);
     foreach (ShowFinalClasses row in showFinalClassList)
     {
         if (row.Show_Final_Class_Description != "NFC"
             && !row.Show_Final_Class_Description.Contains("YKC")
             && !row.Show_Final_Class_Description.Contains("Champ"))
         {
             int drawQty = 10;
             DogClasses dogClass = new DogClasses();
             int entryCount = dogClass.GetEntryCountByShow_Final_Class_ID(row.Show_Final_Class_ID);
             if (entryCount <= Constants.DRAW_QTY_LESS_THAN)
             {
                 drawQty = 6;
             }
             ClassesAndDrawQty classAndDrawQty = new ClassesAndDrawQty();
             classAndDrawQty.Show_Final_Class_ID = row.Show_Final_Class_ID;
             classAndDrawQty.DrawQty = drawQty;
             if (!lowestClassSet)
             {
                 classAndDrawQty.LowestClass = true;
                 lowestClassSet = true;
             }
             classesAndDrawQtyList.Add(classAndDrawQty);
         }
     }
     ClassesAndDrawQtyList = classesAndDrawQtyList;
 }
Ejemplo n.º 36
0
 protected void DogGridView_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         string Dog_ID = ((HiddenField)e.Row.FindControl("hdnID")).Value;
         GridView gvClasses = e.Row.FindControl("ClassGridView") as GridView;
         List<DogClasses> tblDog_Classes;
         DogClasses dogClasses = new DogClasses();
         if (!string.IsNullOrEmpty(Dog_ID))
         {
             Guid dog_ID = new Guid(Dog_ID);
             tblDog_Classes = dogClasses.GetDog_ClassesByDog_ID(dog_ID);
             if (tblDog_Classes != null && tblDog_Classes.Count > 0)
             {
                 List<DogClasses> dogClassList = new List<DogClasses>();
                 foreach (DogClasses row in tblDog_Classes)
                 {
                     if (!row.IsShow_Entry_Class_IDNull)
                     {
                         DogClasses dogClass = new DogClasses((Guid)row.Dog_Class_ID);
                         Dogs dog = new Dogs((Guid)row.Dog_ID);
                         dogClass.Dog_Class_ID = row.Dog_Class_ID;
                         dogClass.Dog_KC_Name = dog.Dog_KC_Name;
                         ShowEntryClasses showEntryClass = new ShowEntryClasses((Guid)row.Show_Entry_Class_ID);
                         ClassNames className = new ClassNames(Int32.Parse(showEntryClass.Class_Name_ID.ToString()));
                         dogClass.Class_Name_Description = string.Format("{0} : {1}", showEntryClass.Class_No, className.Description);
                         if (!row.IsHandler_IDNull)
                         {
                             People handler = new People((Guid)row.Handler_ID);
                             dogClass.Handler_Name = string.Format("{0} {1}", handler.Person_Forename, handler.Person_Surname);
                         }
                         dogClassList.Add(dogClass);
                     }
                 }
                 if (dogClassList != null)
                 {
                     gvClasses.DataSource = dogClassList;
                     gvClasses.DataBind();
                 }
             }
         }
     }
 }