Beispiel #1
0
        public List <Entrants> GetEntrantsByShow_IDAndDog_ID(Guid show_ID, Guid dog_ID, bool includeLinked)
        {
            List <Entrants> retVal = new List <Entrants>();

            try
            {
                EntrantsBL entrants = new EntrantsBL(_connString);
                tblEntrants = entrants.GetEntrantsByShow_IDAndDog_ID(show_ID, dog_ID, includeLinked);

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

            return(retVal);
        }
Beispiel #2
0
        public List<Entrants> GetEntrantsByShow_IDAndDog_ID(Guid show_ID, Guid dog_ID, bool includeLinked)
        {
            List<Entrants> entrantList = new List<Entrants>();
            EntrantsBL entrants = new EntrantsBL();
            tblEntrants = entrants.GetEntrantsByShow_IDAndDog_ID(show_ID, dog_ID, includeLinked);

            if (tblEntrants != null && tblEntrants.Count > 0)
            {
                foreach (sss.tblEntrantsRow row in tblEntrants)
                {
                    Entrants entrant = new Entrants(row.Entrant_ID);
                    entrantList.Add(entrant);
                }
            }

            return entrantList;
        }
Beispiel #3
0
 private void PopulateEntrant(Guid entrant_ID)
 {
     Entrants entrant = new Entrants(entrant_ID);
     if (entrant.Catalogue != null)
         Catalogue = (bool)entrant.Catalogue;
     if (entrant.Overnight_Camping != null)
         Overnight_Camping = (bool)entrant.Overnight_Camping;
     Overpayment = entrant.Overpayment.ToString();
     Underpayment = entrant.Underpayment.ToString();
     if (entrant.Offer_Of_Help != null)
         Offer_Of_Help = (bool)entrant.Offer_Of_Help;
     Help_Details = entrant.Help_Details;
     if (entrant.Withold_Address != null)
         Withold_Address = (bool)entrant.Withold_Address;
     if (entrant.Send_Running_Order != null)
         Send_Running_Order = (bool)entrant.Send_Running_Order;
     if (entrant.Entry_Date != null)
     {
         string format = "yyyy-MM-dd";
         Entry_Date = DateTime.Parse(entrant.Entry_Date.ToString()).ToString(format);
         Common.Entry_Date = Entry_Date;
         txtEntryDate.Text = Entry_Date;
     }
     StoreCommon();
 }
Beispiel #4
0
    private bool HasEntrantChanges()
    {
        bool Changed = false;

        if (!string.IsNullOrEmpty(Entrant_ID))
        {
            Guid entrant_ID = new Guid(Entrant_ID);
            Entrants entrant = new Entrants(entrant_ID);

            if (entrant.Show_ID.ToString() != Show_ID)
                Changed = true;
            if (entrant.Catalogue != Catalogue)
                Changed = true;
            if (entrant.Overnight_Camping != Overnight_Camping)
                Changed = true;
            if (entrant.Overpayment.ToString() != Overpayment)
                Changed = true;
            if (entrant.Underpayment.ToString() != Underpayment)
                Changed = true;
            if (entrant.Offer_Of_Help != Offer_Of_Help)
                Changed = true;
            if (entrant.Help_Details != Help_Details)
                if(!string.IsNullOrEmpty(entrant.Help_Details) && !string.IsNullOrEmpty(Help_Details))
                    Changed = true;
            if (entrant.Withold_Address != Withold_Address)
                Changed = true;
            if (entrant.Send_Running_Order != Send_Running_Order)
                Changed = true;
            if (entrant.Entry_Date == null && !string.IsNullOrEmpty(Entry_Date))
                Changed = true;
            if (entrant.Entry_Date != null && !string.IsNullOrEmpty(Entry_Date))
                if (entrant.Entry_Date.ToString() != Entry_Date)
                    Changed = true;
        }
        return Changed;
    }
Beispiel #5
0
 private void GetEntrantByShowAndDog()
 {
     Entrants entrant = new Entrants();
     if (!string.IsNullOrEmpty(Show_ID))
     {
         Guid show_ID = new Guid(Show_ID);
         Guid dog_ID = Common.MyDogList[0].Dog_ID;
         List<Entrants> tblEntrants;
         tblEntrants = entrant.GetEntrantsByShow_IDAndDog_ID(show_ID, dog_ID, true);
         if (tblEntrants != null && tblEntrants.Count > 0)
         {
             Guid entrant_ID = (Guid)tblEntrants[0].Entrant_ID;
             Entrant_ID = entrant_ID.ToString();
             Common.Entrant_ID = Entrant_ID;
         }
     }
 }
Beispiel #6
0
    protected void ShowGridView_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow row = ShowGridView.SelectedRow;
        string s_id = ShowGridView.DataKeys[row.RowIndex]["Show_ID"].ToString();
        string c_id = ShowGridView.DataKeys[row.RowIndex]["Club_ID"].ToString();
        string v_id = ShowGridView.DataKeys[row.RowIndex]["Venue_ID"].ToString();
        Show_ID = s_id;
        Common.Show_ID = Show_ID;
        Club_ID = c_id;
        Common.Club_ID = Club_ID;

        PopulateClub(Club_ID);
        PopulateShowGridView(Club_ID);
        PopulateShow(Show_ID);
        divGetOwner.Visible = true;
        if (!string.IsNullOrEmpty(Owner_ID) && !string.IsNullOrEmpty(Show_ID))
        {
            Entrants entrant = new Entrants();
            List<Entrants> tblEntrants;
            Guid person_ID = new Guid(Owner_ID);
            Guid show_ID = new Guid(Show_ID);
            Guid? entrant_ID = null;
            tblEntrants = entrant.GetEntrantsByShow_ID(show_ID, false);
            foreach (Entrants entrantRow in tblEntrants)
            {
                if (entrantRow.Show_ID == show_ID)
                    entrant_ID = entrantRow.Entrant_ID;
            }
            if (entrant_ID != null)
            {
                Entrant_ID = entrant_ID.ToString();
                Common.Entrant_ID = Entrant_ID;
                Guid newEntrant_ID = new Guid(Entrant_ID);
                PopulateEntrant(newEntrant_ID);
                PopulateDogList(newEntrant_ID);
                PopulateOwnerList(newEntrant_ID);
                divDogList.Visible = true;
                divAddCompetitor.Visible = false;
                divUpdateCompetitor.Visible = true;
                PopulateForm();
                People person = new People(person_ID);
                MessageLabel.Text = string.Format("{0} {1} is already entered in this show", person.Person_Forename, person.Person_Surname);
            }
        }
    }
Beispiel #7
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);
            }
        }
    }
Beispiel #8
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!";
            }
        }
    }
Beispiel #9
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;
 }
Beispiel #10
0
 private void PopulateEntryGridView()
 {
     List<Entrants> tblEntrants;
     Entrants entrants = new Entrants();
     Guid show_ID = new Guid(Show_ID);
     tblEntrants = entrants.GetEntrantsByShow_ID(show_ID, true);
     EntryGridView.DataSource = tblEntrants;
     EntryGridView.DataBind();
 }
 private void GetEntrant()
 {
     Guid entrant_ID = new Guid(Entrant_ID);
     Entrants entrant = new Entrants(entrant_ID);
     Show_ID = entrant.Show_ID.ToString();
 }