Beispiel #1
0
    protected void btnAddVenue_Click(object sender, EventArgs e)
    {
        Venue_Name = txtVenueName.Text;
        if (string.IsNullOrEmpty(Venue_Name))
        {
            MessageLabel.Text = "You must enter a Venue Name";
        }
        else if (string.IsNullOrEmpty(Venue_Address_ID))
        {
            MessageLabel.Text = "You must add an Address";
        }
        else if (string.IsNullOrEmpty(Venue_Contact_ID))
        {
            MessageLabel.Text = "You must add a Contact";
        }
        else
        {
            MembershipUser userInfo = Membership.GetUser();
            Guid           user_ID  = (Guid)userInfo.ProviderUserKey;

            Common.Venue_Address_ID = Venue_Address_ID;
            Common.Venue_Contact_ID = Venue_Contact_ID;

            if (!string.IsNullOrEmpty(Venue_Address_ID) && !string.IsNullOrEmpty(Venue_Contact_ID))
            {
                Guid address_ID = new Guid(Venue_Address_ID);
                Guid person_ID  = new Guid(Venue_Contact_ID);

                Venues venue = new Venues(_connString);
                venue.Venue_Name    = txtVenueName.Text;
                venue.Address_ID    = address_ID;
                venue.Venue_Contact = person_ID;

                Guid?venue_ID = venue.Insert_Venue(user_ID);

                if (venue_ID != null)
                {
                    Venue_ID          = venue_ID.ToString();
                    Common.Venue_ID   = Venue_ID;
                    MessageLabel.Text = string.Format("{0} was added successfully", venue.Venue_Name);
                    PopulateAddress(Venue_Address_ID);
                    PopulatePerson(Venue_Contact_ID);
                    if (!string.IsNullOrEmpty(btnReturn.PostBackUrl))
                    {
                        DivReturn.Visible = true;
                    }
                }
            }
            PopulateVenueGridView();
        }
    }