Пример #1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            if (addMensSeats.EditValue == null && addWomensSeats.EditValue == null)
            {
                Dialog.ShowError("Please reserve at least one seat");
                return;
            }

            var row = new MelaveMalkaSeat {
                DateAdded   = DateTime.Now,
                Year        = year,
                Person      = personSelector.SelectedPerson,
                MensSeats   = addMensSeats.EditValue == null ? new int?() : (int)addMensSeats.Value,
                WomensSeats = addWomensSeats.EditValue == null ? new int?() : (int)addWomensSeats.Value
            };

            Program.Table <MelaveMalkaSeat>().Rows.Add(row);
            var totalSeats = (row.MensSeats ?? 0) + (row.WomensSeats ?? 0);

            if (totalSeats == 1)
            {
                InfoMessage.Show(MdiParent, "One seat has been reserved for " + row.Person.VeryFullName);
            }
            else
            {
                InfoMessage.Show(MdiParent, totalSeats + " seats have been reserved for " + row.Person.VeryFullName);
            }

            addPanel.Hide();
            personSelector.EditValue = null;
        }
Пример #2
0
 ///<summary>Creates tables that should only be loaded at design-time.</summary>
 ///<remarks>At runtime, these tables are loaded when needed.  However, I still want them in the designer.</remarks>
 static void AddDesignTimeTables(DataContext context)
 {
     context.Tables.AddTable(SeatingReservation.CreateTable());
     context.Tables.AddTable(MelaveMalkaInfo.CreateTable());
     context.Tables.AddTable(MelaveMalkaInvitation.CreateTable());
     context.Tables.AddTable(MelaveMalkaSeat.CreateTable());
     context.Tables.AddTable(Caller.CreateTable());
     context.Tables.AddTable(AdReminderEmail.CreateTable());
     context.Tables.AddTable(RaffleTicket.CreateTable());
 }