protected void Page_Load(object sender, EventArgs e)
    {
        MessageLabel.Text = string.Empty;
        GetCommon();

        if (!string.IsNullOrEmpty(Common.Club_ID))
        {
            Club_ID = Common.Club_ID;
            PopulateClub(Club_ID);
            PopulateShowGridView(Club_ID);
            divShowList.Visible = true;
        }
        else
        {
            PopulateClubGridView();
            divClubList.Visible = true;
            divClubDetails.Visible = false;
        }
        if (!string.IsNullOrEmpty(Common.Show_ID))
        {
            Show_ID = Common.Show_ID;
            PopulateShow(Show_ID);
            divGetOwner.Visible = true;
        }
        else
        {
            if (!string.IsNullOrEmpty(Club_ID))
            {
                PopulateShowGridView(Club_ID);
                divShowList.Visible = true;
            }
            else
            {
                divShowList.Visible = false;
                divShowDetails.Visible = false;
                divGetOwner.Visible = false;
            }
        }
        if (!string.IsNullOrEmpty(Common.Owner_ID))
        {
            Owner_ID = Common.Owner_ID;
            AddOwnerToList(Owner_ID);
            Owner_ID = null;
            Common.Owner_ID = Owner_ID;
        }
        if (Common.DogOwnerList != null && Common.DogOwnerList.Count != 0)
        {
            divOwnerList.Visible = true;
            DogOwnerList ownerList = new DogOwnerList();
            ownerList.MyDogOwnerList = Common.DogOwnerList;
            PopulateOwnerGridView(ownerList.MyDogOwnerList);
            divGetDog.Visible = true;
        }
        else
        {
            divOwnerList.Visible = false;
            divGetDog.Visible = false;
        }
        if (!string.IsNullOrEmpty(Common.Current_Dog_ID))
        {
            Current_Dog_ID = Common.Current_Dog_ID;
            AddDogToList(Current_Dog_ID);
            Current_Dog_ID = null;
            Common.DogAdded = true;
            Common.Current_Dog_ID = Current_Dog_ID;
        }
        if (Common.MyDogList != null && Common.MyDogList.Count != 0)
        {
            if (!string.IsNullOrEmpty(Entrant_ID) && !Common.DogAdded)
            {
                //GetEntrantByShowAndDog();
                Guid entrant_ID = new Guid(Entrant_ID);
                Common.MyDogList = null;
                PopulateEntrant(entrant_ID);
                PopulateDogList(entrant_ID);
            }
            divDogList.Visible = true;
            DogList dogList = new DogList();
            dogList.MyDogList = Common.MyDogList;
            PopulateDogGridView(dogList.MyDogList);
            divGetDog.Visible = true;
            if(string.IsNullOrEmpty(Entrant_ID))
                GetEntrantByShowAndDog();
            divEntryDetails.Visible = true;
            if (!string.IsNullOrEmpty(Common.Entrant_ID))
            {
                divAddCompetitor.Visible = false;
                divUpdateCompetitor.Visible = true;
            }
            else
            {
                divAddCompetitor.Visible = true;
                divUpdateCompetitor.Visible = false;
            }
        }
        else
        {
            divDogList.Visible = false;
            divAddCompetitor.Visible = false;
            divUpdateCompetitor.Visible = false;
            divEntryDetails.Visible = false;
        }
        if (!Page.IsPostBack)
        {
            PopulateForm();
            if (!string.IsNullOrEmpty(Entrant_ID))
            {
                Guid entrant_ID = new Guid(Entrant_ID);
                PopulateOwnerList(entrant_ID);
            }
        }
    }
 protected void AddOwnerToList(string owner_ID)
 {
     Guid new_Owner_ID = new Guid(owner_ID);
     People person = new People(new_Owner_ID);
     DogOwnerList ownerList = new DogOwnerList();
     ownerList.MyDogOwnerList = Common.DogOwnerList;
     People pp = null;
     if (ownerList.MyDogOwnerList != null)
         pp = ownerList.MyDogOwnerList.Find(delegate(People p) { return p.Person_ID == new_Owner_ID; });
     if (pp == null)
     {
         int ownerCount = ownerList.AddOwner(person);
         PopulateOwnerGridView(ownerList.MyDogOwnerList);
         Common.DogOwnerList = ownerList.MyDogOwnerList;
     }
 }
 protected void OwnerGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     string owner_id = OwnerGridView.DataKeys[e.RowIndex]["Person_ID"].ToString();
     DogOwnerList ownerList = new DogOwnerList();
     ownerList.MyDogOwnerList = Common.DogOwnerList;
     int ownerCount = ownerList.DeleteDogOwner(e.RowIndex);
     PopulateOwnerGridView(ownerList.MyDogOwnerList);
     Common.DogOwnerList = ownerList.MyDogOwnerList;
 }
 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();
     }
 }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        MessageLabel.Text = string.Empty;
        GetCommon();

        if (!string.IsNullOrEmpty(Common.Current_Dog_ID))
        {
            Current_Dog_ID = Common.Current_Dog_ID;
            divGetDog.Visible = false;
            divChangeDog.Visible = true;
            divDogDetails.Visible = true;
            if (!string.IsNullOrEmpty(btnReturn.PostBackUrl))
                DivReturn.Visible = true;
        }
        else
        {
            divGetDog.Visible = true;
            divChangeDog.Visible = false;
            divDogDetails.Visible = false;
        }
        if (!string.IsNullOrEmpty(Common.Owner_ID))
        {
            Owner_ID = Common.Owner_ID;
            AddOwnerToList(Owner_ID);
            Owner_ID = null;
            Common.Owner_ID = Owner_ID;
        }
        if (Common.DogOwnerList != null && Common.DogOwnerList.Count != 0)
        {
            divOwnerList.Visible = true;
            DogOwnerList ownerList = new DogOwnerList();
            ownerList.MyDogOwnerList = Common.DogOwnerList;
            PopulateOwnerGridView(ownerList.MyDogOwnerList);
        }
        else
        {
            divOwnerList.Visible = false;
        }
        if (!string.IsNullOrEmpty(Common.Breeder_ID))
        {
            Breeder_ID = Common.Breeder_ID;
            AddBreederToList(Breeder_ID);
            Breeder_ID = null;
            Common.Breeder_ID = Breeder_ID;
        }
        if (Common.DogBreederList != null && Common.DogBreederList.Count != 0)
        {
            divBreederList.Visible = true;
            DogBreederList breederList = new DogBreederList();
            breederList.MyDogBreederList = Common.DogBreederList;
            PopulateBreederGridView(breederList.MyDogBreederList);
        }
        else
        {
            divBreederList.Visible = false;
        }
        if (!string.IsNullOrEmpty(Common.Dam_ID))
        {
            Dam_ID = Common.Dam_ID;
            PopulateDam();
        }
        else
        {
            divGetDam.Visible = true;
            divChangeDam.Visible = false;
            divDamDetails.Visible = false;
        }
        if (!string.IsNullOrEmpty(Common.Sire_ID))
        {
            Sire_ID = Common.Sire_ID;
            PopulateSire();
        }
        else
        {
            divGetSire.Visible = true;
            divChangeSire.Visible = false;
            divSireDetails.Visible = false;
        }
        if (!Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Common.Current_Dog_ID))
            {
                PopulateDog();
                PopulateOwnerList();
                PopulateBreederList();
                string returnChars = Request.QueryString["return"];
                btnReturn.PostBackUrl = Common.ReturnPath(Request.QueryString, returnChars, "");
            }
        }
    }
Exemple #6
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;
 }
 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();
                 }
             }
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        MessageLabel.Text=string.Empty;
        GetCommon();

        if (!Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Entrant_ID))
            {
                GetEntrant();
                PopulateListBoxes();
                PopulateDogClassGridView();
                Guid dog_ID = new Guid(lstDogs.Items[0].Value);
                PopulateOwnerList(dog_ID);
            }
            else
                Server.Transfer("~/Competitors/Competitor.aspx");
            if (!string.IsNullOrEmpty(Show_ID))
                PopulateShow();
            if (Common.DogOwnerList != null && Common.DogOwnerList.Count != 0)
            {
                divOwnerList.Visible = true;
                DogOwnerList ownerList = new DogOwnerList();
                ownerList.MyDogOwnerList = Common.DogOwnerList;
                PopulateOwnerGridView(ownerList.MyDogOwnerList);
            }
            else
            {
                divOwnerList.Visible = false;
            }
            if (!string.IsNullOrEmpty(Handler_ID))
            {
                PopulateHandler();
                divHandler.Visible = true;
                divGetHandler.Visible = false;
                divChangeHandler.Visible = true;
                divHandlerDetails.Visible = true;
            }
            else
            {
                divHandler.Visible = true;
                divGetHandler.Visible = true;
                divChangeHandler.Visible = false;
                divHandlerDetails.Visible = false;
            }
            if (!string.IsNullOrEmpty(Show_Entry_Class_ID))
            {
                lstClasses.SelectedValue = Show_Entry_Class_ID.ToString();
            }
            if (!string.IsNullOrEmpty(Dog_ID))
            {
                lstDogs.SelectedValue = Dog_ID.ToString();
            }
            string returnChars = Request.QueryString["return"];
            btnReturn.PostBackUrl = Common.ReturnPath(Request.QueryString, returnChars, "");
        }
    }