protected void btnBook_Click(object sender, EventArgs e)
        {
            validatDates();

            if ((UserType)Session["UserType"] == UserType.Owner)
            {// save to session
                DateTime start = Convert.ToDateTime(((TextBox)UCstartDate.FindControl("txtDate")).Text);
                DateTime end   = Convert.ToDateTime(((TextBox)UCendDate.FindControl("txtDate")).Text);

                editedReservation.startDate = start;
                editedReservation.endDate   = end;
                int resNum = Convert.ToInt32(Session["selectedReservation"]);
                if (Session["selectedReservation"] != null)
                {
                    ((Application)Master).owner.reservationList.ForEach(delegate(Reservation res) {
                        if (res.reservationNumber == resNum)
                        {
                            res = editedReservation;
                        }
                    });
                }
                else
                {
                    ((Application)Master).owner.addReservation(editedReservation);
                }
            }
            // regardless of user disable form on save
            reservationPanel.Enabled = false;
        }
        protected void loadData(Reservation reservationOnPage, Owner owner)
        {
            editedReservation = reservationOnPage;
            try
            {
                ddlAddPet.Items.Clear();
                ddlPetsInRes.Items.Clear();
                ((TextBox)UCstartDate.FindControl("txtDate")).Text = reservationOnPage.startDate.ToShortDateString();
                ((TextBox)UCendDate.FindControl("txtDate")).Text   = reservationOnPage.endDate.ToShortDateString();
                List <Pet> petList = new List <Pet>();
                reservationOnPage.petReservationList.ForEach(delegate(PetReservation pres) {
                    petList.Add(pres.pet);
                });
                petList.ForEach(delegate(Pet pet) {
                    ddlPetsInRes.Items.Add(new ListItem(pet.name, pet.petNumber.ToString()));
                });
                bool inList;
                owner.petList.ForEach(delegate(Pet pet) {
                    inList = false;    // check if pet is already listed in other ddl
                    petList.ForEach(delegate(Pet petInDdl) {
                        if (petInDdl.name == pet.name)
                        {
                            inList = true;
                        }
                    });
                    if (!inList)      // if pet not already listed add the the other ddl
                    {
                        ddlAddPet.Items.Add(new ListItem(pet.name, pet.petNumber.ToString()));
                    }
                });

                // now populate the first pet reservations data
                setSelectedPetRes(reservationOnPage);
            }
            catch
            {
                Console.Write("Error - Exception catched => load file => manage reservation ! ");
            }
        }//load info into fields
 public void validatDates()
 {
     if (((TextBox)UCstartDate.FindControl("txtDate")).Text != "" && ((TextBox)UCendDate.FindControl("txtDate")).Text != "")
     {
         try
         {
             DateTime start = Convert.ToDateTime(UCstartDate.vacDate);
             DateTime end   = Convert.ToDateTime(UCendDate.vacDate);
             if (end < start)
             {
                 valEndDate.IsValid = false;
             }
         }
         catch
         {
             valEndDate.IsValid = false;
         }
     }
 }
 protected void changeState(Boolean State)
 {
     ((TextBox)UCstartDate.FindControl("txtDate")).Enabled = State;
     ((TextBox)UCendDate.FindControl("txtDate")).Enabled   = State;
     reservationPanel.Enabled = State;
 }