示例#1
0
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        using (WeddingContext db = WeddingContext.New())
        {
            Debug.Assert(db.DatabaseExists());
            Debug.Assert(guestID != Guid.Empty);

            var query = from b in db.Guest
                        where b.GuestID == guestID
                        select b;

            Guest guest1 = query.Single();

            //if( !this.IsLodging )
            //{
            //	guest1._NeedAccommodations = Byte.Parse( this.RadioAccommodations.SelectedValue );
            //}
            guest1._Count      = Byte.Parse(this.RadioCount.SelectedValue);
            guest._Count       = Byte.Parse(this.RadioCount.SelectedValue);
            guest1._ArrivalDay = this.RadioArrival.SelectedValue;

            if (!String.IsNullOrEmpty(this.RadioTravel.SelectedValue))
            {
                guest1._Travel = Byte.Parse(this.RadioTravel.SelectedValue);
            }
            guest1._Notes    = this.TextBoxNotes.Text;
            guest1._RsvpDate = DateTime.Now;
            db.SubmitChanges();
        }

        if (this.IsAttending)
        {
            this.DivRsvpArrivalTravel.Visible = true;
            if (this.Lodging == LodgingEnum.ResortAssigned)
            {
                this.DivAccommodationsResort.Visible = true;
                this.DivAccommodationsOther.Visible  = false;
            }
            else
            {
                this.DivAccommodationsResort.Visible = false;
                this.DivAccommodationsOther.Visible  = true;
            }
        }
        else
        {
            this.DivRsvpArrivalTravel.Visible    = false;
            this.DivAccommodationsResort.Visible = false;
            this.DivAccommodationsOther.Visible  = false;
        }

        this.LabelSavedMessage.Text = "Got it -- thanks for letting us know!";
    }